Add infos into target window
[ryzomcore.git] / ryzom / server / src / patchman_service / deployment_configuration_synchroniser.cpp
blobf3c35dfe8a55ed42e32288646530a51d9a673d26
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 //-----------------------------------------------------------------------------
18 // includes
19 //-----------------------------------------------------------------------------
21 // nel
22 #include "nel/misc/mem_stream.h"
24 // game share
25 #include "game_share/utils.h"
26 #include "game_share/deployment_configuration.h"
28 // local
29 #include "deployment_configuration_synchroniser.h"
32 //-------------------------------------------------------------------------------------------------
33 // namespaces
34 //-------------------------------------------------------------------------------------------------
36 using namespace std;
37 using namespace NLMISC;
38 using namespace NLNET;
39 using namespace PATCHMAN;
40 using namespace DEPCFG;
43 //-----------------------------------------------------------------------------
44 // methods CDeploymentConfigurationSynchroniser
45 //-----------------------------------------------------------------------------
47 void CDeploymentConfigurationSynchroniser::requestSync(NLNET::IModuleProxy *sender)
49 // make sure we're initialised
50 nlassert(_Parent!=NULL);
52 // bundle the CDeploymentConfiguration singleton into a data blob
53 CMemStream blob;
54 blob.serial(CDeploymentConfiguration::getInstance());
56 // get a proxy for the other guy and send them the message
57 CDeploymentConfigurationSynchroniserProxy other(sender);
58 other.sync(_Parent,NLNET::TBinBuffer(blob.buffer(),blob.size()));
61 void CDeploymentConfigurationSynchroniser::sync(NLNET::IModuleProxy *sender, const NLNET::TBinBuffer &dataBlob)
63 // make sure we're initialised
64 nlassert(_Parent!=NULL);
66 // rebuild our CDeploymentConfiguration singleton from the data blob
67 NLMISC::CMemStream blob;
68 blob.fill(dataBlob.getBuffer(),dataBlob.getBufferSize());
69 blob.invert();
70 blob.serial(CDeploymentConfiguration::getInstance());
72 // call the derived class' callback method (if there is one)
73 cbDeploymentConfigurationSynchronised(sender);
76 CDeploymentConfigurationSynchroniser::CDeploymentConfigurationSynchroniser()
77 : _Parent(NULL)
81 void CDeploymentConfigurationSynchroniser::init(NLNET::IModule* parent)
83 // make sure we're NOT initialising more than once
84 nlassert(_Parent==NULL);
86 CDeploymentConfigurationSynchroniserSkel::init(parent);
88 _Parent= parent;