GUIConsole_server_g.h 13 KB

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