#ifndef __INITIATIVETRANSFER_CLIENT_G_H #define __INITIATIVETRANSFER_CLIENT_G_H #pragma once // This code is generated by spgen tool! #include "InitiativeTransfer_def_g.h" namespace InitiativeTransfer { class FlowService_ClientBase : public CClientSessionBase { public: explicit FlowService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {} FlowService_ClientBase* operator () (const linkContext &curLink) { m_context = curLink; return this; } protected: virtual ~FlowService_ClientBase() { /// override by user } public: void OnConnectSucceed() { bSessionClosed = false; } void OnClose(ErrorCodeEnum) { bSessionClosed = true; } bool QuerySessionClosed() { return bSessionClosed; } ErrorCodeEnum Connect(CSmartPointer &spAsyncWait) { CSmartPointer pFunc = m_pEntityBase->GetFunction(); ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, "InitiativeTransfer", "FlowService", 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 SwitchToAgentFlow(FlowService_SwitchToAgentFlow_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(FlowService_Method_SwitchToAgentFlow, FlowService_MethodSignature_SwitchToAgentFlow, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum DisallowControl(FlowService_DisallowControl_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(FlowService_Method_DisallowControl, FlowService_MethodSignature_DisallowControl, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum ReturnAgent(FlowService_ReturnAgent_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(FlowService_Method_ReturnAgent, FlowService_MethodSignature_ReturnAgent, Buf, m_context); m_context.clear(); return ret; } ErrorCodeEnum SwitchToFrontFlow() { CSmartPointer pFunc = GetFunction(); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } auto ret = pFunc->OnewayCall(FlowService_Method_SwitchToFrontFlow, FlowService_MethodSignature_SwitchToFrontFlow, 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 InitiativeTransfer #endif // __INITIATIVETRANSFER_CLIENT_G_H