Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 23, 2009, 8:19:58 PM (14 years ago)
Author:
scheusso
Message:

synchronisation of pointers to classes that inherit from Synchronisable are now possible
just use the normal registerVariable syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/libraries/network/synchronisable/Synchronisable.h

    r5929 r6123  
    138138    Synchronisable(BaseObject* creator);
    139139    template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
    140     //template <class T> void unregisterVariable(T& var);
    141140    void setPriority(unsigned int freq){ objectFrequency_ = freq; }
    142141
     
    187186    if (bidirectional)
    188187    {
    189       syncList.push_back(new SynchronisableVariableBidirectional<const T>(variable, mode, cb));
     188      syncList.push_back(new SynchronisableVariableBidirectional<T>(variable, mode, cb));
    190189      this->dataSize_ += syncList.back()->getSize(state_);
    191190    }
    192191    else
    193192    {
    194       syncList.push_back(new SynchronisableVariable<const T>(variable, mode, cb));
     193      syncList.push_back(new SynchronisableVariable<T>(variable, mode, cb));
    195194      if ( this->state_ == mode )
    196195        this->dataSize_ += syncList.back()->getSize(state_);
    197196    }
    198197  }
    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 //   }
    217198
    218199 
Note: See TracChangeset for help on using the changeset viewer.