#ifndef __REMOTECONTROLLER_CLIENT_G_H #define __REMOTECONTROLLER_CLIENT_G_H #pragma once // This code is generated by spgen tool! #include "RemoteController_def_g.h" namespace RemoteController { class RemoteControllerService_ClientBase : public CClientSessionBase { public: explicit RemoteControllerService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {} RemoteControllerService_ClientBase* operator () (const linkContext &curLink) { m_context = curLink; return this; } protected: virtual ~RemoteControllerService_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, "RemoteController", "RemoteControllerService", 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; } bool SafeDelete() { if (!m_bSysManaged) { delete this; } return m_bSysManaged; } protected: bool m_bSysManaged; CEntityBase *m_pEntityBase; linkContext m_context; bool bSessionClosed; }; /////////////////////////// } // namespace RemoteController #endif // __REMOTECONTROLLER_CLIENT_G_H