[Orxonox-commit 103] r2798 - branches/gui/src/network/synchronisable
rgrieder at orxonox.net
rgrieder at orxonox.net
Wed Mar 18 21:00:48 CET 2009
Author: rgrieder
Date: 2009-03-18 20:00:48 +0000 (Wed, 18 Mar 2009)
New Revision: 2798
Modified:
branches/gui/src/network/synchronisable/SynchronisableVariable.cc
branches/gui/src/network/synchronisable/SynchronisableVariable.h
Log:
Added static function to SynchronisableVariableBase to avoid including Core.h in SynchronisableVariable.h
Modified: branches/gui/src/network/synchronisable/SynchronisableVariable.cc
===================================================================
--- branches/gui/src/network/synchronisable/SynchronisableVariable.cc 2009-03-17 21:53:53 UTC (rev 2797)
+++ branches/gui/src/network/synchronisable/SynchronisableVariable.cc 2009-03-18 20:00:48 UTC (rev 2798)
@@ -29,12 +29,20 @@
#include "SynchronisableVariable.h"
#include <cstring>
#include "util/Math.h"
+#include "core/Core.h"
namespace orxonox{
uint8_t SynchronisableVariableBase::state_ = 0;
+/*static*/ void SynchronisableVariableBase::setState()
+{
+ if ( state_ == 0x0 )
+ {
+ state_ = Core::isMaster() ? 0x1 : 0x2; // set the appropriate mode here
+ }
+}
// =================== Template specialisation stuff =============
Modified: branches/gui/src/network/synchronisable/SynchronisableVariable.h
===================================================================
--- branches/gui/src/network/synchronisable/SynchronisableVariable.h 2009-03-17 21:53:53 UTC (rev 2797)
+++ branches/gui/src/network/synchronisable/SynchronisableVariable.h 2009-03-18 20:00:48 UTC (rev 2798)
@@ -34,7 +34,6 @@
#include <string>
#include <cassert>
-#include "core/Core.h"
#include "core/CoreIncludes.h"
#include "network/synchronisable/NetworkCallback.h"
#include "network/synchronisable/NetworkCallbackManager.h"
@@ -62,6 +61,7 @@
virtual uint8_t getMode()=0;
virtual ~SynchronisableVariableBase() {}
protected:
+ static void setState();
static uint8_t state_;
};
@@ -109,10 +109,7 @@
template <class T> SynchronisableVariable<T>::SynchronisableVariable(T& variable, uint8_t syncDirection, NetworkCallbackBase *cb):
variable_( variable ), mode_( syncDirection ), callback_( cb )
{
- if ( state_ == 0x0 )
- {
- state_ = Core::isMaster() ? 0x1 : 0x2; // set the appropriate mode here
- }
+ setState();
}
template <class T> SynchronisableVariable<T>::~SynchronisableVariable()
More information about the Orxonox-commit
mailing list