Changeset 7908 for code/forks/sandbox_light/src/libraries/util
- Timestamp:
- Feb 17, 2011, 5:47:22 AM (14 years ago)
- Location:
- code/forks/sandbox_light/src/libraries/util
- Files:
-
- 10 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/forks/sandbox_light/src/libraries/util/CMakeLists.txt
r7449 r7908 21 21 Clock.cc 22 22 Exception.cc 23 ExprParser.cc24 23 Math.cc 25 24 MultiType.cc 26 Scope.cc27 25 StringUtils.cc 28 26 COMPILATION_BEGIN StableCompilation.cc 29 Clipboard.cc30 27 Convert.cc 31 28 CRC32.cc 32 29 OutputHandler.cc 33 ScopedSingletonManager.cc34 30 SharedPtr.cc 35 31 SignalHandler.cc … … 54 50 FIND_HEADER_FILES 55 51 LINK_LIBRARIES 56 ${CEGUI_LIBRARY} 57 ${OGRE_LIBRARY} 52 ogremath_orxonox 58 53 SOURCE_FILES 59 54 ${UTIL_SRC_FILES} -
code/forks/sandbox_light/src/libraries/util/Clock.cc
r7401 r7908 28 28 29 29 #include "Clock.h" 30 #include < OgreTimer.h>30 #include <ogremath/OgreTimer.h> 31 31 32 32 namespace orxonox -
code/forks/sandbox_light/src/libraries/util/Exception.cc
r7401 r7908 35 35 #include "Exception.h" 36 36 37 #include <CEGUIExceptions.h>38 37 #include "Debug.h" 39 38 … … 99 98 return ex.what(); 100 99 } 101 catch (const CEGUI::Exception& ex)102 {103 #if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6104 return GeneralException(ex.getMessage().c_str()).getDescription();105 #else106 return GeneralException(ex.getMessage().c_str(), ex.getLine(),107 ex.getFileName().c_str(), ex.getName().c_str()).getDescription();108 #endif109 }110 100 catch (...) 111 101 { -
code/forks/sandbox_light/src/libraries/util/Math.cc
r7401 r7908 34 34 #include "Math.h" 35 35 36 #include < OgrePlane.h>36 #include <ogremath/OgrePlane.h> 37 37 38 38 #include "MathConvert.h" -
code/forks/sandbox_light/src/libraries/util/Math.h
r7427 r7908 47 47 #include <cstdlib> 48 48 49 #include < OgreMath.h>50 #include < OgreVector2.h>51 #include < OgreVector3.h>52 #include < OgreVector4.h>53 #include < OgreQuaternion.h>54 #include < OgreColourValue.h>49 #include <ogremath/OgreMath.h> 50 #include <ogremath/OgreVector2.h> 51 #include <ogremath/OgreVector3.h> 52 #include <ogremath/OgreVector4.h> 53 #include <ogremath/OgreQuaternion.h> 54 #include <ogremath/OgreColourValue.h> 55 55 56 56 // Certain headers might define unwanted macros... -
code/forks/sandbox_light/src/libraries/util/MultiType.h
r7401 r7908 100 100 #include <cassert> 101 101 #include <string> 102 #include < OgreVector2.h>103 #include < OgreVector3.h>104 #include < OgreVector4.h>105 #include < OgreQuaternion.h>106 #include < OgreColourValue.h>102 #include <ogremath/OgreVector2.h> 103 #include <ogremath/OgreVector3.h> 104 #include <ogremath/OgreVector4.h> 105 #include <ogremath/OgreQuaternion.h> 106 #include <ogremath/OgreColourValue.h> 107 107 #include <loki/TypeTraits.h> 108 108 #include "mbool.h" … … 260 260 261 261 virtual void toString(std::ostream& outstream) const = 0; 262 263 virtual void importData( uint8_t*& mem )=0;264 virtual void exportData( uint8_t*& mem ) const=0;265 virtual uint8_t getSize() const=0;266 262 267 263 MT_Type::Value type_; ///< The type of the current value … … 374 370 std::string getTypename() const; 375 371 376 /// Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT377 inline void exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *static_cast<uint8_t*>(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }378 /// Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT379 inline void importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*static_cast<uint8_t*>(mem))); mem+=sizeof(uint8_t); this->value_->importData(mem); }380 /// Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT381 inline uint8_t*& operator << (uint8_t*& mem) { importData(mem); return mem; }382 /// Loads the value of the MT to a bytestream and increases pointer to bytestream by size of MT383 inline void operator >> (uint8_t*& mem) const { exportData(mem); }384 inline uint32_t getNetworkSize() const { assert(this->value_); return this->value_->getSize() + sizeof(uint8_t); }385 386 372 /// Checks whether the value is a default one (assigned after a failed conversion) 387 373 bool hasDefaultValue() const { return this->value_->hasDefaultValue(); } -
code/forks/sandbox_light/src/libraries/util/MultiTypeValue.h
r7401 r7908 43 43 #include "MathConvert.h" 44 44 #include "MultiType.h" 45 #include "Serialise.h"46 45 47 46 namespace orxonox … … 155 154 inline void toString(std::ostream& outstream) const { outstream << this->value_; } 156 155 157 /// loads data from the bytestream (mem) into the MT and increases the bytestream pointer by the size of the data158 inline void importData( uint8_t*& mem ) { loadAndIncrease( /*(const T&)*/this->value_, mem ); }159 /// saves data from the MT into the bytestream (mem) and increases the bytestream pointer by the size of the data160 inline void exportData( uint8_t*& mem ) const { saveAndIncrease( /*(const T&)*/this->value_, mem ); }161 /// returns the size of the data that would be saved by exportData162 inline uint8_t getSize() const { return returnSize( this->value_ ); }163 164 156 T value_; ///< The stored value 165 157 }; 166 167 // Import / Export specialisation168 // ColourValue169 template <> inline void MT_Value<ColourValue>::importData( uint8_t*& mem )170 {171 loadAndIncrease( this->value_.r, mem );172 loadAndIncrease( this->value_.g, mem );173 loadAndIncrease( this->value_.b, mem );174 loadAndIncrease( this->value_.a, mem );175 }176 template <> inline void MT_Value<ColourValue>::exportData( uint8_t*& mem ) const177 {178 saveAndIncrease( this->value_.r, mem );179 saveAndIncrease( this->value_.g, mem );180 saveAndIncrease( this->value_.b, mem );181 saveAndIncrease( this->value_.a, mem );182 }183 template <> inline uint8_t MT_Value<ColourValue>::getSize() const184 {185 return 4*returnSize(this->value_.r);186 }187 // Ogre::Quaternion188 template <> inline void MT_Value<Ogre::Quaternion>::importData( uint8_t*& mem )189 {190 loadAndIncrease( this->value_.x, mem );191 loadAndIncrease( this->value_.y, mem );192 loadAndIncrease( this->value_.z, mem );193 loadAndIncrease( this->value_.w, mem );194 }195 template <> inline void MT_Value<Ogre::Quaternion>::exportData( uint8_t*& mem ) const196 {197 saveAndIncrease( this->value_.x, mem );198 saveAndIncrease( this->value_.y, mem );199 saveAndIncrease( this->value_.z, mem );200 saveAndIncrease( this->value_.w, mem );201 }202 template <> inline uint8_t MT_Value<Ogre::Quaternion>::getSize() const203 {204 return 4*returnSize(this->value_.x);205 }206 // Ogre::Vector2207 template <> inline void MT_Value<Ogre::Vector2>::importData( uint8_t*& mem )208 {209 loadAndIncrease( this->value_.x, mem );210 loadAndIncrease( this->value_.y, mem );211 }212 template <> inline void MT_Value<Ogre::Vector2>::exportData( uint8_t*& mem ) const213 {214 saveAndIncrease( this->value_.x, mem );215 saveAndIncrease( this->value_.y, mem );216 }217 template <> inline uint8_t MT_Value<Ogre::Vector2>::getSize() const218 {219 return 2*returnSize(this->value_.x);220 }221 // Ogre::Vector3222 template <> inline void MT_Value<Ogre::Vector3>::importData( uint8_t*& mem )223 {224 loadAndIncrease( this->value_.x, mem );225 loadAndIncrease( this->value_.y, mem );226 loadAndIncrease( this->value_.z, mem );227 }228 template <> inline void MT_Value<Ogre::Vector3>::exportData( uint8_t*& mem ) const229 {230 saveAndIncrease( this->value_.x, mem );231 saveAndIncrease( this->value_.y, mem );232 saveAndIncrease( this->value_.z, mem );233 }234 template <> inline uint8_t MT_Value<Ogre::Vector3>::getSize() const235 {236 return 3*returnSize(this->value_.x);237 }238 // Ogre::Vector4239 template <> inline void MT_Value<Ogre::Vector4>::importData( uint8_t*& mem )240 {241 loadAndIncrease( this->value_.x, mem );242 loadAndIncrease( this->value_.y, mem );243 loadAndIncrease( this->value_.z, mem );244 loadAndIncrease( this->value_.w, mem );245 }246 template <> inline void MT_Value<Ogre::Vector4>::exportData( uint8_t*& mem ) const247 {248 saveAndIncrease( this->value_.x, mem );249 saveAndIncrease( this->value_.y, mem );250 saveAndIncrease( this->value_.z, mem );251 saveAndIncrease( this->value_.w, mem );252 }253 template <> inline uint8_t MT_Value<Ogre::Vector4>::getSize() const254 {255 return 4*returnSize(this->value_.x);256 }257 template <> inline void MT_Value<void*>::importData( uint8_t*& mem )258 {259 assert(0);260 }261 template <> inline void MT_Value<void*>::exportData( uint8_t*& mem ) const262 {263 assert(0);264 }265 template <> inline uint8_t MT_Value<void*>::getSize() const266 {267 assert(0); return 0;268 }269 158 } 270 159 -
code/forks/sandbox_light/src/libraries/util/UtilPrereqs.h
r6417 r7908 64 64 namespace orxonox 65 65 { 66 namespace ScopeID67 {68 //!A list of available scopes for the Scope template.69 enum Value70 {71 Root,72 Graphics73 };74 }75 66 } 76 67 … … 83 74 class Clock; 84 75 class Exception; 85 class ExprParser;86 76 class IntVector2; 87 77 class IntVector3; … … 89 79 class OutputHandler; 90 80 class OutputListener; 91 template <ScopeID::Value>92 class Scope;93 template <class, ScopeID::Value>94 class ScopedSingleton;95 class ScopeListener;96 81 class SignalHandler; 97 82 template <class T>
Note: See TracChangeset
for help on using the changeset viewer.