Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7266


Ignore:
Timestamp:
Aug 30, 2010, 5:04:12 PM (14 years ago)
Author:
rgrieder
Message:

Moved Loki library files to separate loki folder in externals.
Also added TypeManip.h (now used in Convert.h) and static_check.h.

Location:
code/trunk/src
Files:
8 added
16 edited
3 moved

Legend:

Unmodified
Added
Removed
  • code/trunk/src/external/CMakeLists.txt

    r5781 r7266  
    3434ADD_SUBDIRECTORY(bullet)
    3535ADD_SUBDIRECTORY(cpptcl)
     36ADD_SUBDIRECTORY(loki)
    3637ADD_SUBDIRECTORY(ogreceguirenderer)
    3738ADD_SUBDIRECTORY(ois)
  • code/trunk/src/external/loki/ScopeGuard.h

    r7263 r7266  
    1212//     suitability of this software for any purpose. It is provided "as is"
    1313//     without express or implied warranty.
     14//
     15// Changes by Orxonox (Reto Grieder)
     16//     Moved one protected variable to the public section to allow the use of
     17//     the ScopeGuard in a class definition.
    1418////////////////////////////////////////////////////////////////////////////////
    1519#ifndef LOKI_SCOPEGUARD_INC_
     
    1923
    2024
    21 #include "RefToValue.h"
     25#include <loki/RefToValue.h>
    2226
    2327/// \defgroup ExceptionGroup Exception-safe code
  • code/trunk/src/external/loki/TypeTraits.h

    r7263 r7266  
    33// Copyright (c) 2001 by Andrei Alexandrescu
    44// This code accompanies the book:
    5 // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design 
     5// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
    66//     Patterns Applied". Copyright (c) 2001. Addison-Wesley.
    7 // Permission to use, copy, modify, distribute and sell this software for any 
    8 //     purpose is hereby granted without fee, provided that the above copyright 
    9 //     notice appear in all copies and that both that copyright notice and this 
     7// Permission to use, copy, modify, distribute and sell this software for any
     8//     purpose is hereby granted without fee, provided that the above copyright
     9//     notice appear in all copies and that both that copyright notice and this
    1010//     permission notice appear in supporting documentation.
    11 // The author or Addison-Wesley Longman make no representations about the 
    12 //     suitability of this software for any purpose. It is provided "as is" 
     11// The author or Addison-Wesley Longman make no representations about the
     12//     suitability of this software for any purpose. It is provided "as is"
    1313//     without express or implied warranty.
    1414//
    15 // Changes by Orxonox (Reto)
     15// Changes by Orxonox (Reto Grieder)
    1616//     Removed all stdInt, etc. type traits and function pointer traits
    1717//     and added UnqualifiedReferredType.
     
    2020#define LOKI_TYPETRAITS_INC_
    2121
    22 // $Id: TypeTraits.h 835 2007-08-02 19:39:02Z syntheticpp $
    23 
     22// $Id: TypeTraits.h 1069 2010-04-19 03:09:59Z rich_sposato $
     23
     24
     25#include <loki/NullType.h>
    2426
    2527#if (defined _MSC_VER) && (_MSC_VER < 1400)
     
    2931
    3032#ifdef _MSC_VER
    31 #pragma warning( push ) 
     33#pragma warning( push )
    3234#pragma warning( disable : 4180 ) //qualifier applied to function type has no meaning; ignored
    3335#endif
     
    3638{
    3739////////////////////////////////////////////////////////////////////////////////
    38 // class NullType
    39 // Used as a placeholder for "no type here"
    40 // Useful as an end marker in typelists
    41 ////////////////////////////////////////////////////////////////////////////////
    42 
    43     class NullType {};
    44 
    45 ////////////////////////////////////////////////////////////////////////////////
    4640// class template IsCustomUnsignedInt
    4741// Offers a means to integrate nonstandard built-in unsigned integral types
    48 // (such as unsigned __int64 or unsigned long long int) with the TypeTraits 
     42// (such as unsigned __int64 or unsigned long long int) with the TypeTraits
    4943//     class template defined below.
    5044// Invocation: IsCustomUnsignedInt<T> where T is any type
     
    5953    {
    6054        enum { value = 0 };
    61     };       
     55    };
    6256
    6357////////////////////////////////////////////////////////////////////////////////
    6458// class template IsCustomSignedInt
    6559// Offers a means to integrate nonstandard built-in unsigned integral types
    66 // (such as unsigned __int64 or unsigned long long int) with the TypeTraits 
     60// (such as unsigned __int64 or unsigned long long int) with the TypeTraits
    6761//     class template defined below.
    6862// Invocation: IsCustomSignedInt<T> where T is any type
     
    7771    {
    7872        enum { value = 0 };
    79     };       
     73    };
    8074
    8175////////////////////////////////////////////////////////////////////////////////
     
    9488    {
    9589        enum { value = 0 };
    96     };       
     90    };
    9791
    9892////////////////////////////////////////////////////////////////////////////////
     
    142136        };
    143137    }// namespace Private
    144        
     138
    145139////////////////////////////////////////////////////////////////////////////////
    146140// class template TypeTraits
     
    150144//
    151145// - isPointer       : returns true if T is a pointer type
    152 // - PointeeType     : returns the type to which T points if T is a pointer 
     146// - PointeeType     : returns the type to which T points if T is a pointer
    153147//                     type, NullType otherwise
    154148// - isReference     : returns true if T is a reference type
    155 // - ReferredType    : returns the type to which T refers if T is a reference 
     149// - ReferredType    : returns the type to which T refers if T is a reference
    156150//                     type, NullType otherwise
    157 // - ParameterType   : returns the optimal type to be used as a parameter for 
     151// - ParameterType   : returns the optimal type to be used as a parameter for
    158152//                     functions that take Ts
    159153// - isConst         : returns true if T is a const-qualified type
     
    161155// - isVolatile      : returns true if T is a volatile-qualified type
    162156// - NonVolatileType : Type with removed 'volatile' qualifier from T, if any
    163 // - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from 
     157// - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from
    164158//                     T, if any
    165 // - ParameterType   : returns the optimal type to be used as a parameter 
     159// - ParameterType   : returns the optimal type to be used as a parameter
    166160//                       for functions that take 'const T's
    167161//
     
    172166    {
    173167    private:
    174    
     168
    175169        template <class U> struct ReferenceTraits
    176170        {
     
    178172            typedef U ReferredType;
    179173        };
    180        
     174
    181175        template <class U> struct ReferenceTraits<U&>
    182176        {
     
    184178            typedef U ReferredType;
    185179        };
    186                
     180
    187181        template <class U> struct PointerTraits
    188182        {
     
    190184            typedef NullType PointeeType;
    191185        };
    192        
     186
    193187        template <class U> struct PointerTraits<U*>
    194188        {
     
    196190            typedef U PointeeType;
    197191        };
    198        
     192
    199193        template <class U> struct PointerTraits<U*&>
    200194        {
     
    202196            typedef U PointeeType;
    203197        };
    204          
     198
    205199        template <class U> struct PToMTraits
    206200        {
    207201            enum { result = false };
    208202        };
    209        
     203
    210204        template <class U, class V> struct PToMTraits<U V::*>
    211205        {
    212206            enum { result = true };
    213207        };
    214        
     208
    215209        template <class U, class V> struct PToMTraits<U V::*&>
    216210        {
    217211            enum { result = true };
    218212        };
    219        
     213
    220214        template <class U> struct UnConst
    221215        {
     
    223217            enum { isConst = 0 };
    224218        };
    225        
     219
    226220        template <class U> struct UnConst<const U>
    227221        {
     
    235229            enum { isConst = 1 };
    236230        };
    237  
     231
    238232        template <class U> struct UnVolatile
    239233        {
     
    241235            enum { isVolatile = 0 };
    242236        };
    243        
     237
    244238        template <class U> struct UnVolatile<volatile U>
    245239        {
     
    253247            enum { isVolatile = 1 };
    254248        };
    255        
     249
    256250    public:
    257         typedef typename UnConst<T>::Result 
     251        typedef typename UnConst<T>::Result
    258252            NonConstType;
    259         typedef typename UnVolatile<T>::Result 
     253        typedef typename UnVolatile<T>::Result
    260254            NonVolatileType;
    261         typedef typename UnVolatile<typename UnConst<T>::Result>::Result 
     255        typedef typename UnVolatile<typename UnConst<T>::Result>::Result
    262256            UnqualifiedType;
    263         typedef typename PointerTraits<UnqualifiedType>::PointeeType 
     257        typedef typename PointerTraits<UnqualifiedType>::PointeeType
    264258            PointeeType;
    265         typedef typename ReferenceTraits<T>::ReferredType 
     259        typedef typename ReferenceTraits<T>::ReferredType
    266260            ReferredType;
    267261        typedef typename ReferenceTraits<typename UnVolatile<typename UnConst<T>::Result>::Result>::ReferredType
     
    273267        enum { isPointer        = PointerTraits<
    274268                                        typename ReferenceTraits<UnqualifiedType>::ReferredType >::result};
    275                
     269
    276270    };
    277271}
  • code/trunk/src/libraries/core/Core.h

    r6746 r7266  
    3636#include <string>
    3737#include <boost/scoped_ptr.hpp>
    38 #include "util/ScopeGuard.h"
     38#include <loki/ScopeGuard.h>
     39
    3940#include "util/Singleton.h"
    4041#include "OrxonoxClass.h"
  • code/trunk/src/libraries/core/CorePrecompiledHeaders.h

    r5781 r7266  
    5757#include <cmath>    // 42
    5858
    59 #include "util/ScopeGuard.h" // 38
     59#include <loki/ScopeGuard.h> // 38
    6060
    6161#include <OgreMath.h>        // 36
  • code/trunk/src/libraries/core/Game.cc

    r6502 r7266  
    3737#include <exception>
    3838#include <boost/weak_ptr.hpp>
     39#include <loki/ScopeGuard.h>
    3940
    4041#include "util/Clock.h"
    4142#include "util/Debug.h"
    4243#include "util/Exception.h"
    43 #include "util/ScopeGuard.h"
    4444#include "util/Sleep.h"
    4545#include "util/SubString.h"
  • code/trunk/src/libraries/core/Game.h

    r6746 r7266  
    4646#include <boost/scoped_ptr.hpp>
    4747#include <boost/preprocessor/cat.hpp>
     48#include <loki/ScopeGuard.h>
    4849
    4950#include "util/Debug.h"
    50 #include "util/ScopeGuard.h"
    5151#include "util/Singleton.h"
    5252#include "OrxonoxClass.h"
  • code/trunk/src/libraries/core/Identifier.h

    r6536 r7266  
    5757#include <string>
    5858#include <typeinfo>
     59#include <loki/TypeTraits.h>
    5960
    6061#include "util/Debug.h"
    61 #include "util/TypeTraits.h"
    6262#include "MetaObjectList.h"
    6363#include "ObjectList.h"
  • code/trunk/src/libraries/core/LuaState.cc

    r6763 r7266  
    3535#include <lualib.h>
    3636}
     37#include <loki/ScopeGuard.h>
    3738
    3839#include "util/Debug.h"
    3940#include "util/Exception.h"
    40 #include "util/ScopeGuard.h"
    4141#include "IOConsole.h"
    4242#include "Resource.h"
  • code/trunk/src/libraries/core/LuaState.h

    r6763 r7266  
    3838#include <vector>
    3939#include <boost/shared_ptr.hpp>
     40#include <loki/ScopeGuard.h>
    4041
    41 #include "util/ScopeGuard.h"
    4242#include "Functor.h"
    4343#include "ToluaInterface.h"
  • code/trunk/src/libraries/core/input/InputManager.cc

    r7174 r7266  
    4040#include <ois/OISInputManager.h>
    4141#include <boost/foreach.hpp>
     42#include <loki/ScopeGuard.h>
    4243
    4344#include "util/Clock.h"
    4445#include "util/Convert.h"
    4546#include "util/Exception.h"
    46 #include "util/ScopeGuard.h"
    4747#include "core/CoreIncludes.h"
    4848#include "core/ConfigValueIncludes.h"
  • code/trunk/src/libraries/network/NetworkPrecompiledHeaders.h

    r5781 r7266  
    5353
    5454#include "util/Debug.h"      // 20
    55 #include "util/TypeTraits.h" // 18
     55#include <loki/TypeTraits.h> // 18
    5656
    5757#ifdef ORXONOX_COMPILER_MSVC
  • code/trunk/src/libraries/network/synchronisable/Serialise.h

    r7163 r7266  
    3535#define _NetworkSerialise_H__
    3636
     37#include "network/NetworkPrereqs.h"
     38
     39#include <loki/TypeTraits.h>
     40
    3741#include "util/Serialise.h"
    38 #include "util/TypeTraits.h"
    3942#include "core/CorePrereqs.h"
    4043#include "core/CoreIncludes.h"
  • code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h

    r6417 r7266  
    3535#include <cassert>
    3636#include <cstring>
     37#include <loki/TypeTraits.h>
     38
    3739#include "Serialise.h"
    38 #include "util/TypeTraits.h"
    3940#include "core/GameMode.h"
    4041#include "network/synchronisable/NetworkCallbackManager.h"
  • code/trunk/src/libraries/util/Convert.h

    r7163 r7266  
    4141#include <sstream>
    4242#include <typeinfo>
     43#include <loki/TypeManip.h>
    4344
    4445#include "Debug.h"
     
    7677namespace orxonox
    7778{
    78     namespace detail
    79     {
    80         //! Little template that maps integers to entire types (Alexandrescu 2001)
    81         template <int I>
    82         struct Int2Type { };
    83     }
    84 
    85 
    8679    ///////////////////
    8780    // No Conversion //
     
    215208    // implicit cast not possible, try stringstream conversion next
    216209    template <class FromType, class ToType>
    217     FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, detail::Int2Type<false>)
     210    FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<false>)
    218211    {
    219212        return ConverterStringStream<FromType, ToType>::convert(output, input);
     
    222215    // We can cast implicitely
    223216    template <class FromType, class ToType>
    224     FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, detail::Int2Type<true>)
     217    FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<true>)
    225218    {
    226219        (*output) = static_cast<ToType>(input);
     
    242235            // Try implict cast and probe first. If a simple cast is not possible, it will not compile
    243236            // We therefore have to out source it into another template function
    244             return convertImplicitely(output, input, detail::Int2Type<probe>());
     237            return convertImplicitely(output, input, Loki::Int2Type<probe>());
    245238        }
    246239    };
  • code/trunk/src/libraries/util/MultiType.h

    r7165 r7266  
    7676#include <OgreQuaternion.h>
    7777#include <OgreColourValue.h>
    78 
    79 #include "TypeTraits.h"
     78#include <loki/TypeTraits.h>
    8079
    8180namespace orxonox
  • code/trunk/src/libraries/util/Scope.h

    r5929 r7266  
    3535#include <map>
    3636#include <set>
     37#include <loki/ScopeGuard.h>
    3738
    3839#include "Debug.h"
    39 #include "ScopeGuard.h"
    4040
    4141namespace orxonox
  • code/trunk/src/orxonox/sound/SoundManager.cc

    r7174 r7266  
    3333#include <AL/alut.h>
    3434#include <utility>
     35#include <loki/ScopeGuard.h>
    3536
    3637#include "util/Exception.h"
    3738#include "util/Math.h"
    38 #include "util/ScopeGuard.h"
    3939#include "util/Clock.h"
    4040#include "core/ConfigValueIncludes.h"
Note: See TracChangeset for help on using the changeset viewer.