InteractiveLog_client_g.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. #ifndef __INTERACTIVELOG_CLIENT_G_H
  2. #define __INTERACTIVELOG_CLIENT_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "InteractiveLog_def_g.h"
  6. namespace InteractiveLog {
  7. class LogService_ClientBase : public CClientSessionBase {
  8. public:
  9. explicit LogService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {}
  10. LogService_ClientBase* operator () (const linkContext &curLink)
  11. {
  12. m_context = curLink;
  13. return this;
  14. }
  15. protected:
  16. virtual ~LogService_ClientBase()
  17. {
  18. /// override by user
  19. }
  20. public:
  21. void OnConnectSucceed()
  22. {
  23. bSessionClosed = false;
  24. }
  25. void OnClose(ErrorCodeEnum)
  26. {
  27. Dbg("session closed.");
  28. bSessionClosed = true;
  29. }
  30. bool QuerySessionClosed()
  31. {
  32. return bSessionClosed;
  33. }
  34. ErrorCodeEnum Connect(CSmartPointer<IAsynWaitSp> &spAsyncWait)
  35. {
  36. CSmartPointer<IEntityFunction> pFunc = m_pEntityBase->GetFunction();
  37. ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, "InteractiveLog", "LogService", spAsyncWait);
  38. if (Error == Error_Succeed) {
  39. m_bSysManaged = true;
  40. bSessionClosed = false;
  41. }
  42. return Error;
  43. }
  44. ErrorCodeEnum Connect()
  45. {
  46. CSmartPointer<IAsynWaitSp> spAsyncWait;
  47. ErrorCodeEnum Error = Connect(spAsyncWait);
  48. if (Error == Error_Succeed) {
  49. Error = spAsyncWait->WaitAnswer();
  50. }
  51. return Error;
  52. }
  53. ErrorCodeEnum LogFunction(LogService_LogFunction_Info &Info)
  54. {
  55. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  56. if (m_context.checkEmpty())
  57. {
  58. m_context.AutoGenerate();
  59. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  60. m_context = m_context.upgradeLink();
  61. }
  62. CAutoBuffer Buf = SpObject2Buffer(Info);
  63. auto ret = pFunc->OnewayCall(LogService_Method_LogFunction, LogService_MethodSignature_LogFunction, Buf, m_context);
  64. m_context.clear();
  65. return ret;
  66. }
  67. ErrorCodeEnum LogCustomerID(LogService_LogCustomerID_Info &Info)
  68. {
  69. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  70. if (m_context.checkEmpty())
  71. {
  72. m_context.AutoGenerate();
  73. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  74. m_context = m_context.upgradeLink();
  75. }
  76. CAutoBuffer Buf = SpObject2Buffer(Info);
  77. auto ret = pFunc->OnewayCall(LogService_Method_LogCustomerID, LogService_MethodSignature_LogCustomerID, Buf, m_context);
  78. m_context.clear();
  79. return ret;
  80. }
  81. ErrorCodeEnum LogAgreement(LogService_LogAgreement_Info &Info)
  82. {
  83. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  84. if (m_context.checkEmpty())
  85. {
  86. m_context.AutoGenerate();
  87. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  88. m_context = m_context.upgradeLink();
  89. }
  90. CAutoBuffer Buf = SpObject2Buffer(Info);
  91. auto ret = pFunc->OnewayCall(LogService_Method_LogAgreement, LogService_MethodSignature_LogAgreement, Buf, m_context);
  92. m_context.clear();
  93. return ret;
  94. }
  95. ErrorCodeEnum LogReceipt(LogService_LogReceipt_Info &Info)
  96. {
  97. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  98. if (m_context.checkEmpty())
  99. {
  100. m_context.AutoGenerate();
  101. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  102. m_context = m_context.upgradeLink();
  103. }
  104. CAutoBuffer Buf = SpObject2Buffer(Info);
  105. auto ret = pFunc->OnewayCall(LogService_Method_LogReceipt, LogService_MethodSignature_LogReceipt, Buf, m_context);
  106. m_context.clear();
  107. return ret;
  108. }
  109. ErrorCodeEnum LogOperation(LogService_LogOperation_Info &Info)
  110. {
  111. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  112. if (m_context.checkEmpty())
  113. {
  114. m_context.AutoGenerate();
  115. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  116. m_context = m_context.upgradeLink();
  117. }
  118. CAutoBuffer Buf = SpObject2Buffer(Info);
  119. auto ret = pFunc->OnewayCall(LogService_Method_LogOperation, LogService_MethodSignature_LogOperation, Buf, m_context);
  120. m_context.clear();
  121. return ret;
  122. }
  123. ErrorCodeEnum LogResponse(LogService_LogResponse_Info &Info)
  124. {
  125. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  126. if (m_context.checkEmpty())
  127. {
  128. m_context.AutoGenerate();
  129. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  130. m_context = m_context.upgradeLink();
  131. }
  132. CAutoBuffer Buf = SpObject2Buffer(Info);
  133. auto ret = pFunc->OnewayCall(LogService_Method_LogResponse, LogService_MethodSignature_LogResponse, Buf, m_context);
  134. m_context.clear();
  135. return ret;
  136. }
  137. ErrorCodeEnum LogAgent(LogService_LogAgent_Info &Info)
  138. {
  139. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  140. if (m_context.checkEmpty())
  141. {
  142. m_context.AutoGenerate();
  143. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  144. m_context = m_context.upgradeLink();
  145. }
  146. CAutoBuffer Buf = SpObject2Buffer(Info);
  147. auto ret = pFunc->OnewayCall(LogService_Method_LogAgent, LogService_MethodSignature_LogAgent, Buf, m_context);
  148. m_context.clear();
  149. return ret;
  150. }
  151. ErrorCodeEnum LogBegin(LogService_LogBegin_Info &Info)
  152. {
  153. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  154. if (m_context.checkEmpty())
  155. {
  156. m_context.AutoGenerate();
  157. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  158. m_context = m_context.upgradeLink();
  159. }
  160. CAutoBuffer Buf = SpObject2Buffer(Info);
  161. auto ret = pFunc->OnewayCall(LogService_Method_LogBegin, LogService_MethodSignature_LogBegin, Buf, m_context);
  162. m_context.clear();
  163. return ret;
  164. }
  165. ErrorCodeEnum LogEnd(LogService_LogEnd_Info &Info)
  166. {
  167. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  168. if (m_context.checkEmpty())
  169. {
  170. m_context.AutoGenerate();
  171. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  172. m_context = m_context.upgradeLink();
  173. }
  174. CAutoBuffer Buf = SpObject2Buffer(Info);
  175. auto ret = pFunc->OnewayCall(LogService_Method_LogEnd, LogService_MethodSignature_LogEnd, Buf, m_context);
  176. m_context.clear();
  177. return ret;
  178. }
  179. ErrorCodeEnum LogCallID(LogService_LogCallID_Info &Info)
  180. {
  181. CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
  182. if (m_context.checkEmpty())
  183. {
  184. m_context.AutoGenerate();
  185. DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
  186. m_context = m_context.upgradeLink();
  187. }
  188. CAutoBuffer Buf = SpObject2Buffer(Info);
  189. auto ret = pFunc->OnewayCall(LogService_Method_LogCallID, LogService_MethodSignature_LogCallID, Buf, m_context);
  190. m_context.clear();
  191. return ret;
  192. }
  193. bool SafeDelete()
  194. {
  195. if (!m_bSysManaged) {
  196. delete this;
  197. }
  198. return m_bSysManaged;
  199. }
  200. protected:
  201. bool m_bSysManaged;
  202. CEntityBase *m_pEntityBase;
  203. linkContext m_context;
  204. bool bSessionClosed;
  205. };
  206. ///////////////////////////
  207. } // namespace InteractiveLog
  208. #endif // __INTERACTIVELOG_CLIENT_G_H