Changeset 3146
- Timestamp:
- Jun 11, 2009, 9:40:24 PM (15 years ago)
- Location:
- code/branches/pch/src
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pch/src/core/BaseObject.h
r2662 r3146 45 45 46 46 #include <map> 47 #include <list> 47 48 48 49 #include "CorePrereqs.h" -
code/branches/pch/src/core/CommandExecutor.h
r3035 r3146 33 33 34 34 #include <map> 35 35 #include <set> 36 36 #include "CommandEvaluation.h" 37 37 -
code/branches/pch/src/util/CRC32.h
r2710 r3146 31 31 32 32 #include "UtilPrereqs.h" 33 #include <iostream>34 33 35 34 namespace orxonox -
code/branches/pch/src/util/Clipboard.cc
r2710 r3146 112 112 namespace orxonox 113 113 { 114 st d::string clipboard = ""; //!< Keeps the text of our internal clipboard114 static std::string clipboard = ""; //!< Keeps the text of our internal clipboard 115 115 116 116 /** … … 129 129 @return The text 130 130 */ 131 std::stringfromClipboard()131 const std::string& fromClipboard() 132 132 { 133 133 return clipboard; -
code/branches/pch/src/util/Clipboard.h
r2171 r3146 43 43 44 44 #include "UtilPrereqs.h" 45 46 45 #include <string> 47 46 -
code/branches/pch/src/util/Convert.h
r3145 r3146 40 40 #include <string> 41 41 #include <sstream> 42 #include <istream>43 #include <ostream>44 42 #include <typeinfo> 45 43 -
code/branches/pch/src/util/Debug.h
r2171 r3146 63 63 #include "UtilPrereqs.h" 64 64 65 #include <stdio.h>66 67 65 #include "OutputHandler.h" 68 66 … … 73 71 @return The soft debug level 74 72 */ 75 staticinline int getSoftDebugLevel()73 inline int getSoftDebugLevel() 76 74 { 77 75 return OutputHandler::getSoftDebugLevel(); -
code/branches/pch/src/util/ExprParser.cc
r2171 r3146 35 35 #include <cmath> 36 36 #include <cstring> 37 #include < stdlib.h>37 #include <cstdlib> 38 38 39 39 // macros for easier if, else statements -
code/branches/pch/src/util/Math.cc
r3049 r3146 35 35 36 36 #include <OgrePlane.h> 37 37 38 #include "MathConvert.h" 38 39 #include "SubString.h" 39 40 // Do not remove this include to avoid linker errors. 40 // Do not remove this include, it avoids linker errors. 41 41 #include "mbool.h" 42 42 -
code/branches/pch/src/util/Math.h
r3128 r3146 37 37 #include "UtilPrereqs.h" 38 38 39 #include <ostream>40 39 #include <string> 41 40 #include <cmath> 42 #include <boost/static_assert.hpp>43 41 44 42 #include <OgreMath.h> … … 46 44 #include <OgreVector3.h> 47 45 #include <OgreVector4.h> 48 #include <OgreMatrix3.h>49 #include <OgreMatrix4.h>50 46 #include <OgreQuaternion.h> 51 47 #include <OgreColourValue.h> … … 207 203 template <> inline orxonox::Quaternion zeroise<orxonox::Quaternion>() { return orxonox::Quaternion (0, 0, 0, 0); } 208 204 205 //! Provides zero value symbols that can be returned as reference 206 template <typename T> 207 struct NilValue 208 { 209 inline operator const T&() const 210 { 211 return value; 212 } 213 static T value; 214 }; 215 template <typename T> 216 T NilValue<T>::value = zeroise<T>(); 217 209 218 /** 210 219 @brief Interpolates between two values for a time between 0 and 1. … … 215 224 */ 216 225 template <typename T> 217 T interpolate(float time, const T& start, const T& end)226 inline T interpolate(float time, const T& start, const T& end) 218 227 { 219 228 return time * (end - start) + start; … … 228 237 */ 229 238 template <typename T> 230 T interpolateSmooth(float time, const T& start, const T& end)239 inline T interpolateSmooth(float time, const T& start, const T& end) 231 240 { 232 241 return (-2 * (end - start) * cube(time)) + (3 * (end - start) * square(time)) + start; … … 273 282 { 274 283 public: 275 IntVector2() : x(0), y(0) { }276 IntVector2(int _x, int _y) : x(_x), y(_y) { }277 int x;278 int y;284 IntVector2() : x(0), y(0) { } 285 IntVector2(int _x, int _y) : x(_x), y(_y) { } 286 int x; 287 int y; 279 288 }; 280 289 … … 282 291 { 283 292 public: 284 IntVector3() : x(0), y(0), z(0) { }285 IntVector3(int _x, int _y, int _z) : x(_x), y(_y), z(_z) { }286 int x;287 int y;288 int z;293 IntVector3() : x(0), y(0), z(0) { } 294 IntVector3(int _x, int _y, int _z) : x(_x), y(_y), z(_z) { } 295 int x; 296 int y; 297 int z; 289 298 }; 290 299 } -
code/branches/pch/src/util/MultiType.cc
r2662 r3146 159 159 } 160 160 161 MultiType::operator char() const { return (this->value_) ? ((this->value_->type_ == MT_char ) ? ( (MT_Value<char> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */162 MultiType::operator unsigned char() const { return (this->value_) ? ((this->value_->type_ == MT_uchar ) ? ( (MT_Value<unsigned char> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */163 MultiType::operator short() const { return (this->value_) ? ((this->value_->type_ == MT_short ) ? ( (MT_Value<short> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */164 MultiType::operator unsigned short() const { return (this->value_) ? ((this->value_->type_ == MT_ushort ) ? ( (MT_Value<unsigned short> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */165 MultiType::operator int() const { return (this->value_) ? ((this->value_->type_ == MT_int ) ? ( (MT_Value<int> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */166 MultiType::operator unsigned int() const { return (this->value_) ? ((this->value_->type_ == MT_uint ) ? ( (MT_Value<unsigned int> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */167 MultiType::operator long() const { return (this->value_) ? ((this->value_->type_ == MT_long ) ? ( (MT_Value<long> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */168 MultiType::operator unsigned long() const { return (this->value_) ? ((this->value_->type_ == MT_ulong ) ? ( (MT_Value<unsigned long> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */169 MultiType::operator long long() const { return (this->value_) ? ((this->value_->type_ == MT_longlong ) ? ( (MT_Value<long long> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */170 MultiType::operator unsigned long long() const { return (this->value_) ? ((this->value_->type_ == MT_ulonglong ) ? ( (MT_Value<unsigned long long> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */171 MultiType::operator float() const { return (this->value_) ? ((this->value_->type_ == MT_float ) ? ( (MT_Value<float> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */172 MultiType::operator double() const { return (this->value_) ? ((this->value_->type_ == MT_double ) ? ( (MT_Value<double> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */173 MultiType::operator long double() const { return (this->value_) ? ((this->value_->type_ == MT_longdouble ) ? ( (MT_Value<long double> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */174 MultiType::operator bool() const { return (this->value_) ? ((this->value_->type_ == MT_bool ) ? ( (MT_Value<bool> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */175 MultiType::operator void*() const { return (this->value_) ? ((this->value_->type_ == MT_void ) ? ( (MT_Value<void*> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */176 MultiType::operator std::string() const { return (this->value_) ? ((this->value_->type_ == MT_string ) ? ( (MT_Value<std::string> *)this->value_)->value_ : (*this->value_)) : zeroise<std::string>(); } /** @brief Returns the current value, converted to the requested type. */177 MultiType::operator orxonox::Vector2() const { return (this->value_) ? ((this->value_->type_ == MT_vector2 ) ? ( (MT_Value<orxonox::Vector2> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector2>(); } /** @brief Returns the current value, converted to the requested type. */178 MultiType::operator orxonox::Vector3() const { return (this->value_) ? ((this->value_->type_ == MT_vector3 ) ? ( (MT_Value<orxonox::Vector3> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector3>(); } /** @brief Returns the current value, converted to the requested type. */179 MultiType::operator orxonox::Vector4() const { return (this->value_) ? ((this->value_->type_ == MT_vector4 ) ? ( (MT_Value<orxonox::Vector4> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector4>(); } /** @brief Returns the current value, converted to the requested type. */180 MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_colourvalue) ? ( (MT_Value<orxonox::ColourValue>*)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::ColourValue>(); } /** @brief Returns the current value, converted to the requested type. */181 MultiType::operator orxonox::Quaternion() const { return (this->value_) ? ((this->value_->type_ == MT_quaternion ) ? ( (MT_Value<orxonox::Quaternion> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Quaternion>(); } /** @brief Returns the current value, converted to the requested type. */182 MultiType::operator orxonox::Radian() const { return (this->value_) ? ((this->value_->type_ == MT_radian ) ? ( (MT_Value<orxonox::Radian> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Radian>(); } /** @brief Returns the current value, converted to the requested type. */183 MultiType::operator orxonox::Degree() const { return (this->value_) ? ((this->value_->type_ == MT_degree ) ? ( (MT_Value<orxonox::Degree> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Degree>(); } /** @brief Returns the current value, converted to the requested type. */161 MultiType::operator char() const { return (this->value_) ? ((this->value_->type_ == MT_char ) ? (static_cast<MT_Value<char> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 162 MultiType::operator unsigned char() const { return (this->value_) ? ((this->value_->type_ == MT_uchar ) ? (static_cast<MT_Value<unsigned char> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 163 MultiType::operator short() const { return (this->value_) ? ((this->value_->type_ == MT_short ) ? (static_cast<MT_Value<short> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 164 MultiType::operator unsigned short() const { return (this->value_) ? ((this->value_->type_ == MT_ushort ) ? (static_cast<MT_Value<unsigned short> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 165 MultiType::operator int() const { return (this->value_) ? ((this->value_->type_ == MT_int ) ? (static_cast<MT_Value<int> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 166 MultiType::operator unsigned int() const { return (this->value_) ? ((this->value_->type_ == MT_uint ) ? (static_cast<MT_Value<unsigned int> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 167 MultiType::operator long() const { return (this->value_) ? ((this->value_->type_ == MT_long ) ? (static_cast<MT_Value<long> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 168 MultiType::operator unsigned long() const { return (this->value_) ? ((this->value_->type_ == MT_ulong ) ? (static_cast<MT_Value<unsigned long> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 169 MultiType::operator long long() const { return (this->value_) ? ((this->value_->type_ == MT_longlong ) ? (static_cast<MT_Value<long long> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 170 MultiType::operator unsigned long long() const { return (this->value_) ? ((this->value_->type_ == MT_ulonglong ) ? (static_cast<MT_Value<unsigned long long> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 171 MultiType::operator float() const { return (this->value_) ? ((this->value_->type_ == MT_float ) ? (static_cast<MT_Value<float> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 172 MultiType::operator double() const { return (this->value_) ? ((this->value_->type_ == MT_double ) ? (static_cast<MT_Value<double> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 173 MultiType::operator long double() const { return (this->value_) ? ((this->value_->type_ == MT_longdouble ) ? (static_cast<MT_Value<long double> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 174 MultiType::operator bool() const { return (this->value_) ? ((this->value_->type_ == MT_bool ) ? (static_cast<MT_Value<bool> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 175 MultiType::operator void*() const { return (this->value_) ? ((this->value_->type_ == MT_void ) ? (static_cast<MT_Value<void*> *>(this->value_))->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 176 MultiType::operator std::string() const { return (this->value_) ? ((this->value_->type_ == MT_string ) ? (static_cast<MT_Value<std::string> *>(this->value_))->value_ : (*this->value_)) : NilValue<std::string>(); } /** @brief Returns the current value, converted to the requested type. */ 177 MultiType::operator orxonox::Vector2() const { return (this->value_) ? ((this->value_->type_ == MT_vector2 ) ? (static_cast<MT_Value<orxonox::Vector2> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector2>(); } /** @brief Returns the current value, converted to the requested type. */ 178 MultiType::operator orxonox::Vector3() const { return (this->value_) ? ((this->value_->type_ == MT_vector3 ) ? (static_cast<MT_Value<orxonox::Vector3> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector3>(); } /** @brief Returns the current value, converted to the requested type. */ 179 MultiType::operator orxonox::Vector4() const { return (this->value_) ? ((this->value_->type_ == MT_vector4 ) ? (static_cast<MT_Value<orxonox::Vector4> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector4>(); } /** @brief Returns the current value, converted to the requested type. */ 180 MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_colourvalue) ? (static_cast<MT_Value<orxonox::ColourValue>*>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::ColourValue>(); } /** @brief Returns the current value, converted to the requested type. */ 181 MultiType::operator orxonox::Quaternion() const { return (this->value_) ? ((this->value_->type_ == MT_quaternion ) ? (static_cast<MT_Value<orxonox::Quaternion> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Quaternion>(); } /** @brief Returns the current value, converted to the requested type. */ 182 MultiType::operator orxonox::Radian() const { return (this->value_) ? ((this->value_->type_ == MT_radian ) ? (static_cast<MT_Value<orxonox::Radian> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Radian>(); } /** @brief Returns the current value, converted to the requested type. */ 183 MultiType::operator orxonox::Degree() const { return (this->value_) ? ((this->value_->type_ == MT_degree ) ? (static_cast<MT_Value<orxonox::Degree> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Degree>(); } /** @brief Returns the current value, converted to the requested type. */ 184 184 185 185 template <> void MultiType::createNewValueContainer(const char& value) { this->value_ = new MT_Value<char> (value, MT_char ); } /** @brief Creates a new value container for the given type. */ -
code/branches/pch/src/util/MultiType.h
r3084 r3146 69 69 #include "UtilPrereqs.h" 70 70 71 #include <boost/static_assert.hpp> 72 73 #include "Math.h" 71 #include <cassert> 72 #include <string> 73 #include <OgreVector2.h> 74 #include <OgreVector3.h> 75 #include <OgreVector4.h> 76 #include <OgreQuaternion.h> 77 #include <OgreColourValue.h> 74 78 75 79 namespace orxonox … … 441 445 template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); } 442 446 /** @brief Creates a new value container (works only with specialized types). */ 443 template <typename T> void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); return false; }447 template <typename T> void createNewValueContainer(const T& value) { /* STATIC ASSERT */ *****value; return false; } 444 448 445 449 MT_ValueBase* value_; //!< A pointer to the value container -
code/branches/pch/src/util/MultiTypeValue.h
r3142 r3146 38 38 39 39 #include "UtilPrereqs.h" 40 41 #include <cassert> 40 42 #include "MathConvert.h" 41 43 #include "MultiType.h" 42 44 #include "Serialise.h" 43 #include <cassert>44 45 45 46 namespace orxonox -
code/branches/pch/src/util/OutputBuffer.cc
r2710 r3146 44 44 void OutputBuffer::registerListener(OutputBufferListener* listener) 45 45 { 46 this->listeners_. insert(this->listeners_.end(),listener);46 this->listeners_.push_back(listener); 47 47 } 48 48 … … 53 53 void OutputBuffer::unregisterListener(OutputBufferListener* listener) 54 54 { 55 for (std:: list<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); )55 for (std::vector<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ) 56 56 { 57 57 if ((*it) == listener) 58 this->listeners_.erase(it++);58 it = this->listeners_.erase(it); 59 59 else 60 60 ++it; … … 127 127 void OutputBuffer::callListeners() 128 128 { 129 for (std:: list<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)129 for (std::vector<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it) 130 130 (*it)->outputChanged(); 131 131 } -
code/branches/pch/src/util/OutputBuffer.h
r2171 r3146 43 43 #define _OutputBuffer_H__ 44 44 45 #include <list> 45 #include "UtilPrereqs.h" 46 47 #include <vector> 46 48 #include <sstream> 47 #include <iostream>48 49 #include "UtilPrereqs.h"50 49 51 50 namespace orxonox … … 167 166 void callListeners(); 168 167 169 std::stringstream stream_; //!< The stringstream that stores the assigned text170 std:: list<OutputBufferListener*> listeners_; //!< A list of all listeners168 std::stringstream stream_; //!< The stringstream that stores the assigned text 169 std::vector<OutputBufferListener*> listeners_; //!< A list of all listeners 171 170 }; 172 171 } -
code/branches/pch/src/util/SignalHandler.cc
r3068 r3146 33 33 34 34 #include "SignalHandler.h" 35 #include "Debug.h"36 35 37 36 #include <iostream> 38 37 #include <cstdlib> 39 38 #include <cstring> 39 #include "Debug.h" 40 40 41 41 namespace orxonox -
code/branches/pch/src/util/Sleep.cc
r2774 r3146 43 43 { 44 44 if (microseconds < 1000) 45 COUT(2) << "Warning: Windows can 45 COUT(2) << "Warning: Windows cannot sleep less than 1ms, ignoring" << std::endl; 46 46 Sleep(microseconds / 1000); 47 47 } -
code/branches/pch/src/util/String.cc
r2662 r3146 35 35 36 36 #include <cctype> 37 #include <iostream>38 39 37 #include "Convert.h" 40 38 #include "Math.h" -
code/branches/pch/src/util/String.h
r2171 r3146 36 36 37 37 #include "UtilPrereqs.h" 38 39 38 #include <string> 40 #include <sstream>41 39 42 40 namespace orxonox -
code/branches/pch/src/util/SubString.cc
r3089 r3146 39 39 40 40 #include "SubString.h" 41 #include < stdio.h>41 #include <cstdio> 42 42 43 43 namespace orxonox -
code/branches/pch/src/util/mbool.h
r2662 r3146 36 36 struct _UtilExport mbool 37 37 { 38 // friend Synchronisable::registerVariable<>()39 38 public: 40 39 inline mbool(bool value = false)
Note: See TracChangeset
for help on using the changeset viewer.