RemoteController_client_g.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef __REMOTECONTROLLER_CLIENT_G_H
  2. #define __REMOTECONTROLLER_CLIENT_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "RemoteController_def_g.h"
  6. namespace RemoteController {
  7. class RemoteControllerService_ClientBase : public CClientSessionBase {
  8. public:
  9. RemoteControllerService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {}
  10. protected:
  11. virtual ~RemoteControllerService_ClientBase() {}
  12. public:
  13. ErrorCodeEnum Connect(CSmartPointer<IAsynWaitSp> &spAsyncWait)
  14. {
  15. CSmartPointer<IEntityFunction> pFunc = m_pEntityBase->GetFunction();
  16. ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, "RemoteController", "RemoteControllerService", spAsyncWait);
  17. if (Error == Error_Succeed) {
  18. m_bSysManaged = true;
  19. }
  20. return Error;
  21. }
  22. ErrorCodeEnum Connect()
  23. {
  24. CSmartPointer<IAsynWaitSp> spAsyncWait;
  25. ErrorCodeEnum Error = Connect(spAsyncWait);
  26. if (Error == Error_Succeed) {
  27. Error = spAsyncWait->WaitAnswer();
  28. }
  29. return Error;
  30. }
  31. bool SafeDelete()
  32. {
  33. if (!m_bSysManaged) {
  34. delete this;
  35. }
  36. return m_bSysManaged;
  37. }
  38. protected:
  39. bool m_bSysManaged;
  40. CEntityBase *m_pEntityBase;
  41. };
  42. ///////////////////////////
  43. } // namespace RemoteController
  44. #endif // __REMOTECONTROLLER_CLIENT_G_H