30 #ifndef _SynchronisableVariable_H__ 31 #define _SynchronisableVariable_H__ 45 namespace VariableDirection{
51 namespace Bidirectionality{
61 virtual uint32_t getData(uint8_t*& mem, uint8_t mode)=0;
62 virtual void putData(uint8_t*& mem, uint8_t mode,
bool forceCallback =
false)=0;
63 virtual uint32_t getSize(uint8_t mode)=0;
64 virtual void* getReference()=0;
65 virtual uint8_t getMode()=0;
76 virtual inline uint8_t
getMode()
override{
return mode_; }
77 virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode)
override;
78 virtual inline void putData(uint8_t*& mem, uint8_t mode,
bool forceCallback =
false)
override;
79 virtual inline uint32_t getSize(uint8_t mode)
override;
94 virtual inline uint8_t
getMode(){
return 0x3; }
95 virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode);
96 virtual void putData(uint8_t*& mem, uint8_t mode,
bool forceCallback =
false);
97 virtual inline uint32_t getSize(uint8_t mode);
106 variable_( variable ), mode_( syncDirection ), callback_( cb )
121 if ( mode == this->
mode_ )
132 assert ( mode == 0x1 || mode == 0x2 );
133 bool callback =
false;
134 if ( mode == this->
mode_ )
152 if ( mode == this->
mode_ )
174 if ( this->
mode_ == mode )
192 bool callback =
false;
193 if ( this->
mode_ == mode )
220 if (*static_cast<uint8_t*>(mem) == this->
varReference_ && !forceCallback)
T & variable_
Definition: SynchronisableVariable.h:82
Definition: SynchronisableVariable.h:58
Shared library macros, enums, constants and forward declarations for the network library ...
static void triggerCallback(NetworkCallbackBase *cb)
Definition: NetworkCallbackManager.cc:51
NetworkCallbackBase * callback_
Definition: SynchronisableVariable.h:84
virtual uint8_t getMode() override
Definition: SynchronisableVariable.h:76
bool checkEquality(T *&variable, uint8_t *mem)
checks whether the objectID of the variable is the same as in the bytestream
Definition: Serialise.h:72
uint32_t returnSize(T *&variable)
returns the size of the objectID needed to synchronise the pointer
Definition: Serialise.h:49
virtual void * getReference() override
Definition: SynchronisableVariable.h:80
SynchronisableVariable(T &variable, uint8_t syncDirection=VariableDirection::ToClient, NetworkCallbackBase *cb=nullptr)
Definition: SynchronisableVariable.h:105
virtual uint32_t getData(uint8_t *&mem, uint8_t mode) override
Definition: SynchronisableVariable.h:119
Definition: SynchronisableVariable.h:47
Definition: NetworkPrereqs.h:177
uint8_t varReference_
Definition: SynchronisableVariable.h:100
uint8_t mode_
Definition: SynchronisableVariable.h:83
virtual uint8_t getMode()
Definition: SynchronisableVariable.h:94
Functions to serialise pointers to objects that inherit from Synchronisable.
virtual ~SynchronisableVariableBase()
Definition: SynchronisableVariable.h:66
Definition: SynchronisableVariable.h:48
T varBuffer_
Definition: SynchronisableVariable.h:99
SynchronisableVariableBidirectional(T &variable, uint8_t master=Bidirectionality::ServerMaster, NetworkCallbackBase *cb=nullptr)
Definition: SynchronisableVariable.h:163
Definition: SynchronisableVariable.h:53
UnVolatile< typename UnConst< T >::Result >::Result UnqualifiedType
Definition: TypeTraits.h:256
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _NetworkExport
Definition: NetworkPrereqs.h:59
virtual void putData(uint8_t *&mem, uint8_t mode, bool forceCallback=false)
Definition: SynchronisableVariable.h:190
void saveAndIncrease(T *&variable, uint8_t *&mem)
saves the objectID of a pointer into the bytestream and increases the mem pointer ...
Definition: Serialise.h:62
Declaration of the GameMode class which stores and returns the current mode of the game...
Value
Definition: SynchronisableVariable.h:46
Definition: InputPrereqs.h:78
static void deleteCallback(NetworkCallbackBase *cb)
Definition: NetworkCallbackManager.cc:41
virtual uint32_t getSize(uint8_t mode) override
Definition: SynchronisableVariable.h:150
virtual ~SynchronisableVariable()
Definition: SynchronisableVariable.h:110
Definition: NetworkPrereqs.h:174
Definition: SynchronisableVariable.h:54
Value
Definition: SynchronisableVariable.h:52
virtual ~SynchronisableVariableBidirectional()
Definition: SynchronisableVariable.h:168
virtual uint32_t getData(uint8_t *&mem, uint8_t mode)
Definition: SynchronisableVariable.h:172
Definition: NetworkCallback.h:41
virtual void putData(uint8_t *&mem, uint8_t mode, bool forceCallback=false) override
Definition: SynchronisableVariable.h:130
void loadAndIncrease(T *&variable, uint8_t *&mem)
reads the objectID of a pointer out of the bytestream and increases the mem pointer ...
Definition: Serialise.h:55
virtual uint32_t getSize(uint8_t mode)
Definition: SynchronisableVariable.h:246