Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2009, 9:20:57 PM (16 years ago)
Author:
landauf
Message:

merged netp3 branch back to trunk

Location:
code/trunk
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/network/synchronisable/NetworkCallbackManager.cc

    r2662 r3084  
    3232
    3333namespace orxonox{
    34 
     34 
    3535  std::set<NetworkCallbackBase*> NetworkCallbackManager::callbackSet_;
    3636  std::queue<NetworkCallbackBase*> NetworkCallbackManager::triggeredCallbacks_;
     
    6060    while( triggeredCallbacks_.empty()==false )
    6161    {
    62       triggeredCallbacks_.front()->call();
     62      //make sure callback hasn't been deleted before
     63      if ( callbackSet_.find(triggeredCallbacks_.front()) != callbackSet_.end() )
     64        triggeredCallbacks_.front()->call();
    6365      triggeredCallbacks_.pop();
    6466    }
  • code/trunk/src/network/synchronisable/Synchronisable.cc

    r3068 r3084  
    6666      objectID=OBJECTID_UNKNOWN;
    6767    classID = static_cast<uint32_t>(-1);
    68 
     68   
     69    // set dataSize to 0
     70    this->dataSize_ = 0;
    6971    // set standard priority
    7072    this->setPriority( priority::normal );
     
    9698    // delete callback function objects
    9799    if(!Identifier::isCreatingHierarchy()){
    98       for(std::list<SynchronisableVariableBase*>::iterator it = syncList.begin(); it!=syncList.end(); it++)
     100      for(std::vector<SynchronisableVariableBase*>::iterator it = syncList.begin(); it!=syncList.end(); it++)
    99101        delete (*it);
    100102      if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer()))
     
    236238   * @return true: if !doSync or if everything was successfully saved
    237239   */
    238   bool Synchronisable::getData(uint8_t*& mem, int32_t id, uint8_t mode){
     240  uint32_t Synchronisable::getData(uint8_t*& mem, int32_t id, uint8_t mode){
    239241    if(mode==0x0)
    240242      mode=state_;
    241243    //if this tick is we dont synchronise, then abort now
    242244    if(!doSync(id, mode))
    243       return true;
     245      return 0;
    244246    uint32_t tempsize = 0;
    245247    if (this->classID==0)
     
    250252
    251253    assert(this->classID==this->getIdentifier()->getNetworkID());
    252     std::list<SynchronisableVariableBase*>::iterator i;
    253     uint32_t size;
    254     size=getSize(id, mode);
     254    std::vector<SynchronisableVariableBase*>::iterator i;
    255255
    256256    // start copy header
    257257    SynchronisableHeader header(mem);
    258     header.setDataSize( size );
     258    mem += SynchronisableHeader::getSize();
     259    // end copy header
     260
     261
     262    COUT(5) << "Synchronisable getting data from objectID: " << objectID << " classID: " << classID << std::endl;
     263    // copy to location
     264    for(i=syncList.begin(); i!=syncList.end(); ++i){
     265      tempsize += (*i)->getData( mem, mode );
     266      //tempsize += (*i)->getSize( mode );
     267    }
     268   
     269    tempsize += SynchronisableHeader::getSize();
    259270    header.setObjectID( this->objectID );
    260271    header.setCreatorID( this->creatorID );
    261272    header.setClassID( this->classID );
    262273    header.setDataAvailable( true );
    263     tempsize += SynchronisableHeader::getSize();
    264     mem += SynchronisableHeader::getSize();
    265     // end copy header
    266 
    267 
    268     COUT(5) << "Synchronisable getting data from objectID: " << objectID << " classID: " << classID << " length: " << size << std::endl;
    269     // copy to location
    270     for(i=syncList.begin(); i!=syncList.end(); ++i){
    271       (*i)->getData( mem, mode );
    272       tempsize += (*i)->getSize( mode );
    273     }
     274    header.setDataSize( tempsize );
     275   
     276#ifndef NDEBUG
     277    uint32_t size;
     278    size=getSize(id, mode);
    274279    assert(tempsize==size);
    275     return true;
     280#endif
     281    return tempsize;
    276282  }
    277283
     
    286292    if(mode==0x0)
    287293      mode=state_;
    288     std::list<SynchronisableVariableBase *>::iterator i;
     294    std::vector<SynchronisableVariableBase *>::iterator i;
    289295    if(syncList.empty()){
    290296      assert(0);
     
    325331  uint32_t Synchronisable::getSize(int32_t id, uint8_t mode){
    326332    int tsize=SynchronisableHeader::getSize();
    327     if(mode==0x0)
     333    if (mode==0x0)
    328334      mode=state_;
    329     if(!doSync(id, mode))
     335    if (!doSync(id, mode))
    330336      return 0;
    331     std::list<SynchronisableVariableBase*>::iterator i;
    332     for(i=syncList.begin(); i!=syncList.end(); i++){
     337    assert( mode==state_ );
     338    tsize += this->dataSize_;
     339    std::vector<SynchronisableVariableBase*>::iterator i;
     340    for(i=stringList.begin(); i!=stringList.end(); ++i){
    333341      tsize += (*i)->getSize( mode );
    334342    }
  • code/trunk/src/network/synchronisable/Synchronisable.h

    r3068 r3084  
    3333
    3434#include <list>
     35#include <vector>
    3536#include <map>
    3637#include <queue>
    3738#include <cassert>
     39#include <string>
    3840#include "util/Math.h"
    3941#include "util/mbool.h"
     
    120122  public:
    121123    friend class packet::Gamestate;
    122 //     friend class Server;
    123124    virtual ~Synchronisable();
    124125
     
    139140    Synchronisable(BaseObject* creator);
    140141    template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
    141     template <class T> void unregisterVariable(T& var);
     142    //template <class T> void unregisterVariable(T& var);
    142143    void setObjectMode(uint8_t mode);
    143144    void setPriority(unsigned int freq){ objectFrequency_ = freq; }
     
    145146
    146147  private:
    147     bool getData(uint8_t*& men, int32_t id, uint8_t mode=0x0);
     148    uint32_t getData(uint8_t*& men, int32_t id, uint8_t mode=0x0);
    148149    uint32_t getSize(int32_t id, uint8_t mode=0x0);
    149150    bool updateData(uint8_t*& mem, uint8_t mode=0x0, bool forceCallback=false);
     
    155156    uint32_t classID;
    156157
    157     std::list<SynchronisableVariableBase*> syncList;
     158    std::vector<SynchronisableVariableBase*> syncList;
     159    std::vector<SynchronisableVariableBase*> stringList;
     160    uint32_t dataSize_; //size of all variables except strings
    158161    static uint8_t state_; // detemines wheter we are server (default) or client
    159162    bool backsync_; // if true the variables with mode > 1 will be synchronised to server (client -> server)
     
    164167  };
    165168
    166   template <class T> void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
    167   {
    168     if (bidirectional)
    169       syncList.push_back(new SynchronisableVariableBidirectional<const T>(variable, mode, cb));
    170     else
    171       syncList.push_back(new SynchronisableVariable<const T>(variable, mode, cb));
    172   }
    173 
    174   template <class T> void Synchronisable::unregisterVariable(T& var){
    175     std::list<SynchronisableVariableBase*>::iterator it = syncList.begin();
    176     while(it!=syncList.end()){
    177       if( ((*it)->getReference()) == &var ){
    178         delete (*it);
    179         syncList.erase(it);
    180         return;
    181       }
    182       else
    183         it++;
    184     }
    185     bool unregistered_nonexistent_variable = false;
    186     assert(unregistered_nonexistent_variable); //if we reach this point something went wrong:
    187     // the variable has not been registered before
    188   }
    189 
    190169  // ================= Specialisation declarations
     170 
     171//   template <> _NetworkExport void Synchronisable::registerVariable( const std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional);
     172  template <> _NetworkExport void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional);
    191173  template <> _NetworkExport void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
    192174  template <> _NetworkExport void Synchronisable::registerVariable( ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
     
    200182  template <> _NetworkExport void Synchronisable::registerVariable( const Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
    201183  template <> _NetworkExport void Synchronisable::registerVariable( Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
     184 
     185  template <class T> void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
     186  {
     187    if (bidirectional)
     188    {
     189      syncList.push_back(new SynchronisableVariableBidirectional<const T>(variable, mode, cb));
     190      this->dataSize_ += syncList.back()->getSize(state_);
     191    }
     192    else
     193    {
     194      syncList.push_back(new SynchronisableVariable<const T>(variable, mode, cb));
     195      if ( this->state_ == mode )
     196        this->dataSize_ += syncList.back()->getSize(state_);
     197    }
     198  }
     199 
     200
     201
     202//   template <class T> void Synchronisable::unregisterVariable(T& var){
     203//     std::vector<SynchronisableVariableBase*>::iterator it = syncList.begin();
     204//     while(it!=syncList.end()){
     205//       if( ((*it)->getReference()) == &var ){
     206//         delete (*it);
     207//         syncList.erase(it);
     208//         return;
     209//       }
     210//       else
     211//         it++;
     212//     }
     213//     bool unregistered_nonexistent_variable = false;
     214//     assert(unregistered_nonexistent_variable); //if we reach this point something went wrong:
     215//     // the variable has not been registered before
     216//   }
     217
     218 
    202219}
    203220
  • code/trunk/src/network/synchronisable/SynchronisableSpecialisations.cc

    r2662 r3084  
    2929
    3030#include "network/synchronisable/Synchronisable.h"
     31#include <string>
    3132
    3233// ================ template spezialisation
     
    3435 
    3536namespace orxonox{
     37 
     38//   template <> void Synchronisable::registerVariable( const std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
     39//   {
     40//     if (bidirectional)
     41//       syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb));
     42//     else
     43//       syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb));
     44//     stringList.push_back(syncList.back());
     45//   }
     46 
     47  template <> void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
     48  {
     49    if (bidirectional)
     50      syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb));
     51    else
     52      syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb));
     53    stringList.push_back(syncList.back());
     54  }
    3655 
    3756  template <> void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
     
    5271    registerVariable(variable.y, mode, cb, bidirectional);
    5372  }
    54   template <> void Synchronisable::registerVariable( Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
    55   {
    56     registerVariable( (const ColourValue&)variable, mode, cb, bidirectional);
    57   }
     73//   template <> void Synchronisable::registerVariable( Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
     74//   {
     75//     registerVariable( (const ColourValue&)variable, mode, cb, bidirectional);
     76//   }
    5877 
    5978  template <> void Synchronisable::registerVariable( const Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
  • code/trunk/src/network/synchronisable/SynchronisableVariable.cc

    • Property svn:eol-style set to native
  • code/trunk/src/network/synchronisable/SynchronisableVariable.h

    r2896 r3084  
    2121 *
    2222 *   Author:
    23  *      Oliver Scheuss, (C) 2008
     23 *      Oliver Scheuss
    2424 *   Co-authors:
    2525 *      ...
     
    3535#include <string>
    3636#include <cassert>
    37 #include "util/Math.h"
     37#include "util/Serialise.h"
     38#include "core/Core.h"
     39#include "core/CoreIncludes.h"
     40#include "core/GameMode.h"
    3841#include "network/synchronisable/NetworkCallback.h"
    3942#include "network/synchronisable/NetworkCallbackManager.h"
     
    5558  {
    5659    public:
    57       virtual void getData(uint8_t*& mem, uint8_t mode)=0;
     60      virtual uint32_t getData(uint8_t*& mem, uint8_t mode)=0;
    5861      virtual void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false)=0;
    5962      virtual uint32_t getSize(uint8_t mode)=0;
     
    6265      virtual ~SynchronisableVariableBase() {}
    6366    protected:
    64       static void setState();
    6567      static uint8_t state_;
    6668  };
     
    7476
    7577      virtual inline uint8_t getMode(){ return mode_; }
    76       virtual inline void getData(uint8_t*& mem, uint8_t mode);
     78      virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode);
    7779      virtual inline void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false);
    7880      virtual inline uint32_t getSize(uint8_t mode);
    7981      virtual inline void* getReference(){ return (void *)&this->variable_; }
    8082    protected:
    81       bool checkEquality(uint8_t* mem);
    82       void setAndIncrease(uint8_t*& mem);
    83       void getAndIncrease(uint8_t*& mem);
    84       uint32_t returnSize();
    8583     
    8684      T& variable_;
     
    9795     
    9896      virtual inline uint8_t getMode(){ return 0x3; } //this basically is a hack ^^
    99       virtual void getData(uint8_t*& mem, uint8_t mode);
     97      virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode);
    10098      virtual void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false);
    101       virtual uint32_t getSize(uint8_t mode);
     99      virtual inline uint32_t getSize(uint8_t mode);
    102100    private:
    103101      T varBuffer_;
     
    110108      variable_( variable ), mode_( syncDirection ), callback_( cb )
    111109  {
    112       setState();
     110    if ( state_ == 0x0 )
     111    {
     112      state_ = GameMode::isMaster() ? 0x1 : 0x2;  // set the appropriate mode here
     113    }
    113114  }
    114115 
     
    119120  }
    120121
    121   template <class T> void SynchronisableVariable<T>::getData(uint8_t*& mem, uint8_t mode)
     122  template <class T> inline uint32_t SynchronisableVariable<T>::getData(uint8_t*& mem, uint8_t mode)
    122123  {
    123124    if ( state_ == this->mode_ )
    124       getAndIncrease( mem );
    125 //   mem += SynchronisableVariable<T>::getSize();
     125    {
     126      saveAndIncrease( this->variable_, mem );
     127      return returnSize( this->variable_ );
     128    }
     129    else
     130      return 0;
    126131  }
    127132
     
    135140    if ( this->callback_ != 0 )
    136141    {
    137       if( forceCallback || !checkEquality( mem ) )
     142      if( forceCallback || !checkEquality( this->variable_, mem ) )
    138143        callback = true;
    139144    }
    140145  // write the data
    141     setAndIncrease( mem );
    142 //   mem += SynchronisableVariable<T>::getSize();
     146    loadAndIncrease( this->variable_, mem );
    143147  // now do a callback if neccessary
    144148    if ( callback )
    145149      NetworkCallbackManager::triggerCallback( this->callback_ );
    146       //this->callback_->call();
    147   }
    148 
    149   template <class T> uint32_t SynchronisableVariable<T>::getSize(uint8_t mode)
     150  }
     151
     152  template <class T> inline uint32_t SynchronisableVariable<T>::getSize(uint8_t mode)
    150153  {
    151154    if ( mode == this->mode_ )
    152       return returnSize();
     155      return returnSize( this->variable_ );
    153156    else
    154157      return 0;
    155158  }
    156159
    157   template <> _NetworkExport uint32_t SynchronisableVariable<const bool>::returnSize();
    158   template <> _NetworkExport void     SynchronisableVariable<const bool>::setAndIncrease(uint8_t*& mem);
    159   template <> _NetworkExport void     SynchronisableVariable<const bool>::getAndIncrease(uint8_t*& mem);
    160   template <> _NetworkExport bool     SynchronisableVariable<const bool>::checkEquality(uint8_t* mem);
    161   template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned char>::returnSize();
    162   template <> _NetworkExport void     SynchronisableVariable<const unsigned char>::setAndIncrease(uint8_t*& mem);
    163   template <> _NetworkExport void     SynchronisableVariable<const unsigned char>::getAndIncrease(uint8_t*& mem);
    164   template <> _NetworkExport bool     SynchronisableVariable<const unsigned char>::checkEquality(uint8_t* mem);
    165   template <> _NetworkExport uint32_t SynchronisableVariable<const short>::returnSize();
    166   template <> _NetworkExport void     SynchronisableVariable<const short>::setAndIncrease(uint8_t*& mem);
    167   template <> _NetworkExport void     SynchronisableVariable<const short>::getAndIncrease(uint8_t*& mem);
    168   template <> _NetworkExport bool     SynchronisableVariable<const short>::checkEquality(uint8_t* mem);
    169   template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned short>::returnSize();
    170   template <> _NetworkExport void     SynchronisableVariable<const unsigned short>::setAndIncrease(uint8_t*& mem);
    171   template <> _NetworkExport void     SynchronisableVariable<const unsigned short>::getAndIncrease(uint8_t*& mem);
    172   template <> _NetworkExport bool     SynchronisableVariable<const unsigned short>::checkEquality(uint8_t* mem);
    173   template <> _NetworkExport uint32_t SynchronisableVariable<const int>::returnSize();
    174   template <> _NetworkExport void     SynchronisableVariable<const int>::setAndIncrease(uint8_t*& mem);
    175   template <> _NetworkExport void     SynchronisableVariable<const int>::getAndIncrease(uint8_t*& mem);
    176   template <> _NetworkExport bool     SynchronisableVariable<const int>::checkEquality(uint8_t* mem);
    177   template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned int>::returnSize();
    178   template <> _NetworkExport void     SynchronisableVariable<const unsigned int>::setAndIncrease(uint8_t*& mem);
    179   template <> _NetworkExport void     SynchronisableVariable<const unsigned int>::getAndIncrease(uint8_t*& mem);
    180   template <> _NetworkExport bool     SynchronisableVariable<const unsigned int>::checkEquality(uint8_t* mem);
    181   template <> _NetworkExport uint32_t SynchronisableVariable<const long>::returnSize();
    182   template <> _NetworkExport void     SynchronisableVariable<const long>::setAndIncrease(uint8_t*& mem);
    183   template <> _NetworkExport void     SynchronisableVariable<const long>::getAndIncrease(uint8_t*& mem);
    184   template <> _NetworkExport bool     SynchronisableVariable<const long>::checkEquality(uint8_t* mem);
    185   template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned long>::returnSize();
    186   template <> _NetworkExport void     SynchronisableVariable<const unsigned long>::setAndIncrease(uint8_t*& mem);
    187   template <> _NetworkExport void     SynchronisableVariable<const unsigned long>::getAndIncrease(uint8_t*& mem);
    188   template <> _NetworkExport bool     SynchronisableVariable<const unsigned long>::checkEquality(uint8_t* mem);
    189   template <> _NetworkExport uint32_t SynchronisableVariable<const long long>::returnSize();
    190   template <> _NetworkExport void     SynchronisableVariable<const long long>::setAndIncrease(uint8_t*& mem);
    191   template <> _NetworkExport void     SynchronisableVariable<const long long>::getAndIncrease(uint8_t*& mem);
    192   template <> _NetworkExport bool     SynchronisableVariable<const long long>::checkEquality(uint8_t* mem);
    193   template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned long long>::returnSize();
    194   template <> _NetworkExport void     SynchronisableVariable<const unsigned long long>::setAndIncrease(uint8_t*& mem);
    195   template <> _NetworkExport void     SynchronisableVariable<const unsigned long long>::getAndIncrease(uint8_t*& mem);
    196   template <> _NetworkExport bool     SynchronisableVariable<const unsigned long long>::checkEquality(uint8_t* mem);
    197   template <> _NetworkExport uint32_t SynchronisableVariable<const float>::returnSize();
    198   template <> _NetworkExport void     SynchronisableVariable<const float>::setAndIncrease(uint8_t*& mem);
    199   template <> _NetworkExport void     SynchronisableVariable<const float>::getAndIncrease(uint8_t*& mem);
    200   template <> _NetworkExport bool     SynchronisableVariable<const float>::checkEquality(uint8_t* mem);
    201   template <> _NetworkExport uint32_t SynchronisableVariable<const double>::returnSize();
    202   template <> _NetworkExport void     SynchronisableVariable<const double>::setAndIncrease(uint8_t*& mem);
    203   template <> _NetworkExport void     SynchronisableVariable<const double>::getAndIncrease(uint8_t*& mem);
    204   template <> _NetworkExport bool     SynchronisableVariable<const double>::checkEquality(uint8_t* mem);
    205   template <> _NetworkExport uint32_t SynchronisableVariable<const long double>::returnSize();
    206   template <> _NetworkExport void     SynchronisableVariable<const long double>::setAndIncrease(uint8_t*& mem);
    207   template <> _NetworkExport void     SynchronisableVariable<const long double>::getAndIncrease(uint8_t*& mem);
    208   template <> _NetworkExport bool     SynchronisableVariable<const long double>::checkEquality(uint8_t* mem);
    209   template <> _NetworkExport uint32_t SynchronisableVariable<const std::string>::returnSize();
    210   template <> _NetworkExport void     SynchronisableVariable<const std::string>::setAndIncrease(uint8_t*& mem);
    211   template <> _NetworkExport void     SynchronisableVariable<const std::string>::getAndIncrease(uint8_t*& mem);
    212   template <> _NetworkExport bool     SynchronisableVariable<const std::string>::checkEquality(uint8_t* mem);
    213   template <> _NetworkExport uint32_t SynchronisableVariable<const Degree>::returnSize();
    214   template <> _NetworkExport void     SynchronisableVariable<const Degree>::setAndIncrease(uint8_t*& mem);
    215   template <> _NetworkExport void     SynchronisableVariable<const Degree>::getAndIncrease(uint8_t*& mem);
    216   template <> _NetworkExport bool     SynchronisableVariable<const Degree>::checkEquality(uint8_t* mem);
    217160
    218161
     
    229172    }
    230173
    231     template <class T> void SynchronisableVariableBidirectional<T>::getData(uint8_t*& mem, uint8_t mode)
     174    template <class T> uint32_t SynchronisableVariableBidirectional<T>::getData(uint8_t*& mem, uint8_t mode)
    232175    {
    233176      if ( this->mode_ == mode )
     
    243186      mem += sizeof(this->varReference_);
    244187  // now write the content
    245       SynchronisableVariable<T>::getAndIncrease( mem );
    246 //   mem += SynchronisableVariable<T>::getSize();
     188      saveAndIncrease( this->variable_, mem );
     189      return SynchronisableVariableBidirectional::getSize(mode);
    247190    }
    248191
     
    255198        if ( *static_cast<uint8_t*>(mem) != this->varReference_ )
    256199        { // wrong reference number, so discard the data
     200//           COUT(0) << "discharding data" << endl;
    257201          mem += getSize( mode ); // SynchronisableVariableBidirectional::getSize returns size of variable + reference
    258202          return;
     
    260204        else{
    261205          // apply data
    262           mem += sizeof(varReference_);
    263           if ( SynchronisableVariableBidirectional<T>::checkEquality( mem )==true )
     206          if ( checkEquality( this->variable_, mem+sizeof(varReference_) )==true )
    264207          {
    265             mem += SynchronisableVariable<T>::getSize( mode );
     208            mem += getSize( mode );
    266209            return;
    267210          }
    268211          else
    269212          {
     213            mem += sizeof(varReference_);
    270214            memcpy((void*)&this->varBuffer_, &this->variable_, sizeof(T));
    271215            if ( this->callback_ != 0 )
     
    285229          this->varReference_ = *static_cast<uint8_t*>(mem);
    286230          mem += sizeof(varReference_);
    287           if ( SynchronisableVariable<T>::checkEquality( mem ) == false )
     231          if ( checkEquality( this->variable_, mem ) == false )
    288232          {
    289233            // value changed so remark for callback
     
    294238      }
    295239  // now write the data
    296       SynchronisableVariable<T>::setAndIncrease(mem);
     240      loadAndIncrease(this->variable_, mem);
    297241  // now do a callback if neccessary
    298242      if ( callback )
    299243        NetworkCallbackManager::triggerCallback( this->callback_ );
    300         //this->callback_->call();
    301     }
    302 
    303     template <class T> uint32_t SynchronisableVariableBidirectional<T>::getSize(uint8_t mode)
    304     {
    305       return SynchronisableVariable<T>::returnSize() + sizeof(varReference_);
     244    }
     245
     246    template <class T> inline uint32_t SynchronisableVariableBidirectional<T>::getSize(uint8_t mode)
     247    {
     248      return returnSize( this->variable_ ) + sizeof(varReference_);
    306249    }
    307250 
Note: See TracChangeset for help on using the changeset viewer.