Changeset 6285 in orxonox.OLD for branches/network/src/lib/network/synchronizeable.h
- Timestamp:
- Dec 25, 2005, 4:24:50 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/synchronizeable.h
r6277 r6285 29 29 * with the same argument names! 30 30 * 31 * SYNCHELP_WRITE_BEGIN() 32 * SYNCHELP_WRITE_INT(i) 33 * SYNCHELP_WRITE_FLOAT(f) 34 * SYNCHELP_WRITE_BYTE(b) 35 * SYNCHELP_WRITE_STRING(s) 36 * SYNCHELP_WRITE_N 37 * 38 * SYNCHELP_READ_BEGIN() 39 * SYNCHELP_READ_INT(i) 40 * SYNCHELP_READ_FLOAT(f) 41 * SYNCHELP_READ_STRING(s,l) l = size of buffer s 42 * SYNCHELP_READ_STRINGM(s) allocates memory for string! you have to free this after 43 * SYNCHELP_READ_BYTE(b) 44 * 45 * 31 46 * 32 47 * Example 1: … … 44 59 #define SYNCHELP_WRITE_BEGIN() int __synchelp_write_i = 0; \ 45 60 int __synchelp_write_n 46 #define SYNCHELP_WRITE_RESET() { __synchelp_write_i = 0; __synchelp_write_err = false; }47 61 #define SYNCHELP_WRITE_INT(i) { __synchelp_write_n = \ 48 62 Converter::intToByteArray( i, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \ … … 112 126 __synchelp_read_i += __synchelp_read_n; \ 113 127 } 128 #define SYNCHELP_READ_STRINGM(s) { \ 129 __synchelp_read_n = Converter::byteArrayToStringM( data+__synchelp_read_i, s ); \ 130 if ( __synchelp_read_n <0 ) \ 131 { \ 132 PRINTF(1)("There is not enough data to read string\n"); \ 133 return; \ 134 } \ 135 __synchelp_read_i += __synchelp_read_n; \ 136 } 114 137 #define SYNCHELP_READ_BYTE(b) { \ 115 138 if ( length-__synchelp_read_i < 1 ) \
Note: See TracChangeset
for help on using the changeset viewer.