Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2009, 9:20:57 PM (16 years ago)
Author:
landauf
Message:

merged netp3 branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/util/MultiType.h

    r2662 r3084  
    8080    enum MT_Type
    8181    {
    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
    106106    };
    107107
     
    223223
    224224            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;
    225229
    226230            MT_Type type_;          //!< The type of the current value
     
    320324            template <typename T> inline bool isType()                  const { return false; } // Only works for specialized values - see below
    321325            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                       exportData(uint8_t*& mem) const { assert(sizeof(MT_Type)<=8); *(uint8_t*)(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(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                       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            /** @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) const { exportData(mem); }
     335            inline uint32_t                   getNetworkSize() const { assert(this->value_); return this->value_->getSize() + sizeof(uint8_t); }
    322336
    323337            /** @brief Checks whether the value is a default one. */
Note: See TracChangeset for help on using the changeset viewer.