123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- #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<IAsynWaitSp> &spAsyncWait)
- {
- CSmartPointer<IEntityFunction> 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<IAsynWaitSp> spAsyncWait;
- ErrorCodeEnum Error = Connect(spAsyncWait);
- if (Error == Error_Succeed) {
- Error = spAsyncWait->WaitAnswer();
- }
- return Error;
- }
- ErrorCodeEnum LogFunction(LogService_LogFunction_Info &Info)
- {
- CSmartPointer<IClientSessionFunction> 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<IClientSessionFunction> 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<IClientSessionFunction> 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<IClientSessionFunction> 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<IClientSessionFunction> 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<IClientSessionFunction> 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<IClientSessionFunction> 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<IClientSessionFunction> 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<IClientSessionFunction> 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<IClientSessionFunction> 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
|