#ifndef __INTERACTIVELOG_CLIENT_G_H #define __INTERACTIVELOG_CLIENT_G_H #pragma once // This code is generated by spgen tool! #include "InteractiveLog_def_g.h" namespace InteractiveLog { class LogService_ClientBase : public CClientSessionBase { public: explicit LogService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {} LogService_ClientBase* operator () (const linkContext &curLink) { m_context = curLink; return this; } protected: virtual ~LogService_ClientBase() { /// override by user } public: void OnConnectSucceed() { bSessionClosed = false; } void OnClose(ErrorCodeEnum) { Dbg("session closed."); bSessionClosed = true; } bool QuerySessionClosed() { return bSessionClosed; } ErrorCodeEnum Connect(CSmartPointer &spAsyncWait) { CSmartPointer pFunc = m_pEntityBase->GetFunction(); ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, "InteractiveLog", "LogService", spAsyncWait); if (Error == Error_Succeed) { m_bSysManaged = true; bSessionClosed = false; } return Error; } ErrorCodeEnum Connect() { CSmartPointer spAsyncWait; ErrorCodeEnum Error = Connect(spAsyncWait); if (Error == Error_Succeed) { Error = spAsyncWait->WaitAnswer(); } return Error; } ErrorCodeEnum LogFunction(LogService_LogFunction_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogFunction, LogService_MethodSignature_LogFunction, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum LogCustomerID(LogService_LogCustomerID_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogCustomerID, LogService_MethodSignature_LogCustomerID, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum LogAgreement(LogService_LogAgreement_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogAgreement, LogService_MethodSignature_LogAgreement, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum LogReceipt(LogService_LogReceipt_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogReceipt, LogService_MethodSignature_LogReceipt, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum LogOperation(LogService_LogOperation_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogOperation, LogService_MethodSignature_LogOperation, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum LogResponse(LogService_LogResponse_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogResponse, LogService_MethodSignature_LogResponse, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum LogAgent(LogService_LogAgent_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogAgent, LogService_MethodSignature_LogAgent, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum LogBegin(LogService_LogBegin_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogBegin, LogService_MethodSignature_LogBegin, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum LogEnd(LogService_LogEnd_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogEnd, LogService_MethodSignature_LogEnd, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum LogCallID(LogService_LogCallID_Info &Info) { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } CAutoBuffer Buf = SpObject2Buffer(Info); auto ret = pFunc->OnewayCall(LogService_Method_LogCallID, LogService_MethodSignature_LogCallID, Buf, m_context); m_context.clear(); return ret; } bool SafeDelete() { if (!m_bSysManaged) { delete this; } return m_bSysManaged; } protected: bool m_bSysManaged; CEntityBase *m_pEntityBase; linkContext m_context; bool bSessionClosed; }; /////////////////////////// } // namespace InteractiveLog #endif // __INTERACTIVELOG_CLIENT_G_H