Changeset 1581 for code/branches/gcc43/src/network/Synchronisable.cc
- Timestamp:
- Jun 9, 2008, 11:11:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gcc43/src/network/Synchronisable.cc
r1534 r1581 43 43 #include <string> 44 44 #include <iostream> 45 #include <string.h> 45 46 46 47 #include "core/CoreIncludes.h" … … 49 50 namespace network 50 51 { 51 52 52 53 53 54 int Synchronisable::state_=0x1; // detemines wheter we are server (default) or client 54 55 55 56 /** 56 57 * Constructor: … … 72 73 delete (*it)->callback; 73 74 } 74 75 75 76 bool Synchronisable::create(){ 76 77 this->classID = this->getIdentifier()->getNetworkID(); … … 78 79 return true; 79 80 } 80 81 81 82 void Synchronisable::setClient(bool b){ 82 83 if(b) // client … … 97 98 temp->size = size; 98 99 temp->var = var; 99 temp->mode = mode; 100 temp->mode = mode; 100 101 temp->type = t; 101 102 temp->callback = cb; 102 COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl; 103 COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl; 103 104 // increase datasize 104 105 datasize+=sizeof(int)+size; … … 187 188 switch((*i)->type){ 188 189 case DATA: 189 std::memcpy( (void *)(retVal.data+n), (void*)((*i)->var), (*i)->size);190 memcpy( (void *)(retVal.data+n), (void*)((*i)->var), (*i)->size); 190 191 n+=(*i)->size; 191 192 break; … … 194 195 n+=sizeof(int); 195 196 const char *data = ( ( *(std::string *) (*i)->var).c_str()); 196 std::memcpy( retVal.data+n, (void*)data, (*i)->size);197 memcpy( retVal.data+n, (void*)data, (*i)->size); 197 198 COUT(5) << "synchronisable: char: " << (const char *)(retVal.data+n) << " data: " << data << " string: " << *(std::string *)((*i)->var) << std::endl; 198 199 n+=(*i)->size; … … 278 279 return tsize; 279 280 } 280 281 281 282 void Synchronisable::setBacksync(bool sync){ 282 283 backsync_=sync; … … 286 287 return backsync_; 287 288 } 288 289 289 290 }
Note: See TracChangeset
for help on using the changeset viewer.