Changeset 2949 for code/branches/netp2/src/util
- Timestamp:
- May 2, 2009, 4:19:43 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp2/src/util/MultiType.h
r2937 r2949 80 80 enum MT_Type 81 81 { 82 MT_null ,83 MT_char ,84 MT_uchar ,85 MT_short ,86 MT_ushort ,87 MT_int ,88 MT_uint ,89 MT_long ,90 MT_ulong ,91 MT_longlong ,92 MT_ulonglong ,93 MT_float ,94 MT_double ,95 MT_longdouble ,96 MT_bool ,97 MT_void ,98 MT_string ,99 MT_vector2 ,100 MT_vector3 ,101 MT_vector4 ,102 MT_colourvalue ,103 MT_quaternion ,104 MT_radian ,105 MT_degree 82 MT_null=0, 83 MT_char=1, 84 MT_uchar=2, 85 MT_short=3, 86 MT_ushort=4, 87 MT_int=5, 88 MT_uint=6, 89 MT_long=7, 90 MT_ulong=8, 91 MT_longlong=9, 92 MT_ulonglong=10, 93 MT_float=11, 94 MT_double=12, 95 MT_longdouble=13, 96 MT_bool=14, 97 MT_void=15, 98 MT_string=16, 99 MT_vector2=17, 100 MT_vector3=18, 101 MT_vector4=19, 102 MT_colourvalue=20, 103 MT_quaternion=21, 104 MT_radian=22, 105 MT_degree=23 106 106 }; 107 107 … … 326 326 327 327 /** @brief Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT */ 328 inline void importData(uint8_t*& mem) { assert(sizeof(MT_Type)<=8); *(uint8_t*)(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->importData(mem); }328 inline void exportData(uint8_t*& mem) const { assert(sizeof(MT_Type)<=8); *(uint8_t*)(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); } 329 329 /** @brief Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT */ 330 inline void exportData(uint8_t*& mem) { assert(sizeof(MT_Type)<=8); this->setType(*(uint8_t*)mem); mem+=sizeof(uint8_t); this->value_->exportData(mem); }330 inline void importData(uint8_t*& mem) { assert(sizeof(MT_Type)<=8); this->setType(static_cast<MT_Type>(*(uint8_t*)mem)); mem+=sizeof(uint8_t); this->value_->importData(mem); } 331 331 /** @brief Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT */ 332 332 inline uint8_t*& operator << (uint8_t*& mem) { importData(mem); return mem; } 333 333 /** @brief Loads the value of the MT to a bytestream and increases pointer to bytestream by size of MT */ 334 inline void operator >> (uint8_t*& mem) { exportData(mem); }335 inline uint32_t getNetworkSize() { assert(this->value_); return this->value_->getSize() + sizeof(uint8_t); }334 inline void operator >> (uint8_t*& mem) const { exportData(mem); } 335 inline uint32_t getNetworkSize() const { assert(this->value_); return this->value_->getSize() + sizeof(uint8_t); } 336 336 337 337 /** @brief Checks whether the value is a default one. */
Note: See TracChangeset
for help on using the changeset viewer.