GUIConsole_server_g.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. #ifndef __GUICONSOLE_SERVER_G_H
  2. #define __GUICONSOLE_SERVER_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "GUIConsole_def_g.h"
  6. namespace GUIConsole {
  7. class GUIConsoleService_ServerSessionBase : public CServerSessionBase
  8. {
  9. public:
  10. GUIConsoleService_ServerSessionBase() { }
  11. virtual ~GUIConsoleService_ServerSessionBase() { }
  12. virtual bool IsExclusive() { return false; }
  13. virtual bool IsSessionOverlap() { return true; }
  14. virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
  15. {
  16. ErrorCodeEnum Error = Error_Succeed;
  17. switch (dwMessageID) {
  18. case GUIConsoleService_Method_GetCurrentMaintainer:
  19. if (dwSignature == GUIConsoleService_MethodSignature_GetCurrentMaintainer) {
  20. bOverlap = true;
  21. } else {
  22. Error = Error_MethodSignatureFailed;
  23. }
  24. break;
  25. case GUIConsoleService_Method_Empower:
  26. if (dwSignature == GUIConsoleService_MethodSignature_Empower) {
  27. bOverlap = true;
  28. } else {
  29. Error = Error_MethodSignatureFailed;
  30. }
  31. break;
  32. case GUIConsoleService_Method_Takeover:
  33. if (dwSignature == GUIConsoleService_MethodSignature_Takeover) {
  34. bOverlap = true;
  35. } else {
  36. Error = Error_MethodSignatureFailed;
  37. }
  38. break;
  39. case GUIConsoleService_Method_ForceQuit:
  40. if (dwSignature == GUIConsoleService_MethodSignature_ForceQuit) {
  41. bOverlap = true;
  42. } else {
  43. Error = Error_MethodSignatureFailed;
  44. }
  45. break;
  46. case GUIConsoleService_Method_AddMaterialCounter:
  47. if (dwSignature == GUIConsoleService_MethodSignature_AddMaterialCounter) {
  48. bOverlap = true;
  49. } else {
  50. Error = Error_MethodSignatureFailed;
  51. }
  52. break;
  53. case GUIConsoleService_Method_GetMaterialCounter:
  54. if (dwSignature == GUIConsoleService_MethodSignature_GetMaterialCounter) {
  55. bOverlap = true;
  56. } else {
  57. Error = Error_MethodSignatureFailed;
  58. }
  59. break;
  60. case GUIConsoleService_Method_ResetMaterialCounter:
  61. if (dwSignature == GUIConsoleService_MethodSignature_ResetMaterialCounter) {
  62. bOverlap = true;
  63. } else {
  64. Error = Error_MethodSignatureFailed;
  65. }
  66. break;
  67. case GUIConsoleService_Method_RegistSwallowedCard:
  68. if (dwSignature == GUIConsoleService_MethodSignature_RegistSwallowedCard) {
  69. bOverlap = true;
  70. } else {
  71. Error = Error_MethodSignatureFailed;
  72. }
  73. break;
  74. case GUIConsoleService_Method_SyncMaterialCount:
  75. if (dwSignature == GUIConsoleService_MethodSignature_SyncMaterialCount) {
  76. bOverlap = true;
  77. } else {
  78. Error = Error_MethodSignatureFailed;
  79. }
  80. break;
  81. case GUIConsoleService_Method_AddTradeManage:
  82. if (dwSignature == GUIConsoleService_MethodSignature_AddTradeManage) {
  83. bOverlap = true;
  84. } else {
  85. Error = Error_MethodSignatureFailed;
  86. }
  87. break;
  88. case GUIConsoleService_Method_QueryMaterialInfo:
  89. if (dwSignature == GUIConsoleService_MethodSignature_QueryMaterialInfo) {
  90. bOverlap = true;
  91. } else {
  92. Error = Error_MethodSignatureFailed;
  93. }
  94. break;
  95. default:
  96. Error = Error_MethodNotFound;
  97. break;
  98. }
  99. return Error;
  100. }
  101. int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
  102. {
  103. ErrorCodeEnum Error = Error_Succeed;
  104. switch (dwMessageID) {
  105. case GUIConsoleService_Method_GetCurrentMaintainer:
  106. if (dwSignature != GUIConsoleService_MethodSignature_GetCurrentMaintainer) {
  107. Error = Error_MethodSignatureFailed;
  108. }
  109. break;
  110. case GUIConsoleService_Method_Empower:
  111. if (dwSignature != GUIConsoleService_MethodSignature_Empower) {
  112. Error = Error_MethodSignatureFailed;
  113. }
  114. break;
  115. case GUIConsoleService_Method_Takeover:
  116. if (dwSignature != GUIConsoleService_MethodSignature_Takeover) {
  117. Error = Error_MethodSignatureFailed;
  118. }
  119. break;
  120. case GUIConsoleService_Method_ForceQuit:
  121. if (dwSignature != GUIConsoleService_MethodSignature_ForceQuit) {
  122. Error = Error_MethodSignatureFailed;
  123. }
  124. break;
  125. case GUIConsoleService_Method_AddMaterialCounter:
  126. if (dwSignature != GUIConsoleService_MethodSignature_AddMaterialCounter) {
  127. Error = Error_MethodSignatureFailed;
  128. }
  129. break;
  130. case GUIConsoleService_Method_GetMaterialCounter:
  131. if (dwSignature != GUIConsoleService_MethodSignature_GetMaterialCounter) {
  132. Error = Error_MethodSignatureFailed;
  133. }
  134. break;
  135. case GUIConsoleService_Method_ResetMaterialCounter:
  136. if (dwSignature != GUIConsoleService_MethodSignature_ResetMaterialCounter) {
  137. Error = Error_MethodSignatureFailed;
  138. }
  139. break;
  140. case GUIConsoleService_Method_RegistSwallowedCard:
  141. if (dwSignature != GUIConsoleService_MethodSignature_RegistSwallowedCard) {
  142. Error = Error_MethodSignatureFailed;
  143. }
  144. break;
  145. case GUIConsoleService_Method_SyncMaterialCount:
  146. if (dwSignature != GUIConsoleService_MethodSignature_SyncMaterialCount) {
  147. Error = Error_MethodSignatureFailed;
  148. }
  149. break;
  150. case GUIConsoleService_Method_AddTradeManage:
  151. if (dwSignature != GUIConsoleService_MethodSignature_AddTradeManage) {
  152. Error = Error_MethodSignatureFailed;
  153. }
  154. break;
  155. case GUIConsoleService_Method_QueryMaterialInfo:
  156. if (dwSignature != GUIConsoleService_MethodSignature_QueryMaterialInfo) {
  157. Error = Error_MethodSignatureFailed;
  158. }
  159. break;
  160. default:
  161. Error = Error_MethodNotFound;
  162. break;
  163. }
  164. return Error;
  165. }
  166. virtual void Handle_GetCurrentMaintainer(SpReqAnsContext<GUIConsoleService_GetCurrentMaintainer_Req, GUIConsoleService_GetCurrentMaintainer_Ans>::Pointer ctx)
  167. {
  168. /// override by user
  169. }
  170. virtual void Handle_Empower(SpReqAnsContext<GUIConsoleService_Empower_Req, GUIConsoleService_Empower_Ans>::Pointer ctx)
  171. {
  172. /// override by user
  173. }
  174. virtual void Handle_Takeover(SpReqAnsContext<GUIConsoleService_Takeover_Req, GUIConsoleService_Takeover_Ans>::Pointer ctx)
  175. {
  176. /// override by user
  177. }
  178. virtual void Handle_ForceQuit(SpReqAnsContext<GUIConsoleService_ForceQuit_Req, GUIConsoleService_ForceQuit_Ans>::Pointer ctx)
  179. {
  180. /// override by user
  181. }
  182. virtual void Handle_AddMaterialCounter(SpReqAnsContext<GUIConsoleService_AddMaterialCounter_Req, GUIConsoleService_AddMaterialCounter_Ans>::Pointer ctx)
  183. {
  184. /// override by user
  185. }
  186. virtual void Handle_GetMaterialCounter(SpReqAnsContext<GUIConsoleService_GetMaterialCounter_Req, GUIConsoleService_GetMaterialCounter_Ans>::Pointer ctx)
  187. {
  188. /// override by user
  189. }
  190. virtual void Handle_ResetMaterialCounter(SpReqAnsContext<GUIConsoleService_ResetMaterialCounter_Req, GUIConsoleService_ResetMaterialCounter_Ans>::Pointer ctx)
  191. {
  192. /// override by user
  193. }
  194. virtual void Handle_RegistSwallowedCard(SpReqAnsContext<GUIConsoleService_RegistSwallowedCard_Req, GUIConsoleService_RegistSwallowedCard_Ans>::Pointer ctx)
  195. {
  196. /// override by user
  197. }
  198. virtual void Handle_SyncMaterialCount(SpOnewayCallContext<GUIConsoleService_SyncMaterialCount_Info>::Pointer ctx)
  199. {
  200. /// override by user
  201. }
  202. virtual void Handle_AddTradeManage(SpReqAnsContext<GUIConsoleService_AddTradeManage_Req, GUIConsoleService_AddTradeManage_Ans>::Pointer ctx)
  203. {
  204. /// override by user
  205. }
  206. virtual void Handle_QueryMaterialInfo(SpReqAnsContext<GUIConsoleService_QueryMaterialInfo_Req, GUIConsoleService_QueryMaterialInfo_Ans>::Pointer ctx)
  207. {
  208. /// override by user
  209. }
  210. virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
  211. {
  212. CAutoBuffer Buf;
  213. DWORD dwMessageID;
  214. DWORD dwMessageSignature;
  215. ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
  216. if (Error == Error_Succeed) {
  217. #ifdef DEBUG
  218. assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
  219. #else
  220. if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
  221. pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
  222. return;
  223. }
  224. #endif
  225. switch (dwMessageID) {
  226. case GUIConsoleService_Method_GetCurrentMaintainer:
  227. {
  228. SpReqAnsContext<GUIConsoleService_GetCurrentMaintainer_Req,GUIConsoleService_GetCurrentMaintainer_Ans>::Pointer ctx;
  229. ctx.Attach(new SpReqAnsContext<GUIConsoleService_GetCurrentMaintainer_Req,GUIConsoleService_GetCurrentMaintainer_Ans>(pTransactionContext));
  230. SpBuffer2Object(Buf, ctx->Req);
  231. Handle_GetCurrentMaintainer(ctx);
  232. }
  233. break;
  234. case GUIConsoleService_Method_Empower:
  235. {
  236. SpReqAnsContext<GUIConsoleService_Empower_Req,GUIConsoleService_Empower_Ans>::Pointer ctx;
  237. ctx.Attach(new SpReqAnsContext<GUIConsoleService_Empower_Req,GUIConsoleService_Empower_Ans>(pTransactionContext));
  238. SpBuffer2Object(Buf, ctx->Req);
  239. Handle_Empower(ctx);
  240. }
  241. break;
  242. case GUIConsoleService_Method_Takeover:
  243. {
  244. SpReqAnsContext<GUIConsoleService_Takeover_Req,GUIConsoleService_Takeover_Ans>::Pointer ctx;
  245. ctx.Attach(new SpReqAnsContext<GUIConsoleService_Takeover_Req,GUIConsoleService_Takeover_Ans>(pTransactionContext));
  246. SpBuffer2Object(Buf, ctx->Req);
  247. Handle_Takeover(ctx);
  248. }
  249. break;
  250. case GUIConsoleService_Method_ForceQuit:
  251. {
  252. SpReqAnsContext<GUIConsoleService_ForceQuit_Req,GUIConsoleService_ForceQuit_Ans>::Pointer ctx;
  253. ctx.Attach(new SpReqAnsContext<GUIConsoleService_ForceQuit_Req,GUIConsoleService_ForceQuit_Ans>(pTransactionContext));
  254. SpBuffer2Object(Buf, ctx->Req);
  255. Handle_ForceQuit(ctx);
  256. }
  257. break;
  258. case GUIConsoleService_Method_AddMaterialCounter:
  259. {
  260. SpReqAnsContext<GUIConsoleService_AddMaterialCounter_Req,GUIConsoleService_AddMaterialCounter_Ans>::Pointer ctx;
  261. ctx.Attach(new SpReqAnsContext<GUIConsoleService_AddMaterialCounter_Req,GUIConsoleService_AddMaterialCounter_Ans>(pTransactionContext));
  262. SpBuffer2Object(Buf, ctx->Req);
  263. Handle_AddMaterialCounter(ctx);
  264. }
  265. break;
  266. case GUIConsoleService_Method_GetMaterialCounter:
  267. {
  268. SpReqAnsContext<GUIConsoleService_GetMaterialCounter_Req,GUIConsoleService_GetMaterialCounter_Ans>::Pointer ctx;
  269. ctx.Attach(new SpReqAnsContext<GUIConsoleService_GetMaterialCounter_Req,GUIConsoleService_GetMaterialCounter_Ans>(pTransactionContext));
  270. SpBuffer2Object(Buf, ctx->Req);
  271. Handle_GetMaterialCounter(ctx);
  272. }
  273. break;
  274. case GUIConsoleService_Method_ResetMaterialCounter:
  275. {
  276. SpReqAnsContext<GUIConsoleService_ResetMaterialCounter_Req,GUIConsoleService_ResetMaterialCounter_Ans>::Pointer ctx;
  277. ctx.Attach(new SpReqAnsContext<GUIConsoleService_ResetMaterialCounter_Req,GUIConsoleService_ResetMaterialCounter_Ans>(pTransactionContext));
  278. SpBuffer2Object(Buf, ctx->Req);
  279. Handle_ResetMaterialCounter(ctx);
  280. }
  281. break;
  282. case GUIConsoleService_Method_RegistSwallowedCard:
  283. {
  284. SpReqAnsContext<GUIConsoleService_RegistSwallowedCard_Req,GUIConsoleService_RegistSwallowedCard_Ans>::Pointer ctx;
  285. ctx.Attach(new SpReqAnsContext<GUIConsoleService_RegistSwallowedCard_Req,GUIConsoleService_RegistSwallowedCard_Ans>(pTransactionContext));
  286. SpBuffer2Object(Buf, ctx->Req);
  287. Handle_RegistSwallowedCard(ctx);
  288. }
  289. break;
  290. case GUIConsoleService_Method_SyncMaterialCount:
  291. {
  292. Dbg("GUIConsoleService_Method_SyncMaterialCount method signature received!");
  293. SpOnewayCallContext<GUIConsoleService_SyncMaterialCount_Info>::Pointer ctx;
  294. ctx.Attach(new SpOnewayCallContext<GUIConsoleService_SyncMaterialCount_Info>());
  295. Dbg("pre SpBuffer2Object");
  296. SpBuffer2Object(Buf, ctx->Info);
  297. Dbg("after SpBuffer2Object");
  298. Handle_SyncMaterialCount(ctx);
  299. }
  300. break;
  301. case GUIConsoleService_Method_AddTradeManage:
  302. {
  303. SpReqAnsContext<GUIConsoleService_AddTradeManage_Req,GUIConsoleService_AddTradeManage_Ans>::Pointer ctx;
  304. ctx.Attach(new SpReqAnsContext<GUIConsoleService_AddTradeManage_Req,GUIConsoleService_AddTradeManage_Ans>(pTransactionContext));
  305. SpBuffer2Object(Buf, ctx->Req);
  306. Handle_AddTradeManage(ctx);
  307. }
  308. break;
  309. case GUIConsoleService_Method_QueryMaterialInfo:
  310. {
  311. SpReqAnsContext<GUIConsoleService_QueryMaterialInfo_Req,GUIConsoleService_QueryMaterialInfo_Ans>::Pointer ctx;
  312. ctx.Attach(new SpReqAnsContext<GUIConsoleService_QueryMaterialInfo_Req,GUIConsoleService_QueryMaterialInfo_Ans>(pTransactionContext));
  313. SpBuffer2Object(Buf, ctx->Req);
  314. Handle_QueryMaterialInfo(ctx);
  315. }
  316. break;
  317. default:
  318. assert(0);
  319. break;
  320. }
  321. } else {
  322. pTransactionContext->SendAnswer(Error);
  323. }
  324. }
  325. };
  326. ///////////////////////////
  327. } // namespace GUIConsole
  328. #endif // __GUICONSOLE_SERVER_G_H