123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- #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<IAsynWaitSp> &spAsyncWait)
- {
- CSmartPointer<IEntityFunction> 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<IAsynWaitSp> spAsyncWait;
- ErrorCodeEnum Error = Connect(spAsyncWait);
- if (Error == Error_Succeed) {
- Error = spAsyncWait->WaitAnswer();
- }
- return Error;
- }
- ErrorCodeEnum SwitchToAgentFlow(FlowService_SwitchToAgentFlow_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(FlowService_Method_SwitchToAgentFlow, FlowService_MethodSignature_SwitchToAgentFlow, Buf, m_context);
- m_context.clear();
- return ret;
- }
- ErrorCodeEnum DisallowControl(FlowService_DisallowControl_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(FlowService_Method_DisallowControl, FlowService_MethodSignature_DisallowControl, Buf, m_context);
- m_context.clear();
- return ret;
- }
- ErrorCodeEnum ReturnAgent(FlowService_ReturnAgent_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(FlowService_Method_ReturnAgent, FlowService_MethodSignature_ReturnAgent, Buf, m_context);
- m_context.clear();
- return ret;
- }
- ErrorCodeEnum SwitchToFrontFlow()
- {
- 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();
- }
- 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
|