Changeset 9294 in orxonox.OLD for branches/proxy/src/lib/network/synchronizeable_var
- Timestamp:
- Jul 14, 2006, 1:58:16 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_ip.cc
r9293 r9294 47 47 int res; 48 48 49 // res = Converter::floatToByteArray( vPtrIn->x, buf + n, maxLength - n ); 50 // assert( res > 0 ); 51 // n += res; 52 // 53 // res = Converter::floatToByteArray( vPtrIn->y, buf + n, maxLength - n ); 54 // assert( res > 0 ); 55 // n += res; 56 // 57 // res = Converter::floatToByteArray( vPtrIn->z, buf + n, maxLength - n ); 58 // assert( res > 0 ); 59 // n += res; 60 // 61 // assert( 3*FLOATSIZE == n ); 49 res = Converter::intToByteArray( (int)vPtrIn->host, buf, maxLength ); 50 assert(res > 0); 51 n += res; 52 53 res = Converter::intToByteArray( (int)vPtrIn->port, buf, maxLength); 54 assert(res > 0); 55 n += res; 56 57 assert( 2 * INTSIZE == n); 62 58 63 59 return n; … … 72 68 int SynchronizeableIP::readFromBuf( byte * buf, int maxLength ) 73 69 { 74 assert( maxLength >= 3*FLOATSIZE);70 assert( maxLength >= 2 * INTSIZE); 75 71 76 float x,y,z;72 int host, port; 77 73 78 74 int res; 79 75 int n = 0; 80 76 81 // Vector oldVec= *vPtrOut;82 // 83 // res = Converter::byteArrayToFloat( buf + n, &x ); 84 // assert( res > 0);85 // n += res;86 // 87 // res = Converter::byteArrayToFloat( buf + n, &y ); 88 // assert( res > 0 ); 89 // n += res;90 // 91 // res = Converter::byteArrayToFloat( buf + n, &z );92 // assert( res > 0 ); 93 // n += res;94 // 95 // *vPtrOut = Vector( x, y, z ); 96 // 97 // setHasChanged( !(*vPtrOut == oldVec) ); 98 // 99 // assert( n == 3*FLOATSIZE ); 77 IPaddress oldIP = *vPtrOut; 78 IPaddress newIP; 79 80 res = Converter::byteArrayToInt( buf + n, &host); 81 assert( res > 0); 82 n += res; 83 84 85 res = Converter::byteArrayToInt( buf + n, &port); 86 assert( res > 0); 87 n += res; 88 89 newIP.host = host; 90 newIP.port = port; 91 92 setHasChanged( (newIP.host != oldIP.host || newIP.port != oldIP.port) ); 93 94 assert( n == 2 * INTSIZE); 95 100 96 return n; 101 97 } … … 107 103 void SynchronizeableIP::SynchronizeableIP::debug( ) 108 104 { 109 // printf( "SYNCHRONIZEABLE_VAR: %s IN: (%f, %f, %f) OUT: (%f %f %f)\n", name.c_str(), vPtrIn->x, vPtrIn->y, vPtrIn->z, vPtrOut->x, vPtrOut->y, vPtrOut->z);105 printf("SYNCHRONIZEABLE_VAR: %s IN: %i, %i OUT: %i, %i\n", name.c_str(), vPtrIn->host, vPtrIn->port, vPtrOut->host, vPtrOut->port); 110 106 } 111 107
Note: See TracChangeset
for help on using the changeset viewer.