Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3146


Ignore:
Timestamp:
Jun 11, 2009, 9:40:24 PM (15 years ago)
Author:
rgrieder
Message:

Found another few unnecessary includes in util (and added two others that followed due to this change).

Location:
code/branches/pch/src
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pch/src/core/BaseObject.h

    r2662 r3146  
    4545
    4646#include <map>
     47#include <list>
    4748
    4849#include "CorePrereqs.h"
  • code/branches/pch/src/core/CommandExecutor.h

    r3035 r3146  
    3333
    3434#include <map>
    35 
     35#include <set>
    3636#include "CommandEvaluation.h"
    3737
  • code/branches/pch/src/util/CRC32.h

    r2710 r3146  
    3131
    3232#include "UtilPrereqs.h"
    33 #include <iostream>
    3433
    3534namespace orxonox
  • code/branches/pch/src/util/Clipboard.cc

    r2710 r3146  
    112112namespace orxonox
    113113{
    114     std::string clipboard = ""; //!< Keeps the text of our internal clipboard
     114    static std::string clipboard = ""; //!< Keeps the text of our internal clipboard
    115115
    116116    /**
     
    129129        @return The text
    130130    */
    131     std::string fromClipboard()
     131    const std::string& fromClipboard()
    132132    {
    133133        return clipboard;
  • code/branches/pch/src/util/Clipboard.h

    r2171 r3146  
    4343
    4444#include "UtilPrereqs.h"
    45 
    4645#include <string>
    4746
  • code/branches/pch/src/util/Convert.h

    r3145 r3146  
    4040#include <string>
    4141#include <sstream>
    42 #include <istream>
    43 #include <ostream>
    4442#include <typeinfo>
    4543
  • code/branches/pch/src/util/Debug.h

    r2171 r3146  
    6363#include "UtilPrereqs.h"
    6464
    65 #include <stdio.h>
    66 
    6765#include "OutputHandler.h"
    6866
     
    7371        @return The soft debug level
    7472    */
    75     static inline int getSoftDebugLevel()
     73    inline int getSoftDebugLevel()
    7674    {
    7775        return OutputHandler::getSoftDebugLevel();
  • code/branches/pch/src/util/ExprParser.cc

    r2171 r3146  
    3535#include <cmath>
    3636#include <cstring>
    37 #include <stdlib.h>
     37#include <cstdlib>
    3838
    3939// macros for easier if, else statements
  • code/branches/pch/src/util/Math.cc

    r3049 r3146  
    3535
    3636#include <OgrePlane.h>
     37
    3738#include "MathConvert.h"
    3839#include "SubString.h"
    39 
    40 // Do not remove this include to avoid linker errors.
     40// Do not remove this include, it avoids linker errors.
    4141#include "mbool.h"
    4242
  • code/branches/pch/src/util/Math.h

    r3128 r3146  
    3737#include "UtilPrereqs.h"
    3838
    39 #include <ostream>
    4039#include <string>
    4140#include <cmath>
    42 #include <boost/static_assert.hpp>
    4341
    4442#include <OgreMath.h>
     
    4644#include <OgreVector3.h>
    4745#include <OgreVector4.h>
    48 #include <OgreMatrix3.h>
    49 #include <OgreMatrix4.h>
    5046#include <OgreQuaternion.h>
    5147#include <OgreColourValue.h>
     
    207203    template <> inline orxonox::Quaternion  zeroise<orxonox::Quaternion>()  { return orxonox::Quaternion (0, 0, 0, 0); }
    208204
     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
    209218    /**
    210219        @brief Interpolates between two values for a time between 0 and 1.
     
    215224    */
    216225    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)
    218227    {
    219228        return time * (end - start) + start;
     
    228237    */
    229238    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)
    231240    {
    232241        return (-2 * (end - start) * cube(time)) + (3 * (end - start) * square(time)) + start;
     
    273282    {
    274283    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;
    279288    };
    280289
     
    282291    {
    283292    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;
    289298    };
    290299}
  • code/branches/pch/src/util/MultiType.cc

    r2662 r3146  
    159159    }
    160160
    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. */
    184184
    185185    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  
    6969#include "UtilPrereqs.h"
    7070
    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>
    7478
    7579namespace orxonox
     
    441445            template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); }
    442446            /** @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; }
    444448
    445449            MT_ValueBase* value_; //!< A pointer to the value container
  • code/branches/pch/src/util/MultiTypeValue.h

    r3142 r3146  
    3838
    3939#include "UtilPrereqs.h"
     40
     41#include <cassert>
    4042#include "MathConvert.h"
    4143#include "MultiType.h"
    4244#include "Serialise.h"
    43 #include <cassert>
    4445
    4546namespace orxonox
  • code/branches/pch/src/util/OutputBuffer.cc

    r2710 r3146  
    4444    void OutputBuffer::registerListener(OutputBufferListener* listener)
    4545    {
    46         this->listeners_.insert(this->listeners_.end(), listener);
     46        this->listeners_.push_back(listener);
    4747    }
    4848
     
    5353    void OutputBuffer::unregisterListener(OutputBufferListener* listener)
    5454    {
    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(); )
    5656        {
    5757            if ((*it) == listener)
    58                 this->listeners_.erase(it++);
     58                it = this->listeners_.erase(it);
    5959            else
    6060                ++it;
     
    127127    void OutputBuffer::callListeners()
    128128    {
    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)
    130130            (*it)->outputChanged();
    131131    }
  • code/branches/pch/src/util/OutputBuffer.h

    r2171 r3146  
    4343#define _OutputBuffer_H__
    4444
    45 #include <list>
     45#include "UtilPrereqs.h"
     46
     47#include <vector>
    4648#include <sstream>
    47 #include <iostream>
    48 
    49 #include "UtilPrereqs.h"
    5049
    5150namespace orxonox
     
    167166            void callListeners();
    168167
    169             std::stringstream stream_;                   //!< The stringstream that stores the assigned text
    170             std::list<OutputBufferListener*> listeners_; //!< A list of all listeners
     168            std::stringstream stream_;                     //!< The stringstream that stores the assigned text
     169            std::vector<OutputBufferListener*> listeners_; //!< A list of all listeners
    171170    };
    172171}
  • code/branches/pch/src/util/SignalHandler.cc

    r3068 r3146  
    3333
    3434#include "SignalHandler.h"
    35 #include "Debug.h"
    3635
    3736#include <iostream>
    3837#include <cstdlib>
    3938#include <cstring>
     39#include "Debug.h"
    4040
    4141namespace orxonox
  • code/branches/pch/src/util/Sleep.cc

    r2774 r3146  
    4343    {
    4444        if (microseconds < 1000)
    45             COUT(2) << "Warning: Windows can not sleep less than 1ms, ignoring" << std::endl;
     45            COUT(2) << "Warning: Windows cannot sleep less than 1ms, ignoring" << std::endl;
    4646        Sleep(microseconds / 1000);
    4747    }
  • code/branches/pch/src/util/String.cc

    r2662 r3146  
    3535
    3636#include <cctype>
    37 #include <iostream>
    38 
    3937#include "Convert.h"
    4038#include "Math.h"
  • code/branches/pch/src/util/String.h

    r2171 r3146  
    3636
    3737#include "UtilPrereqs.h"
    38 
    3938#include <string>
    40 #include <sstream>
    4139
    4240namespace orxonox
  • code/branches/pch/src/util/SubString.cc

    r3089 r3146  
    3939
    4040#include "SubString.h"
    41 #include <stdio.h>
     41#include <cstdio>
    4242
    4343namespace orxonox
  • code/branches/pch/src/util/mbool.h

    r2662 r3146  
    3636    struct _UtilExport mbool
    3737    {
    38 //        friend Synchronisable::registerVariable<>()
    3938        public:
    4039            inline mbool(bool value = false)
Note: See TracChangeset for help on using the changeset viewer.