Changeset 1232 for code/branches/network3/src/network/Synchronisable.cc
- Timestamp:
- May 5, 2008, 1:19:22 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network3/src/network/Synchronisable.cc
r1199 r1232 48 48 namespace network 49 49 { 50 51 52 int Synchronisable::state_=1; // detemines wheter we are server (default) or client 53 50 54 /** 51 55 * Constructor: … … 63 67 Synchronisable::~Synchronisable(){ 64 68 } 69 70 void Synchronisable::setClient(bool b){ 71 if(b) // client 72 state_=0x2; 73 else // server 74 state_=0x1; 75 } 65 76 66 77 /** … … 70 81 * @param size size of the datatype the variable consists of 71 82 */ 72 void Synchronisable::registerVar(void *var, int size, variableType t ){83 void Synchronisable::registerVar(void *var, int size, variableType t, int mode){ 73 84 // create temporary synch.Var struct 74 85 synchronisableVariable *temp = new synchronisableVariable; 75 86 temp->size = size; 76 87 temp->var = var; 88 temp->mode = mode; 77 89 temp->type = t; 78 90 COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl; … … 153 165 for(i=syncList->begin(); n<datasize && i!=syncList->end(); ++i){ 154 166 //(std::memcpy(retVal.data+n, (const void*)(&(i->size)), sizeof(int)); 167 if( ((*i)->mode & state_) == 0 ) 168 continue; // this variable should only be received 155 169 switch((*i)->type){ 156 170 case DATA: … … 185 199 COUT(5) << "Synchronisable: objectID " << vars.objectID << ", classID " << vars.classID << " size: " << vars.length << " synchronising data" << std::endl; 186 200 for(i=syncList->begin(); i!=syncList->end(); i++){ 201 if( ((*i)->mode ^ state_) == 0 ) 202 continue; // this variable should only be sent 187 203 COUT(5) << "Synchronisable: element size: " << (*i)->size << " type: " << (*i)->type << std::endl; 188 204 switch((*i)->type){ … … 212 228 std::list<synchronisableVariable *>::iterator i; 213 229 for(i=syncList->begin(); i!=syncList->end(); i++){ 230 if( ((*i)->mode & state_) == 0 ) 231 continue; // this variable should only be received, so dont add its size to the send-size 214 232 switch((*i)->type){ 215 233 case DATA: … … 226 244 return tsize; 227 245 } 228 246 247 void Synchronisable::setBacksync(bool sync){ 248 backsync_=sync; 249 } 250 251 bool Synchronisable::getBacksync(){ 252 return backsync_; 253 } 254 229 255 }
Note: See TracChangeset
for help on using the changeset viewer.