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/>.
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; }
42 /////////////////////////////////////////////////////////////////
43 // WARNING : this is a generated file, don't change it !
44 /////////////////////////////////////////////////////////////////
49 std::string _FileName
;
51 NLMISC::CHashKeyMD5 _Checksum
;
54 const std::string
&getFileName() const
59 std::string
&getFileName()
65 void setFileName(const std::string
&value
)
67 if (_FileName
!= value
)
77 const NLMISC::CHashKeyMD5
&getChecksum() const
82 NLMISC::CHashKeyMD5
&getChecksum()
88 void setChecksum(const NLMISC::CHashKeyMD5
&value
)
90 if (_Checksum
!= value
)
100 bool operator == (const TFileRecord
&other
) const
102 return _FileName
== other
._FileName
103 && _Checksum
== other
._Checksum
;
107 void serial(NLMISC::IStream
&s
)
122 /////////////////////////////////////////////////////////////////
123 // WARNING : this is a generated file, don't change it !
124 /////////////////////////////////////////////////////////////////
125 class CRepositoryReceiverSkel
128 CRepositoryReceiverSkel()
130 // do early run time check for message table
131 getMessageHandlers();
133 virtual ~CRepositoryReceiverSkel()
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;
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
);
176 bool onDispatchMessage(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&message
)
178 const TMessageHandlerMap
&mh
= getMessageHandlers();
180 TMessageHandlerMap::const_iterator
it(mh
.find(message
.getName()));
187 TMessageHandler cmd
= it
->second
;
188 (this->*cmd
)(sender
, message
);
195 void fileList_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
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
);
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
);
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
);
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
;
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
);
275 _LocalModuleSkel
= 0;
278 virtual ~CRepositoryReceiverProxy()
282 NLNET::IModuleProxy
*getModuleProxy()
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
);
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
);
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
);
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
);
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
));
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
);
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
));
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
));
408 /////////////////////////////////////////////////////////////////
409 // WARNING : this is a generated file, don't change it !
410 /////////////////////////////////////////////////////////////////
411 class CFileReceiverSkel
416 // do early run time check for message table
417 getMessageHandlers();
419 virtual ~CFileReceiverSkel()
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;
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
);
458 bool onDispatchMessage(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&message
)
460 const TMessageHandlerMap
&mh
= getMessageHandlers();
462 TMessageHandlerMap::const_iterator
it(mh
.find(message
.getName()));
469 TMessageHandler cmd
= it
->second
;
470 (this->*cmd
)(sender
, message
);
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
);
489 nlRead(__message
, serial
, startOffset
);
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
);
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
;
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
);
546 _LocalModuleSkel
= 0;
549 virtual ~CFileReceiverProxy()
553 NLNET::IModuleProxy
*getModuleProxy()
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
);
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
);
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
);
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
));
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
));
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
));