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 "backup_service_itf.h"
28 /////////////////////////////////////////////////////////////////
29 // WARNING : this is a generated file, don't change it !
30 /////////////////////////////////////////////////////////////////
33 const CBackupServiceSkel::TMessageHandlerMap
&CBackupServiceSkel::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("BSSF"), &CBackupServiceSkel::saveFile_skel
));
43 // if this assert, you have a doubly message name in your interface definition !
46 res
= handlers
.insert(std::make_pair(std::string("BSLF"), &CBackupServiceSkel::loadFile_skel
));
47 // if this assert, you have a doubly message name in your interface definition !
55 bool CBackupServiceSkel::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 CBackupServiceSkel::saveFile_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
75 H_AUTO(CBackupServiceSkel_saveFile_BSSF
);
77 nlRead(__message
, serial
, fileName
);
78 NLNET::TBinBuffer data
;
79 nlRead(__message
, serial
, data
);
80 saveFile(sender
, fileName
, data
);
83 void CBackupServiceSkel::loadFile_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
85 H_AUTO(CBackupServiceSkel_loadFile_BSLF
);
87 nlRead(__message
, serial
, fileName
);
89 nlRead(__message
, serial
, requestId
);
90 loadFile(sender
, fileName
, requestId
);
92 // A module ask to save a file in the backup repository
93 void CBackupServiceProxy::saveFile(NLNET::IModule
*sender
, const std::string
&fileName
, const NLNET::TBinBuffer
&data
)
95 if (_LocalModuleSkel
&& _LocalModule
->isImmediateDispatchingSupported())
97 // immediate local synchronous dispatching
98 _LocalModuleSkel
->saveFile(_ModuleProxy
->getModuleGateway()->getPluggedModuleProxy(sender
), fileName
, data
);
102 // send the message for remote dispatching and execution or local queing
103 NLNET::CMessage __message
;
105 buildMessageFor_saveFile(__message
, fileName
, data
);
107 _ModuleProxy
->sendModuleMessage(sender
, __message
);
110 // A module ask to load a file
111 void CBackupServiceProxy::loadFile(NLNET::IModule
*sender
, const std::string
&fileName
, uint32 requestId
)
113 if (_LocalModuleSkel
&& _LocalModule
->isImmediateDispatchingSupported())
115 // immediate local synchronous dispatching
116 _LocalModuleSkel
->loadFile(_ModuleProxy
->getModuleGateway()->getPluggedModuleProxy(sender
), fileName
, requestId
);
120 // send the message for remote dispatching and execution or local queing
121 NLNET::CMessage __message
;
123 buildMessageFor_loadFile(__message
, fileName
, requestId
);
125 _ModuleProxy
->sendModuleMessage(sender
, __message
);
129 // Message serializer. Return the message received in reference for easier integration
130 const NLNET::CMessage
&CBackupServiceProxy::buildMessageFor_saveFile(NLNET::CMessage
&__message
, const std::string
&fileName
, const NLNET::TBinBuffer
&data
)
132 __message
.setType("BSSF");
133 nlWrite(__message
, serial
, const_cast < std::string
& > (fileName
));
134 nlWrite(__message
, serial
, const_cast < NLNET::TBinBuffer
& > (data
));
140 // Message serializer. Return the message received in reference for easier integration
141 const NLNET::CMessage
&CBackupServiceProxy::buildMessageFor_loadFile(NLNET::CMessage
&__message
, const std::string
&fileName
, uint32 requestId
)
143 __message
.setType("BSLF");
144 nlWrite(__message
, serial
, const_cast < std::string
& > (fileName
));
145 nlWrite(__message
, serial
, requestId
);
151 /////////////////////////////////////////////////////////////////
152 // WARNING : this is a generated file, don't change it !
153 /////////////////////////////////////////////////////////////////
156 const CBackupServiceClientSkel::TMessageHandlerMap
&CBackupServiceClientSkel::getMessageHandlers() const
158 static TMessageHandlerMap handlers
;
159 static bool init
= false;
163 std::pair
< TMessageHandlerMap::iterator
, bool > res
;
165 res
= handlers
.insert(std::make_pair(std::string("BSLFR"), &CBackupServiceClientSkel::loadFileResult_skel
));
166 // if this assert, you have a doubly message name in your interface definition !
167 nlassert(res
.second
);
169 res
= handlers
.insert(std::make_pair(std::string("BSFU"), &CBackupServiceClientSkel::fileUpdate_skel
));
170 // if this assert, you have a doubly message name in your interface definition !
171 nlassert(res
.second
);
178 bool CBackupServiceClientSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&message
)
180 const TMessageHandlerMap
&mh
= getMessageHandlers();
182 TMessageHandlerMap::const_iterator
it(mh
.find(message
.getName()));
189 TMessageHandler cmd
= it
->second
;
190 (this->*cmd
)(sender
, message
);
196 void CBackupServiceClientSkel::loadFileResult_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
198 H_AUTO(CBackupServiceClientSkel_loadFileResult_BSLFR
);
200 nlRead(__message
, serial
, requestId
);
201 std::string fileName
;
202 nlRead(__message
, serial
, fileName
);
203 uint32 fileTimeStamp
;
204 nlRead(__message
, serial
, fileTimeStamp
);
205 NLNET::TBinBuffer data
;
206 nlRead(__message
, serial
, data
);
207 loadFileResult(sender
, requestId
, fileName
, fileTimeStamp
, data
);
210 void CBackupServiceClientSkel::fileUpdate_skel(NLNET::IModuleProxy
*sender
, const NLNET::CMessage
&__message
)
212 H_AUTO(CBackupServiceClientSkel_fileUpdate_BSFU
);
213 std::string fileName
;
214 nlRead(__message
, serial
, fileName
);
215 std::vector
< std::string
> content
;
216 nlRead(__message
, serialCont
, content
);
217 fileUpdate(sender
, fileName
, content
);
219 // The BS return for a load file request
220 void CBackupServiceClientProxy::loadFileResult(NLNET::IModule
*sender
, uint32 requestId
, const std::string
&fileName
, uint32 fileTimeStamp
, const NLNET::TBinBuffer
&data
)
222 if (_LocalModuleSkel
&& _LocalModule
->isImmediateDispatchingSupported())
224 // immediate local synchronous dispatching
225 _LocalModuleSkel
->loadFileResult(_ModuleProxy
->getModuleGateway()->getPluggedModuleProxy(sender
), requestId
, fileName
, fileTimeStamp
, data
);
229 // send the message for remote dispatching and execution or local queing
230 NLNET::CMessage __message
;
232 buildMessageFor_loadFileResult(__message
, requestId
, fileName
, fileTimeStamp
, data
);
234 _ModuleProxy
->sendModuleMessage(sender
, __message
);
237 // A file listened by the client have been changed, BS resend the file content
238 void CBackupServiceClientProxy::fileUpdate(NLNET::IModule
*sender
, const std::string
&fileName
, const std::vector
< std::string
> &content
)
240 if (_LocalModuleSkel
&& _LocalModule
->isImmediateDispatchingSupported())
242 // immediate local synchronous dispatching
243 _LocalModuleSkel
->fileUpdate(_ModuleProxy
->getModuleGateway()->getPluggedModuleProxy(sender
), fileName
, content
);
247 // send the message for remote dispatching and execution or local queing
248 NLNET::CMessage __message
;
250 buildMessageFor_fileUpdate(__message
, fileName
, content
);
252 _ModuleProxy
->sendModuleMessage(sender
, __message
);
256 // Message serializer. Return the message received in reference for easier integration
257 const NLNET::CMessage
&CBackupServiceClientProxy::buildMessageFor_loadFileResult(NLNET::CMessage
&__message
, uint32 requestId
, const std::string
&fileName
, uint32 fileTimeStamp
, const NLNET::TBinBuffer
&data
)
259 __message
.setType("BSLFR");
260 nlWrite(__message
, serial
, requestId
);
261 nlWrite(__message
, serial
, const_cast < std::string
& > (fileName
));
262 nlWrite(__message
, serial
, fileTimeStamp
);
263 nlWrite(__message
, serial
, const_cast < NLNET::TBinBuffer
& > (data
));
269 // Message serializer. Return the message received in reference for easier integration
270 const NLNET::CMessage
&CBackupServiceClientProxy::buildMessageFor_fileUpdate(NLNET::CMessage
&__message
, const std::string
&fileName
, const std::vector
< std::string
> &content
)
272 __message
.setType("BSFU");
273 nlWrite(__message
, serial
, const_cast < std::string
& > (fileName
));
274 nlWrite(__message
, serialCont
, const_cast < std::vector
< std::string
>& > (content
));