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 /////////////////////////////////////////////////////////////////
21 #include "spa_module_itf.h"
26 /////////////////////////////////////////////////////////////////
27 // WARNING : this is a generated file, don't change it !
28 /////////////////////////////////////////////////////////////////
31 const CServerPatchApplierSkel::TMessageHandlerMap
&CServerPatchApplierSkel::getMessageHandlers() const
33 static TMessageHandlerMap handlers
;
34 static bool init
= false;
38 std::pair
< TMessageHandlerMap::iterator
, bool > res
;
40 res
= handlers
.insert(std::make_pair(std::string("SPA_SETNEXT"), &CServerPatchApplierSkel::installVersion_skel
));
41 // if this assert, you have a doubly message name in your interface definition !
44 res
= handlers
.insert(std::make_pair(std::string("SPA_SETLIVE"), &CServerPatchApplierSkel::launchVersion_skel
));
45 // if this assert, you have a doubly message name in your interface definition !
48 res
= handlers
.insert(std::make_pair(std::string("SPA_EXEC"), &CServerPatchApplierSkel::executeCommand_skel
));
49 // if this assert, you have a doubly message name in your interface definition !
57 bool CServerPatchApplierSkel::onDispatchMessage(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&message
)
59 const TMessageHandlerMap
&mh
= getMessageHandlers();
61 TMessageHandlerMap::const_iterator
it(mh
.find(message
.getName()));
68 TMessageHandler cmd
= it
->second
;
69 (this->*cmd
)(sender
, message
);
75 void CServerPatchApplierSkel::installVersion_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
77 NLMISC::CSString domainName
;
78 nlRead(__message
, serial
, domainName
);
80 nlRead(__message
, serial
, version
);
81 installVersion(sender
, domainName
, version
);
84 void CServerPatchApplierSkel::launchVersion_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
86 NLMISC::CSString domainName
;
87 nlRead(__message
, serial
, domainName
);
89 nlRead(__message
, serial
, version
);
90 launchVersion(sender
, domainName
, version
);
93 void CServerPatchApplierSkel::executeCommand_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
95 NLMISC::CSString cmdline
;
96 nlRead(__message
, serial
, cmdline
);
97 NLMISC::CSString originator
;
98 nlRead(__message
, serial
, originator
);
99 executeCommand(sender
, cmdline
, originator
);
102 void CServerPatchApplierProxy::installVersion(NLNET::IModule
*sender
, const NLMISC::CSString
&domainName
, uint32 version
)
104 if (_LocalModuleSkel
&& _LocalModule
->isImmediateDispatchingSupported())
106 // immediate local synchronous dispatching
107 _LocalModuleSkel
->installVersion(_ModuleProxy
->getModuleGateway()->getPluggedModuleProxy(sender
), domainName
, version
);
111 // send the message for remote dispatching and execution or local queing
112 NLNET::CMessage __message
;
114 buildMessageFor_installVersion(__message
, domainName
, version
);
116 _ModuleProxy
->sendModuleMessage(sender
, __message
);
120 void CServerPatchApplierProxy::launchVersion(NLNET::IModule
*sender
, const NLMISC::CSString
&domainName
, uint32 version
)
122 if (_LocalModuleSkel
&& _LocalModule
->isImmediateDispatchingSupported())
124 // immediate local synchronous dispatching
125 _LocalModuleSkel
->launchVersion(_ModuleProxy
->getModuleGateway()->getPluggedModuleProxy(sender
), domainName
, version
);
129 // send the message for remote dispatching and execution or local queing
130 NLNET::CMessage __message
;
132 buildMessageFor_launchVersion(__message
, domainName
, version
);
134 _ModuleProxy
->sendModuleMessage(sender
, __message
);
138 // Message sent by SPM to tell us to execute a comman locally
139 void CServerPatchApplierProxy::executeCommand(NLNET::IModule
*sender
, const NLMISC::CSString
&cmdline
, const NLMISC::CSString
&originator
)
141 if (_LocalModuleSkel
&& _LocalModule
->isImmediateDispatchingSupported())
143 // immediate local synchronous dispatching
144 _LocalModuleSkel
->executeCommand(_ModuleProxy
->getModuleGateway()->getPluggedModuleProxy(sender
), cmdline
, originator
);
148 // send the message for remote dispatching and execution or local queing
149 NLNET::CMessage __message
;
151 buildMessageFor_executeCommand(__message
, cmdline
, originator
);
153 _ModuleProxy
->sendModuleMessage(sender
, __message
);
157 // Message serializer. Return the message received in reference for easier integration
158 const NLNET::CMessage
&CServerPatchApplierProxy::buildMessageFor_installVersion(NLNET::CMessage
&__message
, const NLMISC::CSString
&domainName
, uint32 version
)
160 __message
.setType("SPA_SETNEXT");
161 nlWrite(__message
, serial
, const_cast < NLMISC::CSString
& > (domainName
));
162 nlWrite(__message
, serial
, version
);
168 // Message serializer. Return the message received in reference for easier integration
169 const NLNET::CMessage
&CServerPatchApplierProxy::buildMessageFor_launchVersion(NLNET::CMessage
&__message
, const NLMISC::CSString
&domainName
, uint32 version
)
171 __message
.setType("SPA_SETLIVE");
172 nlWrite(__message
, serial
, const_cast < NLMISC::CSString
& > (domainName
));
173 nlWrite(__message
, serial
, version
);
179 // Message serializer. Return the message received in reference for easier integration
180 const NLNET::CMessage
&CServerPatchApplierProxy::buildMessageFor_executeCommand(NLNET::CMessage
&__message
, const NLMISC::CSString
&cmdline
, const NLMISC::CSString
&originator
)
182 __message
.setType("SPA_EXEC");
183 nlWrite(__message
, serial
, const_cast < NLMISC::CSString
& > (cmdline
));
184 nlWrite(__message
, serial
, const_cast < NLMISC::CSString
& > (originator
));