Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 5, 2008, 3:43:16 PM (16 years ago)
Author:
scheusso
Message:

added a function unregisterVariable to unregister variable that has been registered inside a synchronisable before
use it like this:
unregisterVariable(&this→myVar_) if you registered the variable with REGISTERDATA(this→myVar_)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/network/Synchronisable.cc

    r2133 r2143  
    251251  * @param cb callback object that should get called, if the value of the variable changes
    252252  */
    253   void Synchronisable::registerVar(void *var, int size, variableType t, uint8_t mode, NetworkCallbackBase *cb){
     253  void Synchronisable::registerVariable(void *var, int size, variableType t, uint8_t mode, NetworkCallbackBase *cb){
    254254    assert( mode==direction::toclient || mode==direction::toserver || mode==direction::serverMaster || mode==direction::clientMaster);
    255255    // create temporary synch.Var struct
     
    285285#endif
    286286  }
     287 
     288  void Synchronisable::unregisterVariable(void *var){
     289    std::list<synchronisableVariable *>::iterator it = syncList->begin();
     290    while(it!=syncList->end()){
     291      if( (*it)->var == var ){
     292        delete *it;
     293        syncList->erase(it);
     294        return;
     295      }
     296      else
     297        it++;
     298    }
     299    assert(0); //if we reach this point something went wrong
     300  }
     301 
    287302
    288303  /**
Note: See TracChangeset for help on using the changeset viewer.