Add infos into target window
[ryzomcore.git] / ryzom / server / src / patchman_service / rr_module_itf.h
blobef2fcbd202bef0a1958e3aa53834a07daf976a2b
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
18 /////////////////////////////////////////////////////////////////
19 // WARNING : this is a generated file, don't change it !
20 /////////////////////////////////////////////////////////////////
22 #ifndef RR_MODULE_ITF_H
23 #define RR_MODULE_ITF_H
24 #include "nel/net/message.h"
25 #include "nel/net/module.h"
26 #include "nel/net/module_message.h"
27 #include "nel/net/module_gateway.h"
28 #include "nel/misc/string_conversion.h"
30 #include "nel/misc/md5.h"
32 //#include "repository.h"
34 #ifndef NLNET_INTERFACE_GET_MODULE
35 # define NLNET_INTERFACE_GET_MODULE NLNET::IModule *getModuleInstance() { return this; }
36 #endif
37 namespace PATCHMAN
40 class TFileRecord;
42 /////////////////////////////////////////////////////////////////
43 // WARNING : this is a generated file, don't change it !
44 /////////////////////////////////////////////////////////////////
45 class TFileRecord
47 private:
48 //
49 std::string _FileName;
50 //
51 NLMISC::CHashKeyMD5 _Checksum;
52 public:
53 //
54 const std::string &getFileName() const
56 return _FileName;
59 std::string &getFileName()
61 return _FileName;
65 void setFileName(const std::string &value)
67 if (_FileName != value)
71 _FileName = value;
76 //
77 const NLMISC::CHashKeyMD5 &getChecksum() const
79 return _Checksum;
82 NLMISC::CHashKeyMD5 &getChecksum()
84 return _Checksum;
88 void setChecksum(const NLMISC::CHashKeyMD5 &value)
90 if (_Checksum != value)
94 _Checksum = value;
100 bool operator == (const TFileRecord &other) const
102 return _FileName == other._FileName
103 && _Checksum == other._Checksum;
107 void serial(NLMISC::IStream &s)
109 s.serial(_FileName);
110 s.serial(_Checksum);
115 private:
122 /////////////////////////////////////////////////////////////////
123 // WARNING : this is a generated file, don't change it !
124 /////////////////////////////////////////////////////////////////
125 class CRepositoryReceiverSkel
127 protected:
128 CRepositoryReceiverSkel()
130 // do early run time check for message table
131 getMessageHandlers();
133 virtual ~CRepositoryReceiverSkel()
139 private:
140 typedef void (CRepositoryReceiverSkel::*TMessageHandler)(NLNET::IModuleProxy *sender, const NLNET::CMessage &message);
141 typedef std::map<std::string, TMessageHandler> TMessageHandlerMap;
144 const TMessageHandlerMap &getMessageHandlers() const
146 static TMessageHandlerMap handlers;
147 static bool init = false;
149 if (!init)
151 std::pair < TMessageHandlerMap::iterator, bool > res;
153 res = handlers.insert(std::make_pair(std::string("RR_LIST"), &CRepositoryReceiverSkel::fileList_skel));
154 // if this assert, you have a doubly message name in your interface definition !
155 nlassert(res.second);
157 res = handlers.insert(std::make_pair(std::string("RR_FILE_BEGIN"), &CRepositoryReceiverSkel::beginFile_skel));
158 // if this assert, you have a doubly message name in your interface definition !
159 nlassert(res.second);
161 res = handlers.insert(std::make_pair(std::string("RR_FILE_DATA"), &CRepositoryReceiverSkel::fileData_skel));
162 // if this assert, you have a doubly message name in your interface definition !
163 nlassert(res.second);
165 res = handlers.insert(std::make_pair(std::string("RR_FILE_END"), &CRepositoryReceiverSkel::fileEnd_skel));
166 // if this assert, you have a doubly message name in your interface definition !
167 nlassert(res.second);
169 init = true;
172 return handlers;
175 protected:
176 bool onDispatchMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message)
178 const TMessageHandlerMap &mh = getMessageHandlers();
180 TMessageHandlerMap::const_iterator it(mh.find(message.getName()));
182 if (it == mh.end())
184 return false;
187 TMessageHandler cmd = it->second;
188 (this->*cmd)(sender, message);
190 return true;
193 private:
195 void fileList_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
197 uint32 version;
198 nlRead(__message, serial, version);
199 TFileInfoVector files;
200 nlRead(__message, serialCont, files);
201 fileList(sender, version, files);
204 void beginFile_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
206 std::string fileName;
207 nlRead(__message, serial, fileName);
208 uint32 fileSize;
209 nlRead(__message, serial, fileSize);
210 beginFile(sender, fileName, fileSize);
213 void fileData_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
215 std::string fileName;
216 nlRead(__message, serial, fileName);
217 std::string data;
218 nlRead(__message, serial, data);
219 fileData(sender, fileName, data);
222 void fileEnd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
224 std::string fileName;
225 nlRead(__message, serial, fileName);
226 fileEnd(sender, fileName);
229 public:
230 /////////////////////////////////////////////////////////////////
231 // WARNING : this is a generated file, don't change it !
232 /////////////////////////////////////////////////////////////////
235 virtual void fileList(NLNET::IModuleProxy *sender, uint32 version, const TFileInfoVector &files) =0;
237 virtual void beginFile(NLNET::IModuleProxy *sender, const std::string &fileName, uint32 fileSize) =0;
239 virtual void fileData(NLNET::IModuleProxy *sender, const std::string &fileName, const std::string &data) =0;
241 virtual void fileEnd(NLNET::IModuleProxy *sender, const std::string &fileName) =0;
246 /////////////////////////////////////////////////////////////////
247 // WARNING : this is a generated file, don't change it !
248 /////////////////////////////////////////////////////////////////
249 class CRepositoryReceiverProxy
251 /// Smart pointer on the module proxy
252 NLNET::TModuleProxyPtr _ModuleProxy;
254 // Pointer on the local module that implement the interface (if the proxy is for a local module)
255 NLNET::TModulePtr _LocalModule;
256 // Direct pointer on the server implementation interface for collocated module
257 CRepositoryReceiverSkel *_LocalModuleSkel;
260 public:
261 CRepositoryReceiverProxy(NLNET::IModuleProxy *proxy)
264 _ModuleProxy = proxy;
266 // initialize collocated servant interface
267 if (proxy->getModuleDistance() == 0)
269 _LocalModule = proxy->getLocalModule();
270 nlassert(_LocalModule != NULL);
271 _LocalModuleSkel = dynamic_cast < CRepositoryReceiverSkel* > (_LocalModule.getPtr());
272 nlassert(_LocalModuleSkel != NULL);
274 else
275 _LocalModuleSkel = 0;
278 virtual ~CRepositoryReceiverProxy()
282 NLNET::IModuleProxy *getModuleProxy()
284 return _ModuleProxy;
288 void fileList(NLNET::IModule *sender, uint32 version, const TFileInfoVector &files)
290 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
292 // immediate local synchronous dispatching
293 _LocalModuleSkel->fileList(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), version, files);
295 else
297 // send the message for remote dispatching and execution or local queing
298 NLNET::CMessage __message;
300 buildMessageFor_fileList(__message, version, files);
302 _ModuleProxy->sendModuleMessage(sender, __message);
306 void beginFile(NLNET::IModule *sender, const std::string &fileName, uint32 fileSize)
308 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
310 // immediate local synchronous dispatching
311 _LocalModuleSkel->beginFile(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), fileName, fileSize);
313 else
315 // send the message for remote dispatching and execution or local queing
316 NLNET::CMessage __message;
318 buildMessageFor_beginFile(__message, fileName, fileSize);
320 _ModuleProxy->sendModuleMessage(sender, __message);
324 void fileData(NLNET::IModule *sender, const std::string &fileName, const std::string &data)
326 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
328 // immediate local synchronous dispatching
329 _LocalModuleSkel->fileData(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), fileName, data);
331 else
333 // send the message for remote dispatching and execution or local queing
334 NLNET::CMessage __message;
336 buildMessageFor_fileData(__message, fileName, data);
338 _ModuleProxy->sendModuleMessage(sender, __message);
342 void fileEnd(NLNET::IModule *sender, const std::string &fileName)
344 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
346 // immediate local synchronous dispatching
347 _LocalModuleSkel->fileEnd(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), fileName);
349 else
351 // send the message for remote dispatching and execution or local queing
352 NLNET::CMessage __message;
354 buildMessageFor_fileEnd(__message, fileName);
356 _ModuleProxy->sendModuleMessage(sender, __message);
360 // Message serializer. Return the message received in reference for easier integration
361 static const NLNET::CMessage &buildMessageFor_fileList(NLNET::CMessage &__message, uint32 version, const TFileInfoVector &files)
363 __message.setType("RR_LIST");
364 nlWrite(__message, serial, version);
365 nlWrite(__message, serialCont, const_cast < TFileInfoVector& > (files));
368 return __message;
371 // Message serializer. Return the message received in reference for easier integration
372 static const NLNET::CMessage &buildMessageFor_beginFile(NLNET::CMessage &__message, const std::string &fileName, uint32 fileSize)
374 __message.setType("RR_FILE_BEGIN");
375 nlWrite(__message, serial, const_cast < std::string& > (fileName));
376 nlWrite(__message, serial, fileSize);
379 return __message;
382 // Message serializer. Return the message received in reference for easier integration
383 static const NLNET::CMessage &buildMessageFor_fileData(NLNET::CMessage &__message, const std::string &fileName, const std::string &data)
385 __message.setType("RR_FILE_DATA");
386 nlWrite(__message, serial, const_cast < std::string& > (fileName));
387 nlWrite(__message, serial, const_cast < std::string& > (data));
390 return __message;
393 // Message serializer. Return the message received in reference for easier integration
394 static const NLNET::CMessage &buildMessageFor_fileEnd(NLNET::CMessage &__message, const std::string &fileName)
396 __message.setType("RR_FILE_END");
397 nlWrite(__message, serial, const_cast < std::string& > (fileName));
400 return __message;
408 /////////////////////////////////////////////////////////////////
409 // WARNING : this is a generated file, don't change it !
410 /////////////////////////////////////////////////////////////////
411 class CFileReceiverSkel
413 protected:
414 CFileReceiverSkel()
416 // do early run time check for message table
417 getMessageHandlers();
419 virtual ~CFileReceiverSkel()
425 private:
426 typedef void (CFileReceiverSkel::*TMessageHandler)(NLNET::IModuleProxy *sender, const NLNET::CMessage &message);
427 typedef std::map<std::string, TMessageHandler> TMessageHandlerMap;
430 const TMessageHandlerMap &getMessageHandlers() const
432 static TMessageHandlerMap handlers;
433 static bool init = false;
435 if (!init)
437 std::pair < TMessageHandlerMap::iterator, bool > res;
439 res = handlers.insert(std::make_pair(std::string("FR_FILE_INFO"), &CFileReceiverSkel::fileInfo_skel));
440 // if this assert, you have a doubly message name in your interface definition !
441 nlassert(res.second);
443 res = handlers.insert(std::make_pair(std::string("FR_FILE_DATA"), &CFileReceiverSkel::fileData_skel));
444 // if this assert, you have a doubly message name in your interface definition !
445 nlassert(res.second);
447 res = handlers.insert(std::make_pair(std::string("FR_FILE_ERR"), &CFileReceiverSkel::fileDataFailure_skel));
448 // if this assert, you have a doubly message name in your interface definition !
449 nlassert(res.second);
451 init = true;
454 return handlers;
457 protected:
458 bool onDispatchMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message)
460 const TMessageHandlerMap &mh = getMessageHandlers();
462 TMessageHandlerMap::const_iterator it(mh.find(message.getName()));
464 if (it == mh.end())
466 return false;
469 TMessageHandler cmd = it->second;
470 (this->*cmd)(sender, message);
472 return true;
475 private:
477 void fileInfo_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
479 TFileInfoVector files;
480 nlRead(__message, serialCont, files);
481 fileInfo(sender, files);
484 void fileData_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
486 std::string fileName;
487 nlRead(__message, serial, fileName);
488 uint32 startOffset;
489 nlRead(__message, serial, startOffset);
490 std::string data;
491 nlRead(__message, serial, data);
492 fileData(sender, fileName, startOffset, data);
495 void fileDataFailure_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message)
497 std::string fileName;
498 nlRead(__message, serial, fileName);
499 fileDataFailure(sender, fileName);
502 public:
503 /////////////////////////////////////////////////////////////////
504 // WARNING : this is a generated file, don't change it !
505 /////////////////////////////////////////////////////////////////
508 virtual void fileInfo(NLNET::IModuleProxy *sender, const TFileInfoVector &files) =0;
510 virtual void fileData(NLNET::IModuleProxy *sender, const std::string &fileName, uint32 startOffset, const std::string &data) =0;
512 virtual void fileDataFailure(NLNET::IModuleProxy *sender, const std::string &fileName) =0;
517 /////////////////////////////////////////////////////////////////
518 // WARNING : this is a generated file, don't change it !
519 /////////////////////////////////////////////////////////////////
520 class CFileReceiverProxy
522 /// Smart pointer on the module proxy
523 NLNET::TModuleProxyPtr _ModuleProxy;
525 // Pointer on the local module that implement the interface (if the proxy is for a local module)
526 NLNET::TModulePtr _LocalModule;
527 // Direct pointer on the server implementation interface for collocated module
528 CFileReceiverSkel *_LocalModuleSkel;
531 public:
532 CFileReceiverProxy(NLNET::IModuleProxy *proxy)
535 _ModuleProxy = proxy;
537 // initialize collocated servant interface
538 if (proxy->getModuleDistance() == 0)
540 _LocalModule = proxy->getLocalModule();
541 nlassert(_LocalModule != NULL);
542 _LocalModuleSkel = dynamic_cast < CFileReceiverSkel* > (_LocalModule.getPtr());
543 nlassert(_LocalModuleSkel != NULL);
545 else
546 _LocalModuleSkel = 0;
549 virtual ~CFileReceiverProxy()
553 NLNET::IModuleProxy *getModuleProxy()
555 return _ModuleProxy;
559 void fileInfo(NLNET::IModule *sender, const TFileInfoVector &files)
561 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
563 // immediate local synchronous dispatching
564 _LocalModuleSkel->fileInfo(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), files);
566 else
568 // send the message for remote dispatching and execution or local queing
569 NLNET::CMessage __message;
571 buildMessageFor_fileInfo(__message, files);
573 _ModuleProxy->sendModuleMessage(sender, __message);
577 void fileData(NLNET::IModule *sender, const std::string &fileName, uint32 startOffset, const std::string &data)
579 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
581 // immediate local synchronous dispatching
582 _LocalModuleSkel->fileData(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), fileName, startOffset, data);
584 else
586 // send the message for remote dispatching and execution or local queing
587 NLNET::CMessage __message;
589 buildMessageFor_fileData(__message, fileName, startOffset, data);
591 _ModuleProxy->sendModuleMessage(sender, __message);
595 void fileDataFailure(NLNET::IModule *sender, const std::string &fileName)
597 if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported())
599 // immediate local synchronous dispatching
600 _LocalModuleSkel->fileDataFailure(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), fileName);
602 else
604 // send the message for remote dispatching and execution or local queing
605 NLNET::CMessage __message;
607 buildMessageFor_fileDataFailure(__message, fileName);
609 _ModuleProxy->sendModuleMessage(sender, __message);
613 // Message serializer. Return the message received in reference for easier integration
614 static const NLNET::CMessage &buildMessageFor_fileInfo(NLNET::CMessage &__message, const TFileInfoVector &files)
616 __message.setType("FR_FILE_INFO");
617 nlWrite(__message, serialCont, const_cast < TFileInfoVector& > (files));
620 return __message;
623 // Message serializer. Return the message received in reference for easier integration
624 static const NLNET::CMessage &buildMessageFor_fileData(NLNET::CMessage &__message, const std::string &fileName, uint32 startOffset, const std::string &data)
626 __message.setType("FR_FILE_DATA");
627 nlWrite(__message, serial, const_cast < std::string& > (fileName));
628 nlWrite(__message, serial, startOffset);
629 nlWrite(__message, serial, const_cast < std::string& > (data));
632 return __message;
635 // Message serializer. Return the message received in reference for easier integration
636 static const NLNET::CMessage &buildMessageFor_fileDataFailure(NLNET::CMessage &__message, const std::string &fileName)
638 __message.setType("FR_FILE_ERR");
639 nlWrite(__message, serial, const_cast < std::string& > (fileName));
642 return __message;
652 #endif