1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 /////////////////////////////////////////////////////////////////
18 // WARNING : this is a generated file, don't change it !
19 /////////////////////////////////////////////////////////////////
23 #include "logger_service_itf.h"
28 /////////////////////////////////////////////////////////////////
29 // WARNING : this is a generated file, don't change it !
30 /////////////////////////////////////////////////////////////////
33 const CLoggerServiceSkel::TMessageHandlerMap
&CLoggerServiceSkel::getMessageHandlers() const
35 static TMessageHandlerMap handlers
;
36 static bool init
= false;
40 std::pair
< TMessageHandlerMap::iterator
, bool > res
;
42 res
= handlers
.insert(std::make_pair(std::string("RC"), &CLoggerServiceSkel::registerClient_skel
));
43 // if this assert, you have a doubly message name in your interface definition !
46 res
= handlers
.insert(std::make_pair(std::string("LG"), &CLoggerServiceSkel::reportLog_skel
));
47 // if this assert, you have a doubly message name in your interface definition !
55 bool CLoggerServiceSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&message
)
57 const TMessageHandlerMap
&mh
= getMessageHandlers();
59 TMessageHandlerMap::const_iterator
it(mh
.find(message
.getName()));
66 TMessageHandler cmd
= it
->second
;
67 (this->*cmd
)(sender
, message
);
73 void CLoggerServiceSkel::registerClient_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
75 H_AUTO(CLoggerServiceSkel_registerClient_RC
);
77 nlRead(__message
, serial
, shardId
);
78 std::vector
< TLogDefinition
> logDef
;
79 nlRead(__message
, serialCont
, logDef
);
80 registerClient(sender
, shardId
, logDef
);
83 void CLoggerServiceSkel::reportLog_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
85 H_AUTO(CLoggerServiceSkel_reportLog_LG
);
86 std::vector
< TLogInfo
> logInfos
;
87 nlRead(__message
, serialCont
, logInfos
);
88 reportLog(sender
, logInfos
);
90 // A logger client register itself wy providing it's definition of
91 // the log content. It is mandatory that ALL client share
92 // Exactly the same definition of log.
93 void CLoggerServiceProxy::registerClient(NLNET::IModule
*sender
, uint32 shardId
, const std::vector
< TLogDefinition
> &logDef
)
95 if (_LocalModuleSkel
&& _LocalModule
->isImmediateDispatchingSupported())
97 // immediate local synchronous dispatching
98 _LocalModuleSkel
->registerClient(_ModuleProxy
->getModuleGateway()->getPluggedModuleProxy(sender
), shardId
, logDef
);
102 // send the message for remote dispatching and execution or local queing
103 NLNET::CMessage __message
;
105 buildMessageFor_registerClient(__message
, shardId
, logDef
);
107 _ModuleProxy
->sendModuleMessage(sender
, __message
);
110 // A client send a log
111 void CLoggerServiceProxy::reportLog(NLNET::IModule
*sender
, const std::vector
< TLogInfo
> &logInfos
)
113 if (_LocalModuleSkel
&& _LocalModule
->isImmediateDispatchingSupported())
115 // immediate local synchronous dispatching
116 _LocalModuleSkel
->reportLog(_ModuleProxy
->getModuleGateway()->getPluggedModuleProxy(sender
), logInfos
);
120 // send the message for remote dispatching and execution or local queing
121 NLNET::CMessage __message
;
123 buildMessageFor_reportLog(__message
, logInfos
);
125 _ModuleProxy
->sendModuleMessage(sender
, __message
);
129 // Message serializer. Return the message received in reference for easier integration
130 const NLNET::CMessage
&CLoggerServiceProxy::buildMessageFor_registerClient(NLNET::CMessage
&__message
, uint32 shardId
, const std::vector
< TLogDefinition
> &logDef
)
132 __message
.setType("RC");
133 nlWrite(__message
, serial
, shardId
);
134 nlWrite(__message
, serialCont
, const_cast < std::vector
< TLogDefinition
>& > (logDef
));
140 // Message serializer. Return the message received in reference for easier integration
141 const NLNET::CMessage
&CLoggerServiceProxy::buildMessageFor_reportLog(NLNET::CMessage
&__message
, const std::vector
< TLogInfo
> &logInfos
)
143 __message
.setType("LG");
144 nlWrite(__message
, serialCont
, const_cast < std::vector
< TLogInfo
>& > (logInfos
));