123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355 |
- #ifndef __GUICONSOLE_SERVER_G_H
- #define __GUICONSOLE_SERVER_G_H
- #pragma once
- // This code is generated by spgen tool!
- #include "GUIConsole_def_g.h"
- namespace GUIConsole {
- class GUIConsoleService_ServerSessionBase : public CServerSessionBase
- {
- public:
- GUIConsoleService_ServerSessionBase() { }
- virtual ~GUIConsoleService_ServerSessionBase() { }
- virtual bool IsExclusive() { return false; }
- virtual bool IsSessionOverlap() { return true; }
- virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
- {
- ErrorCodeEnum Error = Error_Succeed;
- switch (dwMessageID) {
- case GUIConsoleService_Method_GetCurrentMaintainer:
- if (dwSignature == GUIConsoleService_MethodSignature_GetCurrentMaintainer) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_Empower:
- if (dwSignature == GUIConsoleService_MethodSignature_Empower) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_Takeover:
- if (dwSignature == GUIConsoleService_MethodSignature_Takeover) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_ForceQuit:
- if (dwSignature == GUIConsoleService_MethodSignature_ForceQuit) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_AddMaterialCounter:
- if (dwSignature == GUIConsoleService_MethodSignature_AddMaterialCounter) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_GetMaterialCounter:
- if (dwSignature == GUIConsoleService_MethodSignature_GetMaterialCounter) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_ResetMaterialCounter:
- if (dwSignature == GUIConsoleService_MethodSignature_ResetMaterialCounter) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_RegistSwallowedCard:
- if (dwSignature == GUIConsoleService_MethodSignature_RegistSwallowedCard) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_SyncMaterialCount:
- if (dwSignature == GUIConsoleService_MethodSignature_SyncMaterialCount) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_AddTradeManage:
- if (dwSignature == GUIConsoleService_MethodSignature_AddTradeManage) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_QueryMaterialInfo:
- if (dwSignature == GUIConsoleService_MethodSignature_QueryMaterialInfo) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
- {
- ErrorCodeEnum Error = Error_Succeed;
- switch (dwMessageID) {
- case GUIConsoleService_Method_GetCurrentMaintainer:
- if (dwSignature != GUIConsoleService_MethodSignature_GetCurrentMaintainer) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_Empower:
- if (dwSignature != GUIConsoleService_MethodSignature_Empower) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_Takeover:
- if (dwSignature != GUIConsoleService_MethodSignature_Takeover) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_ForceQuit:
- if (dwSignature != GUIConsoleService_MethodSignature_ForceQuit) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_AddMaterialCounter:
- if (dwSignature != GUIConsoleService_MethodSignature_AddMaterialCounter) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_GetMaterialCounter:
- if (dwSignature != GUIConsoleService_MethodSignature_GetMaterialCounter) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_ResetMaterialCounter:
- if (dwSignature != GUIConsoleService_MethodSignature_ResetMaterialCounter) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_RegistSwallowedCard:
- if (dwSignature != GUIConsoleService_MethodSignature_RegistSwallowedCard) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_SyncMaterialCount:
- if (dwSignature != GUIConsoleService_MethodSignature_SyncMaterialCount) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_AddTradeManage:
- if (dwSignature != GUIConsoleService_MethodSignature_AddTradeManage) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case GUIConsoleService_Method_QueryMaterialInfo:
- if (dwSignature != GUIConsoleService_MethodSignature_QueryMaterialInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- virtual void Handle_GetCurrentMaintainer(SpReqAnsContext<GUIConsoleService_GetCurrentMaintainer_Req, GUIConsoleService_GetCurrentMaintainer_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_Empower(SpReqAnsContext<GUIConsoleService_Empower_Req, GUIConsoleService_Empower_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_Takeover(SpReqAnsContext<GUIConsoleService_Takeover_Req, GUIConsoleService_Takeover_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_ForceQuit(SpReqAnsContext<GUIConsoleService_ForceQuit_Req, GUIConsoleService_ForceQuit_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_AddMaterialCounter(SpReqAnsContext<GUIConsoleService_AddMaterialCounter_Req, GUIConsoleService_AddMaterialCounter_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetMaterialCounter(SpReqAnsContext<GUIConsoleService_GetMaterialCounter_Req, GUIConsoleService_GetMaterialCounter_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_ResetMaterialCounter(SpReqAnsContext<GUIConsoleService_ResetMaterialCounter_Req, GUIConsoleService_ResetMaterialCounter_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_RegistSwallowedCard(SpReqAnsContext<GUIConsoleService_RegistSwallowedCard_Req, GUIConsoleService_RegistSwallowedCard_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_SyncMaterialCount(SpOnewayCallContext<GUIConsoleService_SyncMaterialCount_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_AddTradeManage(SpReqAnsContext<GUIConsoleService_AddTradeManage_Req, GUIConsoleService_AddTradeManage_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_QueryMaterialInfo(SpReqAnsContext<GUIConsoleService_QueryMaterialInfo_Req, GUIConsoleService_QueryMaterialInfo_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
- {
- CAutoBuffer Buf;
- DWORD dwMessageID;
- DWORD dwMessageSignature;
- ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
- if (Error == Error_Succeed) {
- #ifdef DEBUG
- assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
- #else
- if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
- pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
- return;
- }
- #endif
- switch (dwMessageID) {
- case GUIConsoleService_Method_GetCurrentMaintainer:
- {
- SpReqAnsContext<GUIConsoleService_GetCurrentMaintainer_Req,GUIConsoleService_GetCurrentMaintainer_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_GetCurrentMaintainer_Req,GUIConsoleService_GetCurrentMaintainer_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetCurrentMaintainer(ctx);
- }
- break;
- case GUIConsoleService_Method_Empower:
- {
- SpReqAnsContext<GUIConsoleService_Empower_Req,GUIConsoleService_Empower_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_Empower_Req,GUIConsoleService_Empower_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_Empower(ctx);
- }
- break;
- case GUIConsoleService_Method_Takeover:
- {
- SpReqAnsContext<GUIConsoleService_Takeover_Req,GUIConsoleService_Takeover_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_Takeover_Req,GUIConsoleService_Takeover_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_Takeover(ctx);
- }
- break;
- case GUIConsoleService_Method_ForceQuit:
- {
- SpReqAnsContext<GUIConsoleService_ForceQuit_Req,GUIConsoleService_ForceQuit_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_ForceQuit_Req,GUIConsoleService_ForceQuit_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_ForceQuit(ctx);
- }
- break;
- case GUIConsoleService_Method_AddMaterialCounter:
- {
- SpReqAnsContext<GUIConsoleService_AddMaterialCounter_Req,GUIConsoleService_AddMaterialCounter_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_AddMaterialCounter_Req,GUIConsoleService_AddMaterialCounter_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_AddMaterialCounter(ctx);
- }
- break;
- case GUIConsoleService_Method_GetMaterialCounter:
- {
- SpReqAnsContext<GUIConsoleService_GetMaterialCounter_Req,GUIConsoleService_GetMaterialCounter_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_GetMaterialCounter_Req,GUIConsoleService_GetMaterialCounter_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetMaterialCounter(ctx);
- }
- break;
- case GUIConsoleService_Method_ResetMaterialCounter:
- {
- SpReqAnsContext<GUIConsoleService_ResetMaterialCounter_Req,GUIConsoleService_ResetMaterialCounter_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_ResetMaterialCounter_Req,GUIConsoleService_ResetMaterialCounter_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_ResetMaterialCounter(ctx);
- }
- break;
- case GUIConsoleService_Method_RegistSwallowedCard:
- {
- SpReqAnsContext<GUIConsoleService_RegistSwallowedCard_Req,GUIConsoleService_RegistSwallowedCard_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_RegistSwallowedCard_Req,GUIConsoleService_RegistSwallowedCard_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_RegistSwallowedCard(ctx);
- }
- break;
- case GUIConsoleService_Method_SyncMaterialCount:
- {
- Dbg("GUIConsoleService_Method_SyncMaterialCount method signature received!");
- SpOnewayCallContext<GUIConsoleService_SyncMaterialCount_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<GUIConsoleService_SyncMaterialCount_Info>());
- Dbg("pre SpBuffer2Object");
- SpBuffer2Object(Buf, ctx->Info);
- Dbg("after SpBuffer2Object");
- Handle_SyncMaterialCount(ctx);
- }
- break;
- case GUIConsoleService_Method_AddTradeManage:
- {
- SpReqAnsContext<GUIConsoleService_AddTradeManage_Req,GUIConsoleService_AddTradeManage_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_AddTradeManage_Req,GUIConsoleService_AddTradeManage_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_AddTradeManage(ctx);
- }
- break;
- case GUIConsoleService_Method_QueryMaterialInfo:
- {
- SpReqAnsContext<GUIConsoleService_QueryMaterialInfo_Req,GUIConsoleService_QueryMaterialInfo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<GUIConsoleService_QueryMaterialInfo_Req,GUIConsoleService_QueryMaterialInfo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_QueryMaterialInfo(ctx);
- }
- break;
- default:
- assert(0);
- break;
- }
-
- } else {
- pTransactionContext->SendAnswer(Error);
- }
- }
- };
- ///////////////////////////
- } // namespace GUIConsole
- #endif // __GUICONSOLE_SERVER_G_H
|