Changeset 1425 for code/branches/network/src/network/Synchronisable.cc
- Timestamp:
- May 25, 2008, 11:08:19 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/Synchronisable.cc
r1418 r1425 70 70 bool Synchronisable::create(){ 71 71 this->classID = this->getIdentifier()->getNetworkID(); 72 COUT(4) << "setting classid from " << this->getIdentifier()->getName() << " to: " << classID << std::endl; 72 73 return true; 73 74 } … … 156 157 * @return data containing all variables and their sizes 157 158 */ 158 syncData Synchronisable::getData(unsigned char *mem ){159 syncData Synchronisable::getData(unsigned char *mem, int mode){ 159 160 //std::cout << "inside getData" << std::endl; 161 if(mode==0x0) 162 mode=state_; 160 163 if(classID==0) 161 164 COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl; … … 172 175 for(i=syncList->begin(); n<datasize && i!=syncList->end(); ++i){ 173 176 //(std::memcpy(retVal.data+n, (const void*)(&(i->size)), sizeof(int)); 174 if( ((*i)->mode & state_) == 0 ){177 if( ((*i)->mode & mode) == 0 ){ 175 178 COUT(5) << "not getting data: " << std::endl; 176 179 continue; // this variable should only be received … … 199 202 * @return true/false 200 203 */ 201 bool Synchronisable::updateData(syncData vars){ 204 bool Synchronisable::updateData(syncData vars, int mode){ 205 if(mode==0x0) 206 mode=state_; 202 207 unsigned char *data=vars.data; 203 208 std::list<synchronisableVariable *>::iterator i; … … 208 213 COUT(5) << "Synchronisable: objectID " << vars.objectID << ", classID " << vars.classID << " size: " << vars.length << " synchronising data" << std::endl; 209 214 for(i=syncList->begin(); i!=syncList->end(); i++){ 210 if( ((*i)->mode ^ state_) == 0 ){215 if( ((*i)->mode ^ mode) == 0 ){ 211 216 COUT(5) << "synchronisable: not updating variable " << std::endl; 212 continue; // this variable should only be updated217 continue; // this variable should only be set 213 218 } 214 219 COUT(5) << "Synchronisable: element size: " << (*i)->size << " type: " << (*i)->type << std::endl; … … 235 240 * @return amount of bytes 236 241 */ 237 int Synchronisable::getSize( ){242 int Synchronisable::getSize(int mode){ 238 243 int tsize=0; 244 if(mode==0x0) 245 mode=state_; 239 246 std::list<synchronisableVariable *>::iterator i; 240 247 for(i=syncList->begin(); i!=syncList->end(); i++){ 241 if( ((*i)->mode & state_) == 0 )248 if( ((*i)->mode & mode) == 0 ) 242 249 continue; // this variable should only be received, so dont add its size to the send-size 243 250 switch((*i)->type){
Note: See TracChangeset
for help on using the changeset viewer.