Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / server / src / patchman_service / re_module_itf.h
blobfcd3229d8a976b553831f4341f5be770ec8e3dda
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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 #error deprecated
19 /////////////////////////////////////////////////////////////////
20 // WARNING : this is a generated file, don't change it !
21 /////////////////////////////////////////////////////////////////
23 #ifndef RE_MODULE_ITF_H
24 #define RE_MODULE_ITF_H
25 #include "nel/net/message.h"
26 #include "nel/net/module.h"
27 #include "nel/net/module_message.h"
28 #include "nel/net/module_gateway.h"
29 #include "nel/misc/string_conversion.h"
31 #ifndef NLNET_INTERFACE_GET_MODULE
32 # define NLNET_INTERFACE_GET_MODULE NLNET::IModule *getModuleInstance() { return this; }
33 #endif
34 namespace PATCHMAN
38 /////////////////////////////////////////////////////////////////
39 // WARNING : this is a generated file, don't change it !
40 /////////////////////////////////////////////////////////////////
41 class CRepositoryEmitterSkel
43 protected:
44 CRepositoryEmitterSkel()
46 // do early run time check for message table
47 getMessageHandlers();
49 virtual ~CRepositoryEmitterSkel()
55 private:
56 typedef void (CRepositoryEmitterSkel::*TMessageHandler)(NLNET::IModuleProxy *sender, const NLNET::CMessage &message);
57 typedef std::map<std::string, TMessageHandler> TMessageHandlerMap;
60 const TMessageHandlerMap &getMessageHandlers() const
62 static TMessageHandlerMap handlers;
63 static bool init = false;
65 if (!init)
67 std::pair < TMessageHandlerMap::iterator, bool > res;
69 res = handlers.insert(std::make_pair(std::string("RE_REQUEST"), &CRepositoryEmitterSkel::requestFile_skel));
70 // if this assert, you have a doubly message name in your interface definition !
71 nlassert(res.second);
73 res = handlers.insert(std::make_pair(std::string("RE_DATA_ACK"), &CRepositoryEmitterSkel::fileDataAck_skel));
74 // if this assert, you have a doubly message name in your interface definition !
75 nlassert(res.second);
77 res = handlers.insert(std::make_pair(std::string("RE_ERR_DUPMOD"), &CRepositoryEmitterSkel::duplicateModuleError_skel));
78 // if this assert, you have a doubly message name in your interface definition !
79 nlassert(res.second);
81 init = true;
84 return handlers;
87 protected:
88 bool onDispatchMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message)
90 const TMessageHandlerMap &mh = getMessageHandlers();
92 TMessageHandlerMap::const_iterator it(mh.find(message.getName()));
94 if (it == mh.end())
96 return false;
99 TMessageHandler cmd = it->second;
100 (this->*cmd)(sender, message);
102 return true;
105 private:
107 void requestFile_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
109 std::string fileName;
110 nlRead(__message, serial, fileName);
111 requestFile(sender, fileName);
114 void fileDataAck_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
116 std::string fileName;
117 nlRead(__message, serial, fileName);
118 bool status;
119 nlRead(__message, serial, status);
120 fileDataAck(sender, fileName, status);
123 void duplicateModuleError_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
125 duplicateModuleError(sender);
128 public:
129 /////////////////////////////////////////////////////////////////
130 // WARNING : this is a generated file, don't change it !
131 /////////////////////////////////////////////////////////////////
134 virtual void requestFile(NLNET::IModuleProxy *sender, const std::string &fileName) =0;
136 virtual void fileDataAck(NLNET::IModuleProxy *sender, const std::string &fileName, bool status) =0;
138 virtual void duplicateModuleError(NLNET::IModuleProxy *sender) =0;
143 /////////////////////////////////////////////////////////////////
144 // WARNING : this is a generated file, don't change it !
145 /////////////////////////////////////////////////////////////////
146 class CRepositoryEmitterProxy
148 /// Smart pointer on the module proxy
149 NLNET::TModuleProxyPtr _ModuleProxy;
151 // Pointer on the local module that implement the interface (if the proxy is for a local module)
152 NLNET::TModulePtr _LocalModule;
153 // Direct pointer on the server implementation interface for collocated module
154 CRepositoryEmitterSkel *_LocalModuleSkel;
157 public:
158 CRepositoryEmitterProxy(NLNET::IModuleProxy *proxy)
161 _ModuleProxy = proxy;
163 // initialize collocated servant interface
164 if (proxy->getModuleDistance() == 0)
166 _LocalModule = proxy->getLocalModule();
167 nlassert(_LocalModule != NULL);
168 _LocalModuleSkel = dynamic_cast < CRepositoryEmitterSkel* > (_LocalModule.getPtr());
169 nlassert(_LocalModuleSkel != NULL);
171 else
172 _LocalModuleSkel = 0;
175 virtual ~CRepositoryEmitterProxy()
179 NLNET::IModuleProxy *getModuleProxy()
181 return _ModuleProxy;
185 void requestFile(NLNET::IModule *sender, const std::string &fileName)
187 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
189 // immediate local synchronous dispatching
190 _LocalModuleSkel->requestFile(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), fileName);
192 else
194 // send the message for remote dispatching and execution or local queing
195 NLNET::CMessage __message;
197 buildMessageFor_requestFile(__message, fileName);
199 _ModuleProxy->sendModuleMessage(sender, __message);
203 void fileDataAck(NLNET::IModule *sender, const std::string &fileName, bool status)
205 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
207 // immediate local synchronous dispatching
208 _LocalModuleSkel->fileDataAck(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), fileName, status);
210 else
212 // send the message for remote dispatching and execution or local queing
213 NLNET::CMessage __message;
215 buildMessageFor_fileDataAck(__message, fileName, status);
217 _ModuleProxy->sendModuleMessage(sender, __message);
221 void duplicateModuleError(NLNET::IModule *sender)
223 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
225 // immediate local synchronous dispatching
226 _LocalModuleSkel->duplicateModuleError(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender));
228 else
230 // send the message for remote dispatching and execution or local queing
231 NLNET::CMessage __message;
233 buildMessageFor_duplicateModuleError(__message);
235 _ModuleProxy->sendModuleMessage(sender, __message);
239 // Message serializer. Return the message received in reference for easier integration
240 static const NLNET::CMessage &buildMessageFor_requestFile(NLNET::CMessage &__message, const std::string &fileName)
242 __message.setType("RE_REQUEST");
243 nlWrite(__message, serial, const_cast < std::string& > (fileName));
246 return __message;
249 // Message serializer. Return the message received in reference for easier integration
250 static const NLNET::CMessage &buildMessageFor_fileDataAck(NLNET::CMessage &__message, const std::string &fileName, bool status)
252 __message.setType("RE_DATA_ACK");
253 nlWrite(__message, serial, const_cast < std::string& > (fileName));
254 nlWrite(__message, serial, status);
257 return __message;
260 // Message serializer. Return the message received in reference for easier integration
261 static const NLNET::CMessage &buildMessageFor_duplicateModuleError(NLNET::CMessage &__message)
263 __message.setType("RE_ERR_DUPMOD");
266 return __message;
276 #endif