Changeset 7459 in orxonox.OLD for branches/network/src/lib/network/synchronizeable_var/synchronizeable_vector.cc
- Timestamp:
- Apr 30, 2006, 1:50:25 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/synchronizeable_var/synchronizeable_vector.cc
r7444 r7459 16 16 17 17 #include "synchronizeable_vector.h" 18 #include "converter.h" 18 19 19 20 … … 22 23 * @todo this constructor is not jet implemented - do it 23 24 */ 24 SynchronizeableVector::SynchronizeableVector( Vector * ptrIn, Vector * ptrOut, std::string name, int permission, int priority) : SynchronizeableVar( ptrIn, ptrOut, name, 0, permission, priority )25 SynchronizeableVector::SynchronizeableVector( Vector * ptrIn, Vector * ptrOut, std::string name, int permission, int priority) : SynchronizeableVar( ptrIn, ptrOut, name, 3*FLOATSIZE, permission, priority ) 25 26 { 26 27 this->vPtrIn = ptrIn; … … 44 45 int SynchronizeableVector::writeToBuf( byte * buf, int maxLength ) 45 46 { 46 #warning implement this 47 int n = 0; 48 int res; 49 50 res = Converter::floatToByteArray( vPtrIn->x, buf, maxLength - n ); 51 assert( res > 0 ); 52 n += res; 53 54 res = Converter::floatToByteArray( vPtrIn->y, buf, maxLength - n ); 55 assert( res > 0 ); 56 n += res; 57 58 res = Converter::floatToByteArray( vPtrIn->z, buf, maxLength - n ); 59 assert( res > 0 ); 60 n += res; 61 62 assert( 3*FLOATSIZE == n ); 63 64 return n; 47 65 } 48 66 … … 55 73 int SynchronizeableVector::readFromBuf( byte * buf, int maxLength ) 56 74 { 57 #warning implement this 75 assert( maxLength >= 3*FLOATSIZE ); 76 77 float x,y,z; 78 79 int res; 80 int n = 0; 81 82 res += Converter::byteArrayToFloat( buf + n, &x ); 83 assert( res > 0 ); 84 n += res; 85 86 res += Converter::byteArrayToFloat( buf + n, &x ); 87 assert( res > 0 ); 88 n += res; 89 90 res += Converter::byteArrayToFloat( buf + n, &x ); 91 assert( res > 0 ); 92 n += res; 93 94 *vPtrOut = Vector( x, y, z ); 95 96 assert( res == 3*FLOATSIZE ); 97 return res; 58 98 }
Note: See TracChangeset
for help on using the changeset viewer.