Wiselib
|
00001 /*************************************************************************** 00002 ** This file is part of the generic algorithm library Wiselib. ** 00003 ** Copyright (C) 2008,2009 by the Wisebed (www.wisebed.eu) project. ** 00004 ** ** 00005 ** The Wiselib is free software: you can redistribute it and/or modify ** 00006 ** it under the terms of the GNU Lesser General Public License as ** 00007 ** published by the Free Software Foundation, either version 3 of the ** 00008 ** License, or (at your option) any later version. ** 00009 ** ** 00010 ** The Wiselib is distributed in the hope that it will be useful, ** 00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** 00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 00013 ** GNU Lesser General Public License for more details. ** 00014 ** ** 00015 ** You should have received a copy of the GNU Lesser General Public ** 00016 ** License along with the Wiselib. ** 00017 ** If not, see <http://www.gnu.org/licenses/>. ** 00018 ***************************************************************************/ 00019 namespace wiselib 00020 { 00021 template< typename Os_P, 00022 typename Radio_P, 00023 typename DataType_P 00024 typename Debug_P> 00025 class SerializableDynamicType 00026 { 00027 public: 00028 typedef Os_P Os; 00029 typedef Radio_P Radio; 00030 typedef DataType_P DataType; 00031 typedef Debug_P Debug; 00032 typedef typename Radio::block_data_t block_data_t; 00033 typedef typename Radio::size_t size_t; 00034 SerializableDynamicType( const DataType& _d ) 00035 { 00036 data = _d; 00037 } 00038 SerializableDynamicType( block_data_t* buff, size_t offset = 0 ) 00039 { 00040 get_from_buffer( buff, offset ); 00041 } 00042 block_data_t* set_buffer_from( block_data_t* buff, size_t offset = 0 ) 00043 { 00044 uint8_t SERIALIZABLE_DYNAMIC_TYPE_POS = 0; 00045 uint8_t SERIALIZABLE_DYNAMIC_DATA_POS = SERIALIZABLE_DYNAMIC_TYPE_POS + sizeof( size_t ); 00046 size_t len = get_buffer_size(); 00047 write<Os, block_data_t, size_t> ( buff + SERIALIZABLE_DYNAMIC_TYPE_POS + offset, len ); 00048 write<Os, block_data_t, DataType>( buff + SERIALIZABLE_DYNAMIC_DATA_POS + offset, data ); 00049 return buff; 00050 } 00051 SerializableDynamicType get_from_buffer( block_data_t* buff, size_t offset = 0 ) 00052 { 00053 uint8_t SERIALIZABLE_DYNAMIC_TYPE_POS = 0; 00054 uint8_t SERIALIZABLE_DYNAMIC_DATA_POS = SERIALIZABLE_DYNAMIC_TYPE_POS + SERIALIZABLE_DYNAMIC_DATA_POS + sizeof( size_t ); 00055 data = read<Os, block_data_t, DataType>( buff + SERIALIZABLE_DYNAMIC_DATA_POS + offset ); 00056 return *this; 00057 } 00058 size_t get_buffer_size() 00059 { 00060 return sizeof( DataType ); 00061 } 00062 inline void set_data( const DataType& _d ) 00063 { 00064 target = _d; 00065 } 00066 inline Node get_data() 00067 { 00068 return data; 00069 } 00070 void print( Debug& debug ) 00071 { 00072 debug.debug( " %x - ( size %i )", data, get_buffer_size() ); 00073 } 00074 private: 00075 DataType data; 00076 }; 00077 00078 template< typename Os_P, 00079 typename Radio_P, 00080 typename DataType_P, 00081 typename DataTypeList_P, 00082 typename Debug_P> 00083 class SerializableDynamicListType 00084 { 00085 public: 00086 typedef Os_P Os; 00087 typedef Radio_P Radio; 00088 typedef DataType_P DataType; 00089 typedef DataTypeList_P DataTypeList; 00090 typedef Debug_P Debug; 00091 typedef typename Radio::block_data_t block_data_t; 00092 typedef typename Radio::node_id_t node_id_t; 00093 typedef typename DataTypeList::iterator iterator; 00094 SerializableDynamicListType( void ) 00095 {} 00096 SerializableDynamicListType( block_data_t* buff, size_t offset = 0 ) 00097 { 00098 get_from_buffer( buff, offset ); 00099 } 00100 inline DataTypeList* get_data_list() 00101 { 00102 return &data_list; 00103 } 00104 inline void set_data_list( DataTypeList& _dl ) 00105 { 00106 data_list = *_dl; 00107 } 00108 block_data_t* set_buffer_from( block_data_t* buff, size_t offset = 0 ) 00109 { 00110 uint8_t SERIALIZABLE_DYNAMIC_LIST_SIZE_POS = 0; 00111 uint8_t DATA_LIST_POS = SERIALIZABLE_DYNAMIC_LIST_SIZE_POS + sizeof( size_t ); 00112 size_t len = get_buffer_size(); 00113 write<Os, block_data_t, size_t>( buff + DATA_LIST_POS + offset, len ); 00114 for ( uint16_t i = 0; i < data_list.size(); i++ ) 00115 { 00116 data_list.at(i).set_buffer_from( buff, DATA_LIST_POS + i * data_list.at( i ).get_buffer_size() + offset ); 00117 } 00118 return buff; 00119 } 00120 SerializableDynamicListType get_from_buffer( block_data_t* buff, size_t offset = 0 ) 00121 { 00122 uint8_t SERIALIZABLE_DYNAMIC_LIST_SIZE_POS = 0; 00123 uint8_t DATA_LIST_POS = SERIALIZABLE_DYNAMIC_LIST_SIZE_POS + sizeof( size_t ); 00124 size_t len = read<Os, block_data_t, size_t>( buff + DATA_LIST_POS + offset ); 00125 uint16_t i = 0; 00126 DataType dt; 00127 while ( i < len ) 00128 { 00129 dt.get_from_buffer( buff, DATA_LIST_POS + sizeof( size_t ) + i + offset ); 00130 data_list.push_back( dt ); 00131 i = read<Os, block_data, size_t> ( buff + DATA_LIST_POS + offset + i ) + i; 00132 } 00133 return *this; 00134 } 00135 size_t get_buffer_size() 00136 { 00137 size_t len = 0; 00138 for ( uint16_t i = 0; i < data_list.size(); i++ ) 00139 { 00140 len = len + data_list.at( i ).get_buffer_size(); 00141 } 00142 return len; 00143 } 00144 void print( Debug& debug ) 00145 { 00146 for ( iterator i = data_list.begin(); i != data_list.end(); ++i ) 00147 { 00148 i->print( debug ); 00149 } 00150 } 00151 private: 00152 DataTypeList data_list; 00153 }; 00154 00155 00156 template< typename Os_P, 00157 typename Radio_P, 00158 typename SerializableType1_P, 00159 typename SerializableType2_P, 00160 typename Debug_p > 00161 class SerializableDynamicSet2_Type 00162 { 00163 public: 00164 typedef Os_P Os; 00165 typedef Radio_P Radio; 00166 typedef SerializableType1_P SerializableDynamicType1; 00167 typedef SerializableType2_P SerializableDynamicType2; 00168 typedef Debug_P Debug; 00169 typedef typename Radio::block_data_t block_data_t; 00170 typedef typename Radio::size_t size_t; 00171 typedef SerializableDynamicSet2_Type<Os, Radio, SerializableDynamicType1, SerializableDynamicType2, Debug> self_type; 00172 SerializableDynamicSet2_Type() 00173 {} 00174 SerializableDynamicSet2_Type( const self_type& _d ) 00175 { 00176 *this = _d; 00177 } 00178 SerializableDynamicSet2_Type( block_data_t* buff, size_t offset = 0 ) 00179 { 00180 get_from_buffer( buff, offset ); 00181 } 00182 inline block_data_t* set_buffer_from( block_data_t* buff, size_t offset = 0 ) 00183 { 00184 uint8_t SERIALIZABLE_DYNAMIC_SET2_SIZE_POS = 0; 00185 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET2_SIZE_POS + sizeof( size_t ); 00186 uint8_t DYNAMIC_DATA2_POS = DYNAMIC_DATA1_POS + data1.get_buffer_size(); 00187 data1.set_buffer_from( buff, DYNAMIC_DATA1_POS + offset ); 00188 data2.set_buffer_from( buff, DYNAMIC_DATA2_POS + offset ); 00189 return buff; 00190 } 00191 inline self_type get_from_buffer( block_data_t* buff, size_t offset = 0 ) 00192 { 00193 uint8_t SERIALIZABLE_DYNAMIC_SET2_SIZE_POS = 0; 00194 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET2_SIZE_POS + sizeof( size_t ); 00195 uint8_t DYNAMIC_DATA2_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA1_POS ) + DYNAMIC_DATA1_POS; 00196 data1.get_from_buffer( buff, DYNAMIC_DATA1_POS + offset ); 00197 data2.get_from_buffer( buff, DYNAMIC_DATA2_POS + offset ); 00198 return *this; 00199 } 00200 inline size_t get_buffer_size() 00201 { 00202 uint8_t SERIALIZABLE_DYNAMIC_SET2_SIZE_POS = 0; 00203 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET2_SIZE_POS + sizeof( size_t ); 00204 uint8_t DYNAMIC_DATA2_POS = DYNAMIC_DATA1_POS + data1.get_buffer_size(); 00205 return DYNAMIC_DATA2_POS + data2.get_buffer_size(); 00206 } 00207 inline self_type& operator=( const self_type& _t ) 00208 { 00209 data1 = _t.data1; 00210 data2 = _t.data2; 00211 return *this; 00212 } 00213 inline void set_data1( const SerializableType1& _d ) 00214 { 00215 data1 = _d; 00216 } 00217 inline void set_data2( const SerializableType2& _d ) 00218 { 00219 data2 = _d; 00220 } 00221 inline SerializableType1 get_data1() 00222 { 00223 return data1; 00224 } 00225 inline SerializableType2 get_data2() 00226 { 00227 return data2; 00228 } 00229 inline void print( Debug& debug ) 00230 { 00231 data1.print( debug ); 00232 data2.print( debug ); 00233 } 00234 private: 00235 SerializableDynamicType1 data1; 00236 SerializableDynamicType2 data2; 00237 }; 00238 00239 template< typename Os_P, 00240 typename Radio_P, 00241 typename SerializableType1_P, 00242 typename SerializableType2_P, 00243 typename SerializableType3_P, 00244 typename Debug_p > 00245 class SerializableDynamicSet3_Type 00246 { 00247 public: 00248 typedef Os_P Os; 00249 typedef Radio_P Radio; 00250 typedef SerializableType1_P SerializableDynamicType1; 00251 typedef SerializableType2_P SerializableDynamicType2; 00252 typedef SerializableType3_P SerializableDynamicType3; 00253 typedef Debug_P Debug; 00254 typedef typename Radio::block_data_t block_data_t; 00255 typedef typename Radio::size_t size_t; 00256 typedef SerializableDynamicSet3_Type<Os, Radio, SerializableDynamicType1, SerializableDynamicType2, SerializableDynamicType3, Debug> self_type; 00257 SerializableDynamicSet3_Type() 00258 {} 00259 SerializableDynamicSet3_Type( const self_type& _d ) 00260 { 00261 *this = _d; 00262 } 00263 SerializableDynamicSet3_Type( block_data_t* buff, size_t offset = 0 ) 00264 { 00265 get_from_buffer( buff, offset ); 00266 } 00267 inline block_data_t* set_buffer_from( block_data_t* buff, size_t offset = 0 ) 00268 { 00269 uint8_t SERIALIZABLE_DYNAMIC_SET3_SIZE_POS = 0; 00270 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET3_SIZE_POS + sizeof( size_t ); 00271 uint8_t DYNAMIC_DATA2_POS = DYNAMIC_DATA1_POS + data1.get_buffer_size(); 00272 uint8_t DYNAMIC_DATA3_POS = DYNAMIC_DATA2_POS + data2.get_buffer_size(); 00273 data1.set_buffer_from( buff, DYNAMIC_DATA1_POS + offset ); 00274 data2.set_buffer_from( buff, DYNAMIC_DATA2_POS + offset ); 00275 data3.set_buffer_from( buff, DYNAMIC_DATA3_POS + offset ); 00276 return buff; 00277 } 00278 inline self_type get_from_buffer(block_data_t* buff, size_t offset = 0 ) 00279 { 00280 uint8_t SERIALIZABLE_DYNAMIC_SET3_SIZE_POS = 0; 00281 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET3_SIZE_POS + sizeof( size_t ); 00282 uint8_t DYNAMIC_DATA2_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA1_POS ) + DYNAMIC_DATA1_POS; 00283 uint8_t DYNAMIC_DATA3_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA2_POS ) + DYNAMIC_DATA2_POS; 00284 data1.get_from_buffer( buff, DYNAMIC_DATA1_POS + offset ); 00285 data2.get_from_buffer( buff, DYNAMIC_DATA2_POS + offset ); 00286 data3.get_from_buffer( buff, DYNAMIC_DATA3_POS + offset ); 00287 return *this; 00288 } 00289 inline size_t get_buffer_size() 00290 { 00291 uint8_t SERIALIZABLE_DYNAMIC_SET3_SIZE_POS = 0; 00292 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET3_SIZE_POS + sizeof( size_t ); 00293 uint8_t DYNAMIC_DATA2_POS = DYNAMIC_DATA1_POS + data1.get_buffer_size(); 00294 uint8_t DYNAMIC_DATA3_POS = DYNAMIC_DATA2_POS + data2.get_buffer_size(); 00295 return DYNAMIC_DATA3_POS + data3.get_buffer_size(); 00296 } 00297 inline self_type& operator=( const self_type& _t ) 00298 { 00299 data1 = _t.data1; 00300 data2 = _t.data2; 00301 data3 = _t.data3; 00302 return *this; 00303 } 00304 inline void set_data1( const SerializableType1& _d ) 00305 { 00306 data1 = _d; 00307 } 00308 inline void set_data2( const SerializableType2& _d ) 00309 { 00310 data2 = _d; 00311 } 00312 inline void set_data3( const SerializableType3& _d ) 00313 { 00314 data3 = _d; 00315 } 00316 inline SerializableType1 get_data1() 00317 { 00318 return data1; 00319 } 00320 inline SerializableType2 get_data2() 00321 { 00322 return data2; 00323 } 00324 inline SerializableType3 get_data3() 00325 { 00326 return data3; 00327 } 00328 inline void print( Debug& debug ) 00329 { 00330 data1.print( debug ); 00331 data2.print( debug ); 00332 data3.print( debug ); 00333 } 00334 private: 00335 SerializableDynamicType1 data1; 00336 SerializableDynamicType2 data2; 00337 SerializableDynamicType3 data3; 00338 }; 00339 00340 template< typename Os_P, 00341 typename Radio_P, 00342 typename SerializableType1_P, 00343 typename SerializableType2_P, 00344 typename SerializableType3_P, 00345 typename SerializableType4_P, 00346 typename Debug_p > 00347 class SerializableDynamicSet4_Type 00348 { 00349 public: 00350 typedef Os_P Os; 00351 typedef Radio_P Radio; 00352 typedef SerializableType1_P SerializableDynamicType1; 00353 typedef SerializableType2_P SerializableDynamicType2; 00354 typedef SerializableType3_P SerializableDynamicType3; 00355 typedef SerializableType4_P SerializableDynamicType4; 00356 typedef Debug_P Debug; 00357 typedef typename Radio::block_data_t block_data_t; 00358 typedef typename Radio::size_t size_t; 00359 typedef SerializableDynamicSet4_Type<Os, Radio, SerializableDynamicType1, SerializableDynamicType2, SerializableDynamicType3, SerializableDynamicType4, Debug> self_type; 00360 SerializableDynamicSet4_Type() 00361 {} 00362 SerializableDynamicSet4_Type( const self_type& _d ) 00363 { 00364 *this = _d; 00365 } 00366 SerializableDynamicSet4_Type( block_data_t* buff, size_t offset = 0 ) 00367 { 00368 get_from_buffer( buff, offset ); 00369 } 00370 inline block_data_t* set_buffer_from( block_data_t* buff, size_t offset = 0 ) 00371 { 00372 uint8_t SERIALIZABLE_DYNAMIC_SET4_SIZE_POS = 0; 00373 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET4_SIZE_POS + sizeof( size_t ); 00374 uint8_t DYNAMIC_DATA2_POS = DYNAMIC_DATA1_POS + data1.get_buffer_size(); 00375 uint8_t DYNAMIC_DATA3_POS = DYNAMIC_DATA2_POS + data2.get_buffer_size(); 00376 uint8_t DYNAMIC_DATA4_POS = DYNAMIC_DATA3_POS + data3.get_buffer_size(); 00377 data1.set_buffer_from( buff, DYNAMIC_DATA1_POS + offset ); 00378 data2.set_buffer_from( buff, DYNAMIC_DATA2_POS + offset ); 00379 data3.set_buffer_from( buff, DYNAMIC_DATA3_POS + offset ); 00380 data4.set_buffer_from( buff, DYNAMIC_DATA4_POS + offset ); 00381 return buff; 00382 } 00383 inline self_type get_from_buffer(block_data_t* buff, size_t offset = 0 ) 00384 { 00385 uint8_t SERIALIZABLE_DYNAMIC_SET4_SIZE_POS = 0; 00386 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET4_SIZE_POS + sizeof( size_t ); 00387 uint8_t DYNAMIC_DATA2_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA1_POS ) + DYNAMIC_DATA1_POS; 00388 uint8_t DYNAMIC_DATA3_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA2_POS ) + DYNAMIC_DATA2_POS; 00389 uint8_t DYNAMIC_DATA4_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA3_POS ) + DYNAMIC_DATA3_POS; 00390 data1.get_from_buffer( buff, DYNAMIC_DATA1_POS + offset ); 00391 data2.get_from_buffer( buff, DYNAMIC_DATA2_POS + offset ); 00392 data3.get_from_buffer( buff, DYNAMIC_DATA3_POS + offset ); 00393 data4.get_from_buffer( buff, DYNAMIC_DATA4_POS + offset ); 00394 return *this; 00395 } 00396 inline size_t get_buffer_size() 00397 { 00398 uint8_t SERIALIZABLE_DYNAMIC_SET4_SIZE_POS = 0; 00399 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET4_SIZE_POS + sizeof( size_t ); 00400 uint8_t DYNAMIC_DATA2_POS = DYNAMIC_DATA1_POS + data1.get_buffer_size(); 00401 uint8_t DYNAMIC_DATA3_POS = DYNAMIC_DATA2_POS + data2.get_buffer_size(); 00402 uint8_t DYNAMIC_DATA4_POS = DYNAMIC_DATA3_POS + data3.get_buffer_size(); 00403 return DYNAMIC_DATA4_POS + data4.get_buffer_size(); 00404 } 00405 inline self_type& operator=( const self_type& _t ) 00406 { 00407 data1 = _t.data1; 00408 data2 = _t.data2; 00409 data3 = _t.data3; 00410 data4 = _t.data4; 00411 return *this; 00412 } 00413 inline void set_data1( const SerializableType1& _d ) 00414 { 00415 data1 = _d; 00416 } 00417 inline void set_data2( const SerializableType2& _d ) 00418 { 00419 data2 = _d; 00420 } 00421 inline void set_data3( const SerializableType3& _d ) 00422 { 00423 data3 = _d; 00424 } 00425 inline void set_data4( const SerializableType4& _d ) 00426 { 00427 data4 = _d; 00428 } 00429 inline SerializableType1 get_data1() 00430 { 00431 return data1; 00432 } 00433 inline SerializableType2 get_data2() 00434 { 00435 return data2; 00436 } 00437 inline SerializableType3 get_data3() 00438 { 00439 return data3; 00440 } 00441 inline SerializableType4 get_data4() 00442 { 00443 return data4; 00444 } 00445 inline void print( Debug& debug ) 00446 { 00447 data1.print( debug ); 00448 data2.print( debug ); 00449 data3.print( debug ); 00450 data4.print( debug ); 00451 } 00452 private: 00453 SerializableDynamicType1 data1; 00454 SerializableDynamicType2 data2; 00455 SerializableDynamicType3 data3; 00456 SerializableDynamicType4 data4; 00457 }; 00458 00459 template< typename Os_P, 00460 typename Radio_P, 00461 typename SerializableType1_P, 00462 typename SerializableType2_P, 00463 typename SerializableType3_P, 00464 typename SerializableType4_P, 00465 typename SerializableType5_P, 00466 typename Debug_p > 00467 class SerializableDynamicSet5_Type 00468 { 00469 public: 00470 typedef Os_P Os; 00471 typedef Radio_P Radio; 00472 typedef SerializableType1_P SerializableDynamicType1; 00473 typedef SerializableType2_P SerializableDynamicType2; 00474 typedef SerializableType3_P SerializableDynamicType3; 00475 typedef SerializableType4_P SerializableDynamicType4; 00476 typedef SerializableType5_P SerializableDynamicType5; 00477 typedef Debug_P Debug; 00478 typedef typename Radio::block_data_t block_data_t; 00479 typedef typename Radio::size_t size_t; 00480 typedef SerializableDynamicSet5_Type<Os, Radio, SerializableDynamicType1, SerializableDynamicType2, SerializableDynamicType3, SerializableDynamicType4, SerializableDynamicType5, Debug> self_type; 00481 SerializableDynamicSet5_Type() 00482 {} 00483 SerializableDynamicSet5_Type( const self_type& _d ) 00484 { 00485 *this = _d; 00486 } 00487 SerializableDynamicSet5_Type( block_data_t* buff, size_t offset = 0 ) 00488 { 00489 get_from_buffer( buff, offset ); 00490 } 00491 inline block_data_t* set_buffer_from( block_data_t* buff, size_t offset = 0 ) 00492 { 00493 uint8_t SERIALIZABLE_DYNAMIC_SET5_SIZE_POS = 0; 00494 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET5_SIZE_POS + sizeof( size_t ); 00495 uint8_t DYNAMIC_DATA2_POS = DYNAMIC_DATA1_POS + data1.get_buffer_size(); 00496 uint8_t DYNAMIC_DATA3_POS = DYNAMIC_DATA2_POS + data2.get_buffer_size(); 00497 uint8_t DYNAMIC_DATA4_POS = DYNAMIC_DATA3_POS + data3.get_buffer_size(); 00498 uint8_t DYNAMIC_DATA5_POS = DYNAMIC_DATA4_POS + data4.get_buffer_size(); 00499 data1.set_buffer_from( buff, DYNAMIC_DATA1_POS + offset ); 00500 data2.set_buffer_from( buff, DYNAMIC_DATA2_POS + offset ); 00501 data3.set_buffer_from( buff, DYNAMIC_DATA3_POS + offset ); 00502 data4.set_buffer_from( buff, DYNAMIC_DATA4_POS + offset ); 00503 data5.set_buffer_from( buff, DYNAMIC_DATA5_POS + offset ); 00504 return buff; 00505 } 00506 inline self_type get_from_buffer( block_data_t* buff, size_t offset = 0 ) 00507 { 00508 uint8_t SERIALIZABLE_DYNAMIC_SET5_SIZE_POS = 0; 00509 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET5_SIZE_POS + sizeof( size_t ); 00510 uint8_t DYNAMIC_DATA2_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA1_POS ) + DYNAMIC_DATA1_POS; 00511 uint8_t DYNAMIC_DATA3_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA2_POS ) + DYNAMIC_DATA2_POS; 00512 uint8_t DYNAMIC_DATA4_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA3_POS ) + DYNAMIC_DATA3_POS; 00513 uint8_t DYNAMIC_DATA5_POS = read<Os, block_data_t, size_t>( buff + offset + DYNAMIC_DATA4_POS ) + DYNAMIC_DATA4_POS; 00514 data1.get_from_buffer( buff, DYNAMIC_DATA1_POS + offset ); 00515 data2.get_from_buffer( buff, DYNAMIC_DATA2_POS + offset ); 00516 data3.get_from_buffer( buff, DYNAMIC_DATA3_POS + offset ); 00517 data4.get_from_buffer( buff, DYNAMIC_DATA4_POS + offset ); 00518 data5.get_from_buffer( buff, DYNAMIC_DATA5_POS + offset ); 00519 return *this; 00520 } 00521 inline size_t get_buffer_size() 00522 { 00523 uint8_t SERIALIZABLE_DYNAMIC_SET5_SIZE_POS = 0; 00524 uint8_t DYNAMIC_DATA1_POS = SERIALIZABLE_DYNAMIC_SET5_SIZE_POS + sizeof( size_t ); 00525 uint8_t DYNAMIC_DATA2_POS = DYNAMIC_DATA1_POS + data1.get_buffer_size(); 00526 uint8_t DYNAMIC_DATA3_POS = DYNAMIC_DATA2_POS + data2.get_buffer_size(); 00527 uint8_t DYNAMIC_DATA4_POS = DYNAMIC_DATA3_POS + data3.get_buffer_size(); 00528 uint8_t DYNAMIC_DATA5_POS = DYNAMIC_DATA4_POS + data4.get_buffer_size(); 00529 return DYNAMIC_DATA5_POS + data5.get_buffer_size(); 00530 } 00531 inline self_type& operator=( const self_type& _t ) 00532 { 00533 data1 = _t.data1; 00534 data2 = _t.data2; 00535 data3 = _t.data3; 00536 data4 = _t.data4; 00537 data5 = _t.data5; 00538 return *this; 00539 } 00540 inline void set_data1( const SerializableType1& _d ) 00541 { 00542 data1 = _d; 00543 } 00544 inline void set_data2( const SerializableType2& _d ) 00545 { 00546 data2 = _d; 00547 } 00548 inline void set_data3( const SerializableType3& _d ) 00549 { 00550 data3 = _d; 00551 } 00552 inline void set_data4( const SerializableType4& _d ) 00553 { 00554 data4 = _d; 00555 } 00556 inline void set_data5( const SerializableType5& _d ) 00557 { 00558 data5 = _d; 00559 } 00560 inline SerializableType1 get_data1() 00561 { 00562 return data1; 00563 } 00564 inline SerializableType2 get_data2() 00565 { 00566 return data2; 00567 } 00568 inline SerializableType3 get_data3() 00569 { 00570 return data3; 00571 } 00572 inline SerializableType4 get_data4() 00573 { 00574 return data4; 00575 } 00576 inline SerializableType5 get_data5() 00577 { 00578 return data5; 00579 } 00580 inline void print( Debug& debug ) 00581 { 00582 data1.print( debug ); 00583 data2.print( debug ); 00584 data3.print( debug ); 00585 data4.print( debug ); 00586 data5.print( debug ); 00587 } 00588 private: 00589 SerializableDynamicType1 data1; 00590 SerializableDynamicType2 data2; 00591 SerializableDynamicType3 data3; 00592 SerializableDynamicType4 data4; 00593 SerializableDynamicType5 data5; 00594 }; 00595 }