Changeset 2861 for code/branches/netp2/src/util/MultiType.h
- Timestamp:
- Mar 28, 2009, 11:19:06 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp2/src/util/MultiType.h
r2662 r2861 223 223 224 224 virtual void toString(std::ostream& outstream) const = 0; 225 226 virtual void importData( uint8_t*& mem )=0; 227 virtual void exportData( uint8_t*& mem ) const=0; 228 virtual uint8_t getSize() const=0; 225 229 226 230 MT_Type type_; //!< The type of the current value … … 320 324 template <typename T> inline bool isType() const { return false; } // Only works for specialized values - see below 321 325 std::string getTypename() const; 326 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); } 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); } 331 /** @brief Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT */ 332 inline uint8_t*& operator << (uint8_t*& mem) { importData(mem); return mem; } 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); } 322 335 323 336 /** @brief Checks whether the value is a default one. */
Note: See TracChangeset
for help on using the changeset viewer.