[Orxonox-commit 2561] r7266 - in code/trunk/src: external external/loki libraries/core libraries/core/input libraries/network libraries/network/synchronisable libraries/util orxonox/sound
rgrieder at orxonox.net
rgrieder at orxonox.net
Mon Aug 30 17:04:13 CEST 2010
Author: rgrieder
Date: 2010-08-30 17:04:12 +0200 (Mon, 30 Aug 2010)
New Revision: 7266
Added:
code/trunk/src/external/loki/
code/trunk/src/external/loki/CHANGES
code/trunk/src/external/loki/CMakeLists.txt
code/trunk/src/external/loki/NullType.h
code/trunk/src/external/loki/README
code/trunk/src/external/loki/RefToValue.h
code/trunk/src/external/loki/ScopeGuard.h
code/trunk/src/external/loki/TypeManip.h
code/trunk/src/external/loki/TypeTraits.h
code/trunk/src/external/loki/changes_orxonox.txt
code/trunk/src/external/loki/static_check.h
Removed:
code/trunk/src/libraries/util/RefToValue.h
code/trunk/src/libraries/util/ScopeGuard.h
code/trunk/src/libraries/util/TypeTraits.h
Modified:
code/trunk/src/external/CMakeLists.txt
code/trunk/src/libraries/core/Core.h
code/trunk/src/libraries/core/CorePrecompiledHeaders.h
code/trunk/src/libraries/core/Game.cc
code/trunk/src/libraries/core/Game.h
code/trunk/src/libraries/core/Identifier.h
code/trunk/src/libraries/core/LuaState.cc
code/trunk/src/libraries/core/LuaState.h
code/trunk/src/libraries/core/input/InputManager.cc
code/trunk/src/libraries/network/NetworkPrecompiledHeaders.h
code/trunk/src/libraries/network/synchronisable/Serialise.h
code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h
code/trunk/src/libraries/util/Convert.h
code/trunk/src/libraries/util/MultiType.h
code/trunk/src/libraries/util/Scope.h
code/trunk/src/orxonox/sound/SoundManager.cc
Log:
Moved Loki library files to separate loki folder in externals.
Also added TypeManip.h (now used in Convert.h) and static_check.h.
Modified: code/trunk/src/external/CMakeLists.txt
===================================================================
--- code/trunk/src/external/CMakeLists.txt 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/external/CMakeLists.txt 2010-08-30 15:04:12 UTC (rev 7266)
@@ -33,6 +33,7 @@
ADD_SUBDIRECTORY(bullet)
ADD_SUBDIRECTORY(cpptcl)
+ADD_SUBDIRECTORY(loki)
ADD_SUBDIRECTORY(ogreceguirenderer)
ADD_SUBDIRECTORY(ois)
ADD_SUBDIRECTORY(tinyxml)
Added: code/trunk/src/external/loki/CHANGES
===================================================================
--- code/trunk/src/external/loki/CHANGES (rev 0)
+++ code/trunk/src/external/loki/CHANGES 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,446 @@
+_____________________________________
+
+Version 0.1.7
+January 2009
+_____________________________________
+
+General:
+ - Fixed makefiles for GNU/kFreeBSD, GNU/hurd. (lf)
+ - Fixed build errors with gcc 4.3 pre-release. (lf)
+ - Fixed compiler error that occurs when using 64 bit pointers. (rs)
+ - Added support for Code::Blocks and MSVC 9. (rs, pk)
+ - Added more unit tests (rs)
+ - Several other bug fixes (rs, pk)
+
+Checker:
+ - Added for this release. (rs)
+ - Added test project. (rs)
+
+CheckReturn:
+ - Added for this release. (rs, pk)
+ - Added test project. (rs + pk)
+
+flex_string:
+ - Fixed bugs in several functions and storage policies. (aa, rs, jfg)
+
+LevelMutex:
+ - Added for this release. (rs)
+ - Added unit tests for LevelMutex. (rs)
+
+SafeBits:
+ - Added for this release. (rs, fp)
+ - Added unit tests for SafeBits. (rs, fp)
+
+SmartPtr:
+ - Fixed double-delete race condition. (rs)
+
+StrongPtr:
+ - Fixed destructor so cleanup is only done once. (rs)
+ - Fixed test by using class level locking. (lf)
+
+Threads:
+ - Add possibility to enable recursive mutex support for pthread (pk)
+ - Added more atomic functions. (rs)
+
+Type Traits:
+ - Added 64 bit support. (cg)
+
+CVS commits by:
+ Andrei Alexandrescu (aa)
+ Guillaume Chatelet (cg)
+ Lukas Fittl (lf)
+ Peter Kümmel (pk)
+ Rich Sposato (rs)
+
+Contributions by:
+ Andrei Alexandrescu (aa)
+ Jean-Francois Bastien (jfb)
+ Guillaume Chatelet (cg)
+ Lukas Fittl (lf)
+ Fedor Pikus (fp)
+ Peter Kümmel (pk)
+ Rich Sposato (rs)
+
+_____________________________________
+
+Version 0.1.6
+February 25, 2007
+_____________________________________
+
+General:
+ - CacheFactory added by Guillaume Chatelet
+ - Factory documentation improved by Guillaume Chatelet
+ - migrated to subversion (pk)
+ - Mac linker errors fixed (lf)
+ - Makefiles can now be called from sub directories (lf)
+ - Makefiles know includes and recompile if they are changed (linux, macosx) (lf)
+ - Build all tests except SingletonDll with the static library (linux, macosx) (lf)
+ - use standard conforming naming, SUN's compiler needs it (pk)
+ - add Loki:: to LOKI_ macros
+ - several bug fixes.
+
+AbstractFactory:
+ - remove injected friends. (thanks to Sigoure Benoit, pk)
+
+AssocVector:
+ - remove injected friends. (thanks to Sigoure Benoit, pk)
+
+LockingPtr:
+ - constructor added which gets a std::pair of pointers
+ to the object and the mutex (pk)
+
+Pimpl:
+ - ImplT/PimplT/RimplT renamed to a more readable version: ImplOf (pk)
+
+Register:
+ - also produce a informative LOKI_CHECK_CLASS_IN_LIST error message with GCC (pk)
+
+SafeFormat:
+ - add writing to ostream, by Tom Browder (pk)
+ - add unsigned long version for Windows, (Thanks to ShenLei, pk)
+
+Sequence:
+ - Also compiles with Aix
+ - switched to recursive implementation
+
+Singleton
+ - example: move instantiation to the source file
+ fixes linker error with gcc 4.0.1 on the mac,
+ (Thanks to Idar Tollefsen and Sam Miller, pk)
+ - 64 bit linker error fixed (lf)
+
+SmallObj:
+ - compiler errors on SUN fixed (pk)
+ - more documentation (rs)
+ - more tests (rs)
+ - AIX fixed, (thanks to Dieter Rosch, pk)
+
+StrongPtr:
+ - Added typedef so LockableTwoRefCounts uses thread-safe allocator. (rs)
+ - AIX fixed, (thanks to Dieter Rosch, pk)
+ - linker error when using threads fixed (pk)
+
+Threads:
+ - reentrance support added to the pthread mutex (Thanks to Shen Lei, pk)
+
+
+CVS commits by Guillaume Chatelet (gc), Lukas Fittl (lf), Peter Kümmel (pk), Rich Sposato (rs)
+
+
+_____________________________________
+
+Version 0.1.5
+June 19, 2006
+_____________________________________
+
+General:
+ - operator== added to Functor, initiated by Eric Beyeler (pk)
+ - new Strong/Weak smart pointer added. (rs)
+ - loki.spec (Thanks to Regis Desgroppes and Andreas Scherer, pk)
+ - build shared lib also on mac osx (Thanks to Sam Miller, lf)
+ - added MinGW .dev files for the library (rs)
+ - some makefile improvements (Thanks to Sam Miller, lf)
+ - adding an XCode build project (kx)
+
+
+flex_string:
+ - compare bug fixed in flex_string_shell.h (Thanks to David A. Capello, pk)
+
+Function:
+ - test is doesn't need boost any more (pk)
+ - wrong default parameter fixed (pk)
+
+OrderedStatic:
+ - undef all min/max macros (Thanks to Shen Lei, pk)
+
+Singleton:
+ - Singleton<> moved into correct namespace (Thanks to Sam Miller, pk)
+
+SmartPtr:
+ - patch for RedHat 9: undefined uintptr_t (Thanks to Regis Desgroppes, pk)
+ - more tests (rs)
+ - bugs 1452805 and 1451835 fixed (rs)
+ - addded HeapStorage policy as mentioned in Feature Request 1441024 (rs)
+ - added MinGW test project for SmartPtr (rs)
+
+
+CVS commits by Rich Sposato (rs), Lukas Fittl (lf),
+Christopher Knox (kx), and Peter Kümmel (pk)
+
+
+
+_____________________________________
+
+Version 0.1.4
+March 8, 2006
+_____________________________________
+
+General:
+ - helper templates for Pimpl/Rimpl implementations added (pk)
+ - improved Makefiles (lf)
+ - improved make.msvc.bat files (pk)
+ - cvs LOG keywords added (rs)
+ - removed old c style casts (lf)
+ - more warning enabled on gcc (lf)
+ - new header added: ConstPolicy.h (rs,pk)
+ - new header added: RefToValue.h (rs,pk)
+ - standard RPM specification file for integrated installation
+ on OpenSUSE Linux added (Thanks to Andreas Scherer, pk)
+ - using Loki as shared library is now possible (pk,lf)
+ - Register.h added (pk)
+
+
+Function:
+ - guard including (pk)
+ - test stsic functions (pk)
+ - test LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT (pk)
+
+Functor:
+ - Added explicit call to base copy-constructor (rs)
+ - Changed base class from SmallObject to SmallValueObject. (Thanks to Sam Miller, rs)
+ - add possibility to disable inheritance from SmallValueObject: LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT (pk)
+
+ScopeGuard:
+ - naming conflict with SmartPtr removed (rs,pk)
+ - ByRef moved to RefByVale (rs,pk)
+
+Singleton:
+ - support of allocators with a standard interface added (Thanks to Miguel A. Figueroa-Villanueva, pk)
+ - convenience template Singleton added for shared libraries (Thanks to Marcus Lindblom, pk)
+ - example added which shows how to use Singletons with shared libraries added (Thanks to Marcus Lindblom, pk)
+
+SmartPtr:
+ - supports propagating constness by additional policy (rs,pk)
+ - ArrayStorage policy added (Thanks to Sam Miller, pk)
+ - fix in RefCounted for Mac OSX gcc 4.0.0 (Thanks to Sam Miller, pk)
+ - RefCounted ported to 64 bit (pk)
+ - add mutex policy (pk)
+ - new test code (rs)
+ - RecjectNullStrict const member function added (Thanks to Sam Miller, pk)
+ - Moved a monolithic RefLinkedBase class from header file to new source file. (rs)
+ - ByRef moved to RefToVale (rs,pk)
+ - Fixed bug 1425890. Last SmartPtr in linked chain NULLs its prev & next
+ pointers to prevent infinite recursion. Added asserts. (rs)
+ - Bug fix: infinite recursion in SmartPtr destructor (rs)
+
+LockingPtr:
+ - wrong return types fixed (rs)
+ - add mutex policy (rs,pk)
+ - supports now propagating constness (pk,rs)
+ - macro switch LOKI_DEFAULT_CONSTNESS added for propagating constness (pk)
+ - multi threaded example added
+
+SafeFormat:
+ - definition moved to src/SafeFormat.cpp, it's now part of the library
+
+Singleton:
+ - add mutex policy (pk)
+
+SmallObj:
+ - add mutex policy (pk)
+ - Added check for memory leak inside destructor. (Thanks to Kwak Jae Hyuk, rs)
+
+Threads:
+ - Mutex added (rs,pk)
+ - use Loki::Mutex instead of win32/posix mutexes in threading classes (rs,pk)
+
+
+CVS commits by Rich Sposato (rs), Lukas Fittl (lf)
+and Peter Kümmel (pk)
+
+
+
+_____________________________________
+
+Version 0.1.3
+January 9, 2006
+_____________________________________
+
+General:
+ - LockPtr added (rs)
+ - ScopeGuard added (pk,rs)
+ - improved Makefiles (lf,pk)
+ - several gcc fixes and removed warnings by Lukas Fittl (lf)
+ - tested on 64-bit Linux (pk)
+ - MS Visual C++ 2005 project files added (pk)
+ - now also the ms toolkit 2003 generates a library (pk)
+
+OrderedStatic:
+ - point operator added (pk)
+
+SafeFormat:
+ - moved into namespace Loki (pk)
+ - 64 bit problems fixed (Thanks to Zak Kipling)
+ - ported to 64-bit Windows, not tested (pk)
+ - Printf/SPrintfing of std::strings added (pk)
+ - all warnings removed gcc and msvc (pk)
+ - use snprintf for "%p"
+ - test program: speed comparison added (pk)
+
+SmallObject:
+ - added functions to check for memory corruption (rs)
+ - more fine tuning (rs)
+ - warnings removed (pk)
+
+TypeTraits:
+ - bug 1388477 fixed (pk)
+
+flex_string:
+ - fixed compare bug by updating (Thanks to Justin Matthews, pk)
+ - fixed seg faults on Linux and Windows (pk)
+ - improved error reporting of the test program (pk)
+
+SmartPtr:
+ - make object level locking possible (Thanks to Ryan Smith, pk)
+
+BindFirst:
+ - store Functor arguments by value (bug 1383566) (pk)
+
+Visitor:
+ - add support for visiting constant member functions (pk)
+ - example added (pk)
+
+ScopeGuard:
+ - example added (pk)
+
+
+CVS commits by Rich Sposato (rs), Lukas Fittl (lf)
+and Peter Kümmel (pk)
+
+
+_____________________________________
+
+Version 0.1.2
+November 16, 2005
+_____________________________________
+
+General:
+ - changes to compile under Linux (Thanks to David Lawrence, pk)
+ - more doxygen documentation, modules added (rs, pk)
+
+SmartPtr:
+ - three year old bugs 626407 and 541846 fixed:
+ Assertion with SmartPtr<T, LinkedRef> (pk)
+ SmartPtr and COMRefCounted (Thanks to James Mclaren, pk)
+
+Typelists:
+ - it's now possible to completely disable the
+ LOKI_TYPELIST_ macros (pk)
+ - marco definitions moved to a separate file (pk)
+
+Factory:
+ - Factory now protects its private data (pk)
+ - new method to get the keys:
+ std::vector<IdType> RegisteredIds() (pk)
+
+Functor:
+ - TR1 methods added: empty() and clear() (pk)
+
+Function:
+ - boost/TR1 like Function template with
+ improved member function pointer usage (pk)
+ - tested with boost's function_test.cpp
+
+Sequence:
+ - small change in usage: use e.g. Functor<void,Seq<bool &> >
+ instead of Functor<void,Seq<bool &>::Type >
+
+SmallObjects:
+ - comparison of new/malloc/std::allocator/boost::object_pool (rs, pk)
+ - #undef LOKI_SMALL_OBJECT_USE_NEW_ARRAY when using a ms compiler (pk)
+ - new lifetimes in namespace LongevityLifetime to manage dependencies:
+ DieAsSmallObjectParent and DieAsSmallObjectClient (pk)
+ - no memory leaks when using SmallObjects (pk)
+ - new default lifetime is DieAsSmallObjectParent (pk)
+
+Threads:
+ - threads on POSIX systems (Thanks to Ilya Volvovski ,pk)
+ - small regression test program (pk)
+
+Singleton:
+ - new lifetime: FollowIntoDeath (pk)
+ - new namespace LongevityLifetime with lifetimes DieLast, DieFirst,
+ DieDirectlyBeforeLast, and function SingletonFixedLongevity (pk)
+ - new implementation for SetLongevity (pk)
+ - example programs (pk)
+
+
+CVS commits by Rich Sposato (rs) and Peter Kümmel (pk)
+
+
+
+_____________________________________
+
+Version 0.1.1
+October 17, 2005
+_____________________________________
+
+Singleton:
+ - wrong ordered longevity fixed (Thanks to Kwak Jae Hyuk, pk)
+ - less warnings with msvc (Thanks to John Bates, pk)
+ - new policy, DeletableSingleton, from Curtis Krauskopf,
+ see also CUJ article 'Creating Dynamic Singletons & the Loki Library',(pk)
+
+AssocVector:
+ - hinted insert does now preserve ordering (Thanks to Christopher Twigg, pk)
+ - additional 'hinted insert' test for Regression test by Christopher Twigg (pk)
+ - fix name look up (Thanks to Markus Werle, pk)
+
+SmallObj:
+ - several improvements (rs)
+ - more documentation (rs)
+ - improved SmallBench (rs, pk)
+
+Longevity:
+ - example added (pk)
+ - additional example similar to that of the book, by Curtis Krauskopf (pk)
+
+OrderedStatic:
+ - a proposal to solve the 'static initialization ordered fiasco' problem (pk)
+
+Sequence:
+ - a proposal to replace the LOKI_TYPELIST_XX macros with a template implementation (pk)
+ - e.g.: LOKI_TYPELIST_1(int) becomes Seq<int>::Type
+ inspired by the functional language OPAL (pk)
+
+
+CVS commits by Rich Sposato (rs) and Peter Kümmel (pk)
+
+
+
+_____________________________________
+
+Version 0.1.0
+September 29, 2005
+_____________________________________
+
+General:
+ - version numbering started
+ - new directory structure
+ - Andrei's yasli, flex_string, and SafePrint added (pk)
+ - all macros now in the LOKI "namespace", e.g.:
+ TYPLELIST_1 -> LOKI_TYPELIST_1 (rs, pk)
+ - Makefiles added: tested with gcc 3.4 (mingw, cygwin),
+ msvc 8.0, and the toolkit (pk)
+ - added some documentation (rs)
+ - several bug fixes (pk)
+ - added a cvs-list to sourceforge where you can see all changes (pk)
+
+SmallObjects:
+ - new implementation (rs)
+
+Factory:
+ - works now with parameters (pk)
+ - regression test added (Thanks to Kalle Rutanen, pk)
+
+TypeTraits:
+ - isMemberPointer, isFunction added (Thanks to Kalle Rutanen, pk)
+ - regression test added (Thanks to Kalle Rutanen, pk)
+
+Threading:
+ - new macros for better thread support (win32):
+ LOKI_CLASS_LEVEL_THREADING and LOKI_OBJECT_LEVEL_THREADING (pk)
+
+
+CVS commits by Rich Sposato (rs) and Peter Kümmel (pk)
+
Property changes on: code/trunk/src/external/loki/CHANGES
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/trunk/src/external/loki/CMakeLists.txt
===================================================================
--- code/trunk/src/external/loki/CMakeLists.txt (rev 0)
+++ code/trunk/src/external/loki/CMakeLists.txt 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,29 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+ # as published by the Free Software Foundation; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with this program; if not, write to the Free Software Foundation,
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+
+SET(LOKI_FILES
+ NullType.h
+ RefToValue.h
+ ScopeGuard.h
+ static_check.h
+ TypeManip.h
+ TypeTraits.h
+)
+
+ADD_CUSTOM_TARGET(loki_orxonox SOURCES ${LOKI_FILES})
Property changes on: code/trunk/src/external/loki/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/trunk/src/external/loki/NullType.h
===================================================================
--- code/trunk/src/external/loki/NullType.h (rev 0)
+++ code/trunk/src/external/loki/NullType.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2001 by Andrei Alexandrescu
+// This code accompanies the book:
+// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
+// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+// Permission to use, copy, modify, distribute and sell this software for any
+// purpose is hereby granted without fee, provided that the above copyright
+// notice appear in all copies and that both that copyright notice and this
+// permission notice appear in supporting documentation.
+// The author or Addison-Wesley Longman make no representations about the
+// suitability of this software for any purpose. It is provided "as is"
+// without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_NULLTYPE_INC_
+#define LOKI_NULLTYPE_INC_
+
+// $Id: NullType.h 751 2006-10-17 19:50:37Z syntheticpp $
+
+
+namespace Loki
+{
+////////////////////////////////////////////////////////////////////////////////
+// class NullType
+// Used as a placeholder for "no type here"
+// Useful as an end marker in typelists
+////////////////////////////////////////////////////////////////////////////////
+
+ class NullType {};
+
+} // namespace Loki
+
+
+#endif // end file guardian
Property changes on: code/trunk/src/external/loki/NullType.h
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/trunk/src/external/loki/README
===================================================================
--- code/trunk/src/external/loki/README (rev 0)
+++ code/trunk/src/external/loki/README 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,63 @@
+Last update: Novmber 16, 2005
+
+Directions:
+
+To use Loki, simply extract the files from the archive,
+give your compiler access to their include path:
+
+- if you have a standard conforming compiler use "loki/include/loki"
+ or "loki/include" for "#include <loki/HeaderFile.h>" usage
+
+- if you have a non-conforming compiler use "loki/include/noncc/loki"
+ or "loki/include/noncc" for "#include <loki/HeaderFile.h>" usage.
+ The noncc files are declared as 'deprecated' and will be removed in
+ future. They are also not updated with the new features of Loki
+ and bugfixes (unless YOU do it).
+
+
+If you use the small object allocator directly or indirectly
+(through the Functor class) you must add src/SmallObj.cpp to your
+project/makefile.
+
+If you use Singletons with longevity you must add
+src/Singleton.cpp to your project/makefile.
+
+If you use OrderedStatic.h with you must add
+src/OrderedSataic.cpp to your project/makefile.
+
+Or use the library generated by make.msvc.bat, make.mingw.bat,
+or make.
+
+
+Compatibility:
+
+Supported Compilers:
+Gcc v3.4
+Gcc v4.0
+Gcc v4.1
+Microsoft Visual C++ v7.1
+Microsoft Visual C++ v8.0
+
+by special noncc files:
+Borland C++ Builder v6.0
+Microsoft Visual C++ v6.0
+Microsoft Visual C++ v7.0
+see also readme.txt files
+
+
+Mostly Supported:
+CodeWarrior 6.0
+
+CodeWarrior has a problem with the Conversion template (see TypeManip.h)
+and, though it compiles it, it doesn't provide correct results.
+Consequently, the DerivedToFront algorithm in Typelist.h does not function.
+This affects the static dispatcher in Multimethods.h. As a fix, you must
+order the types (putting the most derived ones in the front) when providing
+the typelist argument to StaticDispatcher.
+
+
+
+More info:
+
+Andrei's page : http://erdani.org
+Soureforge page: http://sourceforge.net/projects/loki-lib/
Property changes on: code/trunk/src/external/loki/README
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/trunk/src/external/loki/RefToValue.h (from rev 7263, code/trunk/src/libraries/util/RefToValue.h)
===================================================================
--- code/trunk/src/external/loki/RefToValue.h (rev 0)
+++ code/trunk/src/external/loki/RefToValue.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2006 Richard Sposato
+// Copyright (c) 2006 Peter Kümmel
+// Permission to use, copy, modify, distribute and sell this software for any
+// purpose is hereby granted without fee, provided that the above copyright
+// notice appear in all copies and that both that copyright notice and this
+// permission notice appear in supporting documentation.
+// The authors make no representations about the
+// suitability of this software for any purpose. It is provided "as is"
+// without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_REFTOVALUE_INC_
+#define LOKI_REFTOVALUE_INC_
+
+// $Id: RefToValue.h 751 2006-10-17 19:50:37Z syntheticpp $
+
+
+namespace Loki
+{
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \class RefToValue
+ ///
+ /// \ingroup SmartPointerGroup
+ /// Transports a reference as a value
+ /// Serves to implement the Colvin/Gibbons trick for SmartPtr/ScopeGuard
+ ////////////////////////////////////////////////////////////////////////////////
+
+ template <class T>
+ class RefToValue
+ {
+ public:
+
+ RefToValue(T& ref) : ref_(ref)
+ {}
+
+ RefToValue(const RefToValue& rhs) : ref_(rhs.ref_)
+ {}
+
+ operator T& () const
+ {
+ return ref_;
+ }
+
+ private:
+ // Disable - not implemented
+ RefToValue();
+ RefToValue& operator=(const RefToValue&);
+
+ T& ref_;
+ };
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ExceptionGroup
+ /// RefToValue creator.
+ ////////////////////////////////////////////////////////////////////////////////
+
+ template <class T>
+ inline RefToValue<T> ByRef(T& t)
+ {
+ return RefToValue<T>(t);
+ }
+
+}
+
+
+#endif // end file guardian
+
Copied: code/trunk/src/external/loki/ScopeGuard.h (from rev 7263, code/trunk/src/libraries/util/ScopeGuard.h)
===================================================================
--- code/trunk/src/external/loki/ScopeGuard.h (rev 0)
+++ code/trunk/src/external/loki/ScopeGuard.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,670 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2000 Andrei Alexandrescu
+// Copyright (c) 2000 Petru Marginean
+// Copyright (c) 2005 Joshua Lehrer
+//
+// Permission to use, copy, modify, distribute and sell this software for any
+// purpose is hereby granted without fee, provided that the above copyright
+// notice appear in all copies and that both that copyright notice and this
+// permission notice appear in supporting documentation.
+// The author makes no representations about the
+// suitability of this software for any purpose. It is provided "as is"
+// without express or implied warranty.
+//
+// Changes by Orxonox (Reto Grieder)
+// Moved one protected variable to the public section to allow the use of
+// the ScopeGuard in a class definition.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_SCOPEGUARD_INC_
+#define LOKI_SCOPEGUARD_INC_
+
+// $Id: ScopeGuard.h 799 2006-12-20 00:37:13Z rich_sposato $
+
+
+#include <loki/RefToValue.h>
+
+/// \defgroup ExceptionGroup Exception-safe code
+
+namespace Loki
+{
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ScopeGuardImplBase
+ /// \ingroup ExceptionGroup
+ ///
+ /// Base class used by all ScopeGuard implementations. All commonly used
+ /// functions are in this class (e.g. - Dismiss and SafeExecute).
+ ///
+ /// See Andrei's and Petru Marginean's CUJ article
+ /// http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm
+ ///
+ /// Changes to the original code by Joshua Lehrer:
+ /// http://www.lehrerfamily.com/scopeguard.html
+ ////////////////////////////////////////////////////////////////
+
+ class ScopeGuardImplBase
+ {
+ /// Copy-assignment operator is not implemented and private.
+ ScopeGuardImplBase& operator =(const ScopeGuardImplBase&);
+
+ protected:
+
+ ~ScopeGuardImplBase()
+ {}
+
+ /// Copy-constructor takes over responsibility from other ScopeGuard.
+ ScopeGuardImplBase(const ScopeGuardImplBase& other) throw()
+ : dismissed_(other.dismissed_)
+ {
+ other.Dismiss();
+ }
+
+ template <typename J>
+ static void SafeExecute(J& j) throw()
+ {
+ if (!j.dismissed_)
+ try
+ {
+ j.Execute();
+ }
+ catch(...)
+ {}
+ }
+
+ mutable bool dismissed_;
+
+ public:
+ ScopeGuardImplBase() throw() : dismissed_(false)
+ {}
+
+ void Dismiss() const throw()
+ {
+ dismissed_ = true;
+ }
+ };
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \typedef typedef const ScopeGuardImplBase& ScopeGuard
+ /// \ingroup ExceptionGroup
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ typedef const ScopeGuardImplBase& ScopeGuard;
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ScopeGuardImpl0
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a standalone function or class static function
+ /// with no parameters. ScopeGuard ignores any value returned from the
+ /// call within the Execute function.
+ ///
+ /// This class has a single standalone helper function, MakeGuard which
+ /// creates and returns a ScopeGuard.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template <typename F>
+ class ScopeGuardImpl0 : public ScopeGuardImplBase
+ {
+ public:
+ static ScopeGuardImpl0<F> MakeGuard(F fun)
+ {
+ return ScopeGuardImpl0<F>(fun);
+ }
+
+ ~ScopeGuardImpl0() throw()
+ {
+ SafeExecute(*this);
+ }
+
+ void Execute()
+ {
+ fun_();
+ }
+
+ ScopeGuardImpl0(F fun) : fun_(fun)
+ {}
+
+ protected:
+ F fun_;
+ };
+
+ template <typename F>
+ inline ScopeGuardImpl0<F> MakeGuard(F fun)
+ {
+ return ScopeGuardImpl0<F>::MakeGuard(fun);
+ }
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ScopeGuardImpl1
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a standalone function or class static function
+ /// with one parameter. Each parameter is copied by value - use
+ /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
+ /// any value returned from the call within the Execute function.
+ ///
+ /// This class has a single standalone helper function, MakeGuard which
+ /// creates and returns a ScopeGuard.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template <typename F, typename P1>
+ class ScopeGuardImpl1 : public ScopeGuardImplBase
+ {
+ public:
+ static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
+ {
+ return ScopeGuardImpl1<F, P1>(fun, p1);
+ }
+
+ ~ScopeGuardImpl1() throw()
+ {
+ SafeExecute(*this);
+ }
+
+ void Execute()
+ {
+ fun_(p1_);
+ }
+
+ ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1)
+ {}
+
+ protected:
+ F fun_;
+ const P1 p1_;
+ };
+
+ template <typename F, typename P1>
+ inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
+ {
+ return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
+ }
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ScopeGuardImpl2
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a standalone function or class static function
+ /// with two parameters. Each parameter is copied by value - use
+ /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
+ /// any value returned from the call within the Execute function.
+ ///
+ /// This class has a single standalone helper function, MakeGuard which
+ /// creates and returns a ScopeGuard.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template <typename F, typename P1, typename P2>
+ class ScopeGuardImpl2: public ScopeGuardImplBase
+ {
+ public:
+ static ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
+ {
+ return ScopeGuardImpl2<F, P1, P2>(fun, p1, p2);
+ }
+
+ ~ScopeGuardImpl2() throw()
+ {
+ SafeExecute(*this);
+ }
+
+ void Execute()
+ {
+ fun_(p1_, p2_);
+ }
+
+ ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2)
+ {}
+
+ protected:
+ F fun_;
+ const P1 p1_;
+ const P2 p2_;
+ };
+
+ template <typename F, typename P1, typename P2>
+ inline ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
+ {
+ return ScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2);
+ }
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ScopeGuardImpl3
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a standalone function or class static function
+ /// with three parameters. Each parameter is copied by value - use
+ /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
+ /// any value returned from the call within the Execute function.
+ ///
+ /// This class has a single standalone helper function, MakeGuard which
+ /// creates and returns a ScopeGuard.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template <typename F, typename P1, typename P2, typename P3>
+ class ScopeGuardImpl3 : public ScopeGuardImplBase
+ {
+ public:
+ static ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+ {
+ return ScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3);
+ }
+
+ ~ScopeGuardImpl3() throw()
+ {
+ SafeExecute(*this);
+ }
+
+ void Execute()
+ {
+ fun_(p1_, p2_, p3_);
+ }
+
+ ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3)
+ {}
+
+ protected:
+ F fun_;
+ const P1 p1_;
+ const P2 p2_;
+ const P3 p3_;
+ };
+
+ template <typename F, typename P1, typename P2, typename P3>
+ inline ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+ {
+ return ScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3);
+ }
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ScopeGuardImpl4
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a standalone function or class static function
+ /// with four parameters. Each parameter is copied by value - use
+ /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
+ /// any value returned from the call within the Execute function.
+ ///
+ /// This class has a single standalone helper function, MakeGuard which
+ /// creates and returns a ScopeGuard.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template < typename F, typename P1, typename P2, typename P3, typename P4 >
+ class ScopeGuardImpl4 : public ScopeGuardImplBase
+ {
+ public:
+ static ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard(
+ F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
+ {
+ return ScopeGuardImpl4< F, P1, P2, P3, P4 >( fun, p1, p2, p3, p4 );
+ }
+
+ ~ScopeGuardImpl4() throw()
+ {
+ SafeExecute( *this );
+ }
+
+ void Execute()
+ {
+ fun_( p1_, p2_, p3_, p4_ );
+ }
+
+ ScopeGuardImpl4( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) :
+ fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 )
+ {}
+
+ protected:
+ F fun_;
+ const P1 p1_;
+ const P2 p2_;
+ const P3 p3_;
+ const P4 p4_;
+ };
+
+ template < typename F, typename P1, typename P2, typename P3, typename P4 >
+ inline ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
+ {
+ return ScopeGuardImpl4< F, P1, P2, P3, P4 >::MakeGuard( fun, p1, p2, p3, p4 );
+ }
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ScopeGuardImpl5
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a standalone function or class static function
+ /// with five parameters. Each parameter is copied by value - use
+ /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
+ /// any value returned from the call within the Execute function.
+ ///
+ /// This class has a single standalone helper function, MakeGuard which
+ /// creates and returns a ScopeGuard.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
+ class ScopeGuardImpl5 : public ScopeGuardImplBase
+ {
+ public:
+ static ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard(
+ F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
+ {
+ return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >( fun, p1, p2, p3, p4, p5 );
+ }
+
+ ~ScopeGuardImpl5() throw()
+ {
+ SafeExecute( *this );
+ }
+
+ void Execute()
+ {
+ fun_( p1_, p2_, p3_, p4_, p5_ );
+ }
+
+ ScopeGuardImpl5( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) :
+ fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ), p5_( p5 )
+ {}
+
+ protected:
+ F fun_;
+ const P1 p1_;
+ const P2 p2_;
+ const P3 p3_;
+ const P4 p4_;
+ const P5 p5_;
+ };
+
+ template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
+ inline ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
+ {
+ return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >::MakeGuard( fun, p1, p2, p3, p4, p5 );
+ }
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ObjScopeGuardImpl0
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a class per-instance member function with no
+ /// parameters. ScopeGuard ignores any value returned from the call within
+ /// the Execute function.
+ ///
+ /// This class has 3 standalone helper functions which create a ScopeGuard.
+ /// One is MakeObjGuard, which is deprecated but provided for older code.
+ /// The other two are MakeGuard overloads, one which takes a pointer to an
+ /// object, and the other which takes a reference.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template <class Obj, typename MemFun>
+ class ObjScopeGuardImpl0 : public ScopeGuardImplBase
+ {
+ public:
+ static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
+ {
+ return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
+ }
+
+ ~ObjScopeGuardImpl0() throw()
+ {
+ SafeExecute(*this);
+ }
+
+ void Execute()
+ {
+ (obj_.*memFun_)();
+ }
+
+ ObjScopeGuardImpl0(Obj& obj, MemFun memFun) : obj_(obj), memFun_(memFun)
+ {}
+
+ protected:
+ Obj& obj_;
+ MemFun memFun_;
+ };
+
+ template <class Obj, typename MemFun>
+ inline ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
+ {
+ return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
+ }
+
+ template <typename Ret, class Obj1, class Obj2>
+ inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 &obj)
+ {
+ return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(obj,memFun);
+ }
+
+ template <typename Ret, class Obj1, class Obj2>
+ inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 *obj)
+ {
+ return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(*obj,memFun);
+ }
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ObjScopeGuardImpl1
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a class per-instance member function with one
+ /// parameter. The parameter is copied by value - use ::Loki::ByRef if you
+ /// must use a reference instead. ScopeGuard ignores any value returned
+ /// from the call within the Execute function.
+ ///
+ /// This class has 3 standalone helper functions which create a ScopeGuard.
+ /// One is MakeObjGuard, which is deprecated but provided for older code.
+ /// The other two are MakeGuard overloads, one which takes a pointer to an
+ /// object, and the other which takes a reference.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template <class Obj, typename MemFun, typename P1>
+ class ObjScopeGuardImpl1 : public ScopeGuardImplBase
+ {
+ public:
+ static ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+ {
+ return ObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1);
+ }
+
+ ~ObjScopeGuardImpl1() throw()
+ {
+ SafeExecute(*this);
+ }
+
+ void Execute()
+ {
+ (obj_.*memFun_)(p1_);
+ }
+
+ ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) : obj_(obj), memFun_(memFun), p1_(p1)
+ {}
+
+ protected:
+ Obj& obj_;
+ MemFun memFun_;
+ const P1 p1_;
+ };
+
+ template <class Obj, typename MemFun, typename P1>
+ inline ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+ {
+ return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
+ }
+
+ template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
+ inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 &obj, P1b p1)
+ {
+ return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(obj,memFun,p1);
+ }
+
+ template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
+ inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 *obj, P1b p1)
+ {
+ return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(*obj,memFun,p1);
+ }
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ObjScopeGuardImpl2
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a class per-instance member function with two
+ /// parameters. Each parameter is copied by value - use ::Loki::ByRef if you
+ /// must use a reference instead. ScopeGuard ignores any value returned
+ /// from the call within the Execute function.
+ ///
+ /// This class has 3 standalone helper functions which create a ScopeGuard.
+ /// One is MakeObjGuard, which is deprecated but provided for older code.
+ /// The other two are MakeGuard overloads, one which takes a pointer to an
+ /// object, and the other which takes a reference.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template <class Obj, typename MemFun, typename P1, typename P2>
+ class ObjScopeGuardImpl2 : public ScopeGuardImplBase
+ {
+ public:
+ static ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+ {
+ return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2);
+ }
+
+ ~ObjScopeGuardImpl2() throw()
+ {
+ SafeExecute(*this);
+ }
+
+ void Execute()
+ {
+ (obj_.*memFun_)(p1_, p2_);
+ }
+
+ ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2)
+ {}
+
+ protected:
+ Obj& obj_;
+ MemFun memFun_;
+ const P1 p1_;
+ const P2 p2_;
+ };
+
+ template <class Obj, typename MemFun, typename P1, typename P2>
+ inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+ {
+ return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>::MakeObjGuard(obj, memFun, p1, p2);
+ }
+
+ template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
+ inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 &obj, P1b p1, P2b p2)
+ {
+ return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(obj,memFun,p1,p2);
+ }
+
+ template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
+ inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 *obj, P1b p1, P2b p2)
+ {
+ return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(*obj,memFun,p1,p2);
+ }
+
+ ////////////////////////////////////////////////////////////////
+ ///
+ /// \class ObjScopeGuardImpl3
+ /// \ingroup ExceptionGroup
+ ///
+ /// Implementation class for a class per-instance member function with three
+ /// parameters. Each parameter is copied by value - use ::Loki::ByRef if you
+ /// must use a reference instead. ScopeGuard ignores any value returned
+ /// from the call within the Execute function.
+ ///
+ /// This class has 3 standalone helper functions which create a ScopeGuard.
+ /// One is MakeObjGuard, which is deprecated but provided for older code.
+ /// The other two are MakeGuard overloads, one which takes a pointer to an
+ /// object, and the other which takes a reference.
+ ///
+ ////////////////////////////////////////////////////////////////
+
+ template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
+ class ObjScopeGuardImpl3 : public ScopeGuardImplBase
+ {
+ public:
+ static ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
+ Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
+ {
+ return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >( obj, memFun, p1, p2, p3 );
+ }
+
+ ~ObjScopeGuardImpl3() throw()
+ {
+ SafeExecute( *this );
+ }
+
+ void Execute()
+ {
+ ( obj_.*memFun_ )( p1_, p2_, p3_ );
+ }
+
+ ObjScopeGuardImpl3( Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) :
+ obj_( obj ), memFun_( memFun ), p1_( p1 ), p2_( p2 ), p3_( p3 )
+ {}
+
+ protected:
+ Obj& obj_;
+ MemFun memFun_;
+ const P1 p1_;
+ const P2 p2_;
+ const P3 p3_;
+ };
+
+ template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
+ inline ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
+ Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
+ {
+ return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >::MakeObjGuard(
+ obj, memFun, p1, p2, p3 );
+ }
+
+ template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
+ typename P2a, typename P2b, typename P3a, typename P3b >
+ inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+ MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 & obj, P1b p1, P2b p2, P3b p3 )
+ {
+ return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+ ::MakeObjGuard( obj, memFun, p1, p2, p3 );
+ }
+
+ template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
+ typename P2a, typename P2b, typename P3a, typename P3b >
+ inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+ MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 * obj, P1b p1, P2b p2, P3b p3 )
+ {
+ return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+ ::MakeObjGuard( *obj, memFun, p1, p2, p3 );
+ }
+
+} // namespace Loki
+
+#define LOKI_CONCATENATE_DIRECT(s1, s2) s1##s2
+#define LOKI_CONCATENATE(s1, s2) LOKI_CONCATENATE_DIRECT(s1, s2)
+#define LOKI_ANONYMOUS_VARIABLE(str) LOKI_CONCATENATE(str, __LINE__)
+
+#define LOKI_ON_BLOCK_EXIT ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeGuard
+#define LOKI_ON_BLOCK_EXIT_OBJ ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeObjGuard
+
+#endif // end file guardian
+
Added: code/trunk/src/external/loki/TypeManip.h
===================================================================
--- code/trunk/src/external/loki/TypeManip.h (rev 0)
+++ code/trunk/src/external/loki/TypeManip.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,98 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2001 by Andrei Alexandrescu
+// This code accompanies the book:
+// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
+// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+// Permission to use, copy, modify, distribute and sell this software for any
+// purpose is hereby granted without fee, provided that the above copyright
+// notice appear in all copies and that both that copyright notice and this
+// permission notice appear in supporting documentation.
+// The author or Addison-Welsey Longman make no representations about the
+// suitability of this software for any purpose. It is provided "as is"
+// without express or implied warranty.
+//
+// Changes by Orxonox (Reto Grieder)
+// Removed templates we didn't need
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_TYPEMANIP_INC_
+#define LOKI_TYPEMANIP_INC_
+
+// $Id: TypeManip.h 749 2006-10-17 19:49:26Z syntheticpp $
+
+
+namespace Loki
+{
+////////////////////////////////////////////////////////////////////////////////
+// class template Int2Type
+// Converts each integral constant into a unique type
+// Invocation: Int2Type<v> where v is a compile-time constant integral
+// Defines 'value', an enum that evaluates to v
+////////////////////////////////////////////////////////////////////////////////
+
+ template <int v>
+ struct Int2Type
+ {
+ enum { value = v };
+ };
+
+////////////////////////////////////////////////////////////////////////////////
+// class template Type2Type
+// Converts each type into a unique, insipid type
+// Invocation Type2Type<T> where T is a type
+// Defines the type OriginalType which maps back to T
+////////////////////////////////////////////////////////////////////////////////
+
+ template <typename T>
+ struct Type2Type
+ {
+ typedef T OriginalType;
+ };
+
+////////////////////////////////////////////////////////////////////////////////
+// class template Select
+// Selects one of two types based upon a boolean constant
+// Invocation: Select<flag, T, U>::Result
+// where:
+// flag is a compile-time boolean constant
+// T and U are types
+// Result evaluates to T if flag is true, and to U otherwise.
+////////////////////////////////////////////////////////////////////////////////
+
+ template <bool flag, typename T, typename U>
+ struct Select
+ {
+ typedef T Result;
+ };
+ template <typename T, typename U>
+ struct Select<false, T, U>
+ {
+ typedef U Result;
+ };
+
+////////////////////////////////////////////////////////////////////////////////
+// class template IsSameType
+// Return true iff two given types are the same
+// Invocation: SameType<T, U>::value
+// where:
+// T and U are types
+// Result evaluates to true iff U == T (types equal)
+////////////////////////////////////////////////////////////////////////////////
+
+ template <typename T, typename U>
+ struct IsSameType
+ {
+ enum { value = false };
+ };
+
+ template <typename T>
+ struct IsSameType<T,T>
+ {
+ enum { value = true };
+ };
+
+} // namespace Loki
+
+
+#endif // end file guardian
+
Property changes on: code/trunk/src/external/loki/TypeManip.h
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/trunk/src/external/loki/TypeTraits.h (from rev 7263, code/trunk/src/libraries/util/TypeTraits.h)
===================================================================
--- code/trunk/src/external/loki/TypeTraits.h (rev 0)
+++ code/trunk/src/external/loki/TypeTraits.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,279 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2001 by Andrei Alexandrescu
+// This code accompanies the book:
+// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
+// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+// Permission to use, copy, modify, distribute and sell this software for any
+// purpose is hereby granted without fee, provided that the above copyright
+// notice appear in all copies and that both that copyright notice and this
+// permission notice appear in supporting documentation.
+// The author or Addison-Wesley Longman make no representations about the
+// suitability of this software for any purpose. It is provided "as is"
+// without express or implied warranty.
+//
+// Changes by Orxonox (Reto Grieder)
+// Removed all stdInt, etc. type traits and function pointer traits
+// and added UnqualifiedReferredType.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_TYPETRAITS_INC_
+#define LOKI_TYPETRAITS_INC_
+
+// $Id: TypeTraits.h 1069 2010-04-19 03:09:59Z rich_sposato $
+
+
+#include <loki/NullType.h>
+
+#if (defined _MSC_VER) && (_MSC_VER < 1400)
+#include <string>
+#endif
+
+
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable : 4180 ) //qualifier applied to function type has no meaning; ignored
+#endif
+
+namespace Loki
+{
+////////////////////////////////////////////////////////////////////////////////
+// class template IsCustomUnsignedInt
+// Offers a means to integrate nonstandard built-in unsigned integral types
+// (such as unsigned __int64 or unsigned long long int) with the TypeTraits
+// class template defined below.
+// Invocation: IsCustomUnsignedInt<T> where T is any type
+// Defines 'value', an enum that is 1 iff T is a custom built-in unsigned
+// integral type
+// Specialize this class template for nonstandard unsigned integral types
+// and define value = 1 in those specializations
+////////////////////////////////////////////////////////////////////////////////
+
+ template <typename T>
+ struct IsCustomUnsignedInt
+ {
+ enum { value = 0 };
+ };
+
+////////////////////////////////////////////////////////////////////////////////
+// class template IsCustomSignedInt
+// Offers a means to integrate nonstandard built-in unsigned integral types
+// (such as unsigned __int64 or unsigned long long int) with the TypeTraits
+// class template defined below.
+// Invocation: IsCustomSignedInt<T> where T is any type
+// Defines 'value', an enum that is 1 iff T is a custom built-in signed
+// integral type
+// Specialize this class template for nonstandard unsigned integral types
+// and define value = 1 in those specializations
+////////////////////////////////////////////////////////////////////////////////
+
+ template <typename T>
+ struct IsCustomSignedInt
+ {
+ enum { value = 0 };
+ };
+
+////////////////////////////////////////////////////////////////////////////////
+// class template IsCustomFloat
+// Offers a means to integrate nonstandard floating point types with the
+// TypeTraits class template defined below.
+// Invocation: IsCustomFloat<T> where T is any type
+// Defines 'value', an enum that is 1 iff T is a custom built-in
+// floating point type
+// Specialize this class template for nonstandard unsigned integral types
+// and define value = 1 in those specializations
+////////////////////////////////////////////////////////////////////////////////
+
+ template <typename T>
+ struct IsCustomFloat
+ {
+ enum { value = 0 };
+ };
+
+////////////////////////////////////////////////////////////////////////////////
+// Helper types for class template TypeTraits defined below
+////////////////////////////////////////////////////////////////////////////////
+
+ namespace Private
+ {
+ template <typename U> struct AddPointer
+ {
+ typedef U* Result;
+ };
+
+ template <typename U> struct AddPointer<U&>
+ {
+ typedef U* Result;
+ };
+
+ template <class U> struct AddReference
+ {
+ typedef U & Result;
+ };
+
+ template <class U> struct AddReference<U &>
+ {
+ typedef U & Result;
+ };
+
+ template <> struct AddReference<void>
+ {
+ typedef NullType Result;
+ };
+
+ template <class U> struct AddParameterType
+ {
+ typedef const U & Result;
+ };
+
+ template <class U> struct AddParameterType<U &>
+ {
+ typedef U & Result;
+ };
+
+ template <> struct AddParameterType<void>
+ {
+ typedef NullType Result;
+ };
+ }// namespace Private
+
+////////////////////////////////////////////////////////////////////////////////
+// class template TypeTraits
+//
+// Figures out at compile time various properties of any given type
+// Invocations (T is a type, TypeTraits<T>::Property):
+//
+// - isPointer : returns true if T is a pointer type
+// - PointeeType : returns the type to which T points if T is a pointer
+// type, NullType otherwise
+// - isReference : returns true if T is a reference type
+// - ReferredType : returns the type to which T refers if T is a reference
+// type, NullType otherwise
+// - ParameterType : returns the optimal type to be used as a parameter for
+// functions that take Ts
+// - isConst : returns true if T is a const-qualified type
+// - NonConstType : Type with removed 'const' qualifier from T, if any
+// - isVolatile : returns true if T is a volatile-qualified type
+// - NonVolatileType : Type with removed 'volatile' qualifier from T, if any
+// - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from
+// T, if any
+// - ParameterType : returns the optimal type to be used as a parameter
+// for functions that take 'const T's
+//
+////////////////////////////////////////////////////////////////////////////////
+
+ template <typename T>
+ class TypeTraits
+ {
+ private:
+
+ template <class U> struct ReferenceTraits
+ {
+ enum { result = false };
+ typedef U ReferredType;
+ };
+
+ template <class U> struct ReferenceTraits<U&>
+ {
+ enum { result = true };
+ typedef U ReferredType;
+ };
+
+ template <class U> struct PointerTraits
+ {
+ enum { result = false };
+ typedef NullType PointeeType;
+ };
+
+ template <class U> struct PointerTraits<U*>
+ {
+ enum { result = true };
+ typedef U PointeeType;
+ };
+
+ template <class U> struct PointerTraits<U*&>
+ {
+ enum { result = true };
+ typedef U PointeeType;
+ };
+
+ template <class U> struct PToMTraits
+ {
+ enum { result = false };
+ };
+
+ template <class U, class V> struct PToMTraits<U V::*>
+ {
+ enum { result = true };
+ };
+
+ template <class U, class V> struct PToMTraits<U V::*&>
+ {
+ enum { result = true };
+ };
+
+ template <class U> struct UnConst
+ {
+ typedef U Result;
+ enum { isConst = 0 };
+ };
+
+ template <class U> struct UnConst<const U>
+ {
+ typedef U Result;
+ enum { isConst = 1 };
+ };
+
+ template <class U> struct UnConst<const U&>
+ {
+ typedef U& Result;
+ enum { isConst = 1 };
+ };
+
+ template <class U> struct UnVolatile
+ {
+ typedef U Result;
+ enum { isVolatile = 0 };
+ };
+
+ template <class U> struct UnVolatile<volatile U>
+ {
+ typedef U Result;
+ enum { isVolatile = 1 };
+ };
+
+ template <class U> struct UnVolatile<volatile U&>
+ {
+ typedef U& Result;
+ enum { isVolatile = 1 };
+ };
+
+ public:
+ typedef typename UnConst<T>::Result
+ NonConstType;
+ typedef typename UnVolatile<T>::Result
+ NonVolatileType;
+ typedef typename UnVolatile<typename UnConst<T>::Result>::Result
+ UnqualifiedType;
+ typedef typename PointerTraits<UnqualifiedType>::PointeeType
+ PointeeType;
+ typedef typename ReferenceTraits<T>::ReferredType
+ ReferredType;
+ typedef typename ReferenceTraits<typename UnVolatile<typename UnConst<T>::Result>::Result>::ReferredType
+ UnqualifiedReferredType;
+
+ enum { isConst = UnConst<T>::isConst };
+ enum { isVolatile = UnVolatile<T>::isVolatile };
+ enum { isReference = ReferenceTraits<UnqualifiedType>::result };
+ enum { isPointer = PointerTraits<
+ typename ReferenceTraits<UnqualifiedType>::ReferredType >::result};
+
+ };
+}
+
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif // _MSC_VER
+
+
+#endif // end file guardian
+
Added: code/trunk/src/external/loki/changes_orxonox.txt
===================================================================
--- code/trunk/src/external/loki/changes_orxonox.txt (rev 0)
+++ code/trunk/src/external/loki/changes_orxonox.txt 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,7 @@
+Many changes have been applied, mostly cutting out unneeded parts of the source.
+There is one actual code change in ScopeGuard.h (see file).
+
+Moreover the files in this folder only represent a small portion of the Loki library.
+
+VERSION:
+The files are based on revision 1069 of the official Loki Subversion repository.
Property changes on: code/trunk/src/external/loki/changes_orxonox.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/trunk/src/external/loki/static_check.h
===================================================================
--- code/trunk/src/external/loki/static_check.h (rev 0)
+++ code/trunk/src/external/loki/static_check.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2001 by Andrei Alexandrescu
+// This code accompanies the book:
+// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
+// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+// Permission to use, copy, modify, distribute and sell this software for any
+// purpose is hereby granted without fee, provided that the above copyright
+// notice appear in all copies and that both that copyright notice and this
+// permission notice appear in supporting documentation.
+// The author or Addison-Wesley Longman make no representations about the
+// suitability of this software for any purpose. It is provided "as is"
+// without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_STATIC_CHECK_INC_
+#define LOKI_STATIC_CHECK_INC_
+
+// $Id: static_check.h 982 2009-01-31 07:51:27Z rich_sposato $
+
+
+namespace Loki
+{
+////////////////////////////////////////////////////////////////////////////////
+// Helper structure for the STATIC_CHECK macro
+////////////////////////////////////////////////////////////////////////////////
+
+ template<int> struct CompileTimeError;
+ template<> struct CompileTimeError<true> {};
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// macro LOKI_STATIC_CHECK
+// Invocation: LOKI_STATIC_CHECK(expr, id)
+// where:
+// expr is a compile-time integral or pointer expression
+// id is a C++ identifier that does not need to be defined
+// If expr is zero, id will appear in a compile-time error message.
+////////////////////////////////////////////////////////////////////////////////
+
+#define LOKI_STATIC_CHECK(expr, msg) \
+ { Loki::CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; }
+
+
+#endif // end file guardian
+
Property changes on: code/trunk/src/external/loki/static_check.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/libraries/core/Core.h
===================================================================
--- code/trunk/src/libraries/core/Core.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/core/Core.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -35,7 +35,8 @@
#include <cassert>
#include <string>
#include <boost/scoped_ptr.hpp>
-#include "util/ScopeGuard.h"
+#include <loki/ScopeGuard.h>
+
#include "util/Singleton.h"
#include "OrxonoxClass.h"
Modified: code/trunk/src/libraries/core/CorePrecompiledHeaders.h
===================================================================
--- code/trunk/src/libraries/core/CorePrecompiledHeaders.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/core/CorePrecompiledHeaders.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -56,7 +56,7 @@
#include <list> // 44
#include <cmath> // 42
-#include "util/ScopeGuard.h" // 38
+#include <loki/ScopeGuard.h> // 38
#include <OgreMath.h> // 36
#include <OgreVector2.h> // 36
Modified: code/trunk/src/libraries/core/Game.cc
===================================================================
--- code/trunk/src/libraries/core/Game.cc 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/core/Game.cc 2010-08-30 15:04:12 UTC (rev 7266)
@@ -36,11 +36,11 @@
#include <exception>
#include <boost/weak_ptr.hpp>
+#include <loki/ScopeGuard.h>
#include "util/Clock.h"
#include "util/Debug.h"
#include "util/Exception.h"
-#include "util/ScopeGuard.h"
#include "util/Sleep.h"
#include "util/SubString.h"
#include "CommandLineParser.h"
Modified: code/trunk/src/libraries/core/Game.h
===================================================================
--- code/trunk/src/libraries/core/Game.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/core/Game.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -45,9 +45,9 @@
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/preprocessor/cat.hpp>
+#include <loki/ScopeGuard.h>
#include "util/Debug.h"
-#include "util/ScopeGuard.h"
#include "util/Singleton.h"
#include "OrxonoxClass.h"
Modified: code/trunk/src/libraries/core/Identifier.h
===================================================================
--- code/trunk/src/libraries/core/Identifier.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/core/Identifier.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -56,9 +56,9 @@
#include <set>
#include <string>
#include <typeinfo>
+#include <loki/TypeTraits.h>
#include "util/Debug.h"
-#include "util/TypeTraits.h"
#include "MetaObjectList.h"
#include "ObjectList.h"
#include "ObjectListBase.h"
Modified: code/trunk/src/libraries/core/LuaState.cc
===================================================================
--- code/trunk/src/libraries/core/LuaState.cc 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/core/LuaState.cc 2010-08-30 15:04:12 UTC (rev 7266)
@@ -34,10 +34,10 @@
#include <lua.h>
#include <lualib.h>
}
+#include <loki/ScopeGuard.h>
#include "util/Debug.h"
#include "util/Exception.h"
-#include "util/ScopeGuard.h"
#include "IOConsole.h"
#include "Resource.h"
#include "ToluaBindCore.h"
Modified: code/trunk/src/libraries/core/LuaState.h
===================================================================
--- code/trunk/src/libraries/core/LuaState.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/core/LuaState.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -37,8 +37,8 @@
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
+#include <loki/ScopeGuard.h>
-#include "util/ScopeGuard.h"
#include "Functor.h"
#include "ToluaInterface.h"
Modified: code/trunk/src/libraries/core/input/InputManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.cc 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/core/input/InputManager.cc 2010-08-30 15:04:12 UTC (rev 7266)
@@ -39,11 +39,11 @@
#include <ois/OISException.h>
#include <ois/OISInputManager.h>
#include <boost/foreach.hpp>
+#include <loki/ScopeGuard.h>
#include "util/Clock.h"
#include "util/Convert.h"
#include "util/Exception.h"
-#include "util/ScopeGuard.h"
#include "core/CoreIncludes.h"
#include "core/ConfigValueIncludes.h"
#include "core/ConsoleCommand.h"
Modified: code/trunk/src/libraries/network/NetworkPrecompiledHeaders.h
===================================================================
--- code/trunk/src/libraries/network/NetworkPrecompiledHeaders.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/network/NetworkPrecompiledHeaders.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -52,7 +52,7 @@
#include <set> // 20
#include "util/Debug.h" // 20
-#include "util/TypeTraits.h" // 18
+#include <loki/TypeTraits.h> // 18
#ifdef ORXONOX_COMPILER_MSVC
Modified: code/trunk/src/libraries/network/synchronisable/Serialise.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Serialise.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/network/synchronisable/Serialise.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -34,8 +34,11 @@
#ifndef _NetworkSerialise_H__
#define _NetworkSerialise_H__
+#include "network/NetworkPrereqs.h"
+
+#include <loki/TypeTraits.h>
+
#include "util/Serialise.h"
-#include "util/TypeTraits.h"
#include "core/CorePrereqs.h"
#include "core/CoreIncludes.h"
#include "core/SmartPtr.h"
Modified: code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -34,8 +34,9 @@
#include <cassert>
#include <cstring>
+#include <loki/TypeTraits.h>
+
#include "Serialise.h"
-#include "util/TypeTraits.h"
#include "core/GameMode.h"
#include "network/synchronisable/NetworkCallbackManager.h"
Modified: code/trunk/src/libraries/util/Convert.h
===================================================================
--- code/trunk/src/libraries/util/Convert.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/util/Convert.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -40,6 +40,7 @@
#include <string>
#include <sstream>
#include <typeinfo>
+#include <loki/TypeManip.h>
#include "Debug.h"
#include "TemplateUtils.h"
@@ -75,14 +76,6 @@
namespace orxonox
{
- namespace detail
- {
- //! Little template that maps integers to entire types (Alexandrescu 2001)
- template <int I>
- struct Int2Type { };
- }
-
-
///////////////////
// No Conversion //
///////////////////
@@ -214,14 +207,14 @@
// implicit cast not possible, try stringstream conversion next
template <class FromType, class ToType>
- FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, detail::Int2Type<false>)
+ FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<false>)
{
return ConverterStringStream<FromType, ToType>::convert(output, input);
}
// We can cast implicitely
template <class FromType, class ToType>
- FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, detail::Int2Type<true>)
+ FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<true>)
{
(*output) = static_cast<ToType>(input);
return true;
@@ -241,7 +234,7 @@
{
// Try implict cast and probe first. If a simple cast is not possible, it will not compile
// We therefore have to out source it into another template function
- return convertImplicitely(output, input, detail::Int2Type<probe>());
+ return convertImplicitely(output, input, Loki::Int2Type<probe>());
}
};
Modified: code/trunk/src/libraries/util/MultiType.h
===================================================================
--- code/trunk/src/libraries/util/MultiType.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/util/MultiType.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -75,9 +75,8 @@
#include <OgreVector4.h>
#include <OgreQuaternion.h>
#include <OgreColourValue.h>
+#include <loki/TypeTraits.h>
-#include "TypeTraits.h"
-
namespace orxonox
{
/**
Deleted: code/trunk/src/libraries/util/RefToValue.h
===================================================================
--- code/trunk/src/libraries/util/RefToValue.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/util/RefToValue.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -1,70 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The Loki Library
-// Copyright (c) 2006 Richard Sposato
-// Copyright (c) 2006 Peter Kümmel
-// Permission to use, copy, modify, distribute and sell this software for any
-// purpose is hereby granted without fee, provided that the above copyright
-// notice appear in all copies and that both that copyright notice and this
-// permission notice appear in supporting documentation.
-// The authors make no representations about the
-// suitability of this software for any purpose. It is provided "as is"
-// without express or implied warranty.
-////////////////////////////////////////////////////////////////////////////////
-#ifndef LOKI_REFTOVALUE_INC_
-#define LOKI_REFTOVALUE_INC_
-
-// $Id: RefToValue.h 751 2006-10-17 19:50:37Z syntheticpp $
-
-
-namespace Loki
-{
-
- ////////////////////////////////////////////////////////////////////////////////
- /// \class RefToValue
- ///
- /// \ingroup SmartPointerGroup
- /// Transports a reference as a value
- /// Serves to implement the Colvin/Gibbons trick for SmartPtr/ScopeGuard
- ////////////////////////////////////////////////////////////////////////////////
-
- template <class T>
- class RefToValue
- {
- public:
-
- RefToValue(T& ref) : ref_(ref)
- {}
-
- RefToValue(const RefToValue& rhs) : ref_(rhs.ref_)
- {}
-
- operator T& () const
- {
- return ref_;
- }
-
- private:
- // Disable - not implemented
- RefToValue();
- RefToValue& operator=(const RefToValue&);
-
- T& ref_;
- };
-
-
- ////////////////////////////////////////////////////////////////////////////////
- /// \ingroup ExceptionGroup
- /// RefToValue creator.
- ////////////////////////////////////////////////////////////////////////////////
-
- template <class T>
- inline RefToValue<T> ByRef(T& t)
- {
- return RefToValue<T>(t);
- }
-
-}
-
-
-#endif // end file guardian
-
Modified: code/trunk/src/libraries/util/Scope.h
===================================================================
--- code/trunk/src/libraries/util/Scope.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/util/Scope.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -34,9 +34,9 @@
#include <cassert>
#include <map>
#include <set>
+#include <loki/ScopeGuard.h>
#include "Debug.h"
-#include "ScopeGuard.h"
namespace orxonox
{
Deleted: code/trunk/src/libraries/util/ScopeGuard.h
===================================================================
--- code/trunk/src/libraries/util/ScopeGuard.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/util/ScopeGuard.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -1,666 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The Loki Library
-// Copyright (c) 2000 Andrei Alexandrescu
-// Copyright (c) 2000 Petru Marginean
-// Copyright (c) 2005 Joshua Lehrer
-//
-// Permission to use, copy, modify, distribute and sell this software for any
-// purpose is hereby granted without fee, provided that the above copyright
-// notice appear in all copies and that both that copyright notice and this
-// permission notice appear in supporting documentation.
-// The author makes no representations about the
-// suitability of this software for any purpose. It is provided "as is"
-// without express or implied warranty.
-////////////////////////////////////////////////////////////////////////////////
-#ifndef LOKI_SCOPEGUARD_INC_
-#define LOKI_SCOPEGUARD_INC_
-
-// $Id: ScopeGuard.h 799 2006-12-20 00:37:13Z rich_sposato $
-
-
-#include "RefToValue.h"
-
-/// \defgroup ExceptionGroup Exception-safe code
-
-namespace Loki
-{
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ScopeGuardImplBase
- /// \ingroup ExceptionGroup
- ///
- /// Base class used by all ScopeGuard implementations. All commonly used
- /// functions are in this class (e.g. - Dismiss and SafeExecute).
- ///
- /// See Andrei's and Petru Marginean's CUJ article
- /// http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm
- ///
- /// Changes to the original code by Joshua Lehrer:
- /// http://www.lehrerfamily.com/scopeguard.html
- ////////////////////////////////////////////////////////////////
-
- class ScopeGuardImplBase
- {
- /// Copy-assignment operator is not implemented and private.
- ScopeGuardImplBase& operator =(const ScopeGuardImplBase&);
-
- protected:
-
- ~ScopeGuardImplBase()
- {}
-
- /// Copy-constructor takes over responsibility from other ScopeGuard.
- ScopeGuardImplBase(const ScopeGuardImplBase& other) throw()
- : dismissed_(other.dismissed_)
- {
- other.Dismiss();
- }
-
- template <typename J>
- static void SafeExecute(J& j) throw()
- {
- if (!j.dismissed_)
- try
- {
- j.Execute();
- }
- catch(...)
- {}
- }
-
- mutable bool dismissed_;
-
- public:
- ScopeGuardImplBase() throw() : dismissed_(false)
- {}
-
- void Dismiss() const throw()
- {
- dismissed_ = true;
- }
- };
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \typedef typedef const ScopeGuardImplBase& ScopeGuard
- /// \ingroup ExceptionGroup
- ///
- ////////////////////////////////////////////////////////////////
-
- typedef const ScopeGuardImplBase& ScopeGuard;
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ScopeGuardImpl0
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a standalone function or class static function
- /// with no parameters. ScopeGuard ignores any value returned from the
- /// call within the Execute function.
- ///
- /// This class has a single standalone helper function, MakeGuard which
- /// creates and returns a ScopeGuard.
- ///
- ////////////////////////////////////////////////////////////////
-
- template <typename F>
- class ScopeGuardImpl0 : public ScopeGuardImplBase
- {
- public:
- static ScopeGuardImpl0<F> MakeGuard(F fun)
- {
- return ScopeGuardImpl0<F>(fun);
- }
-
- ~ScopeGuardImpl0() throw()
- {
- SafeExecute(*this);
- }
-
- void Execute()
- {
- fun_();
- }
-
- ScopeGuardImpl0(F fun) : fun_(fun)
- {}
-
- protected:
- F fun_;
- };
-
- template <typename F>
- inline ScopeGuardImpl0<F> MakeGuard(F fun)
- {
- return ScopeGuardImpl0<F>::MakeGuard(fun);
- }
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ScopeGuardImpl1
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a standalone function or class static function
- /// with one parameter. Each parameter is copied by value - use
- /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
- /// any value returned from the call within the Execute function.
- ///
- /// This class has a single standalone helper function, MakeGuard which
- /// creates and returns a ScopeGuard.
- ///
- ////////////////////////////////////////////////////////////////
-
- template <typename F, typename P1>
- class ScopeGuardImpl1 : public ScopeGuardImplBase
- {
- public:
- static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
- {
- return ScopeGuardImpl1<F, P1>(fun, p1);
- }
-
- ~ScopeGuardImpl1() throw()
- {
- SafeExecute(*this);
- }
-
- void Execute()
- {
- fun_(p1_);
- }
-
- ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1)
- {}
-
- protected:
- F fun_;
- const P1 p1_;
- };
-
- template <typename F, typename P1>
- inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
- {
- return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
- }
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ScopeGuardImpl2
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a standalone function or class static function
- /// with two parameters. Each parameter is copied by value - use
- /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
- /// any value returned from the call within the Execute function.
- ///
- /// This class has a single standalone helper function, MakeGuard which
- /// creates and returns a ScopeGuard.
- ///
- ////////////////////////////////////////////////////////////////
-
- template <typename F, typename P1, typename P2>
- class ScopeGuardImpl2: public ScopeGuardImplBase
- {
- public:
- static ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
- {
- return ScopeGuardImpl2<F, P1, P2>(fun, p1, p2);
- }
-
- ~ScopeGuardImpl2() throw()
- {
- SafeExecute(*this);
- }
-
- void Execute()
- {
- fun_(p1_, p2_);
- }
-
- ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2)
- {}
-
- protected:
- F fun_;
- const P1 p1_;
- const P2 p2_;
- };
-
- template <typename F, typename P1, typename P2>
- inline ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
- {
- return ScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2);
- }
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ScopeGuardImpl3
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a standalone function or class static function
- /// with three parameters. Each parameter is copied by value - use
- /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
- /// any value returned from the call within the Execute function.
- ///
- /// This class has a single standalone helper function, MakeGuard which
- /// creates and returns a ScopeGuard.
- ///
- ////////////////////////////////////////////////////////////////
-
- template <typename F, typename P1, typename P2, typename P3>
- class ScopeGuardImpl3 : public ScopeGuardImplBase
- {
- public:
- static ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
- {
- return ScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3);
- }
-
- ~ScopeGuardImpl3() throw()
- {
- SafeExecute(*this);
- }
-
- void Execute()
- {
- fun_(p1_, p2_, p3_);
- }
-
- ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3)
- {}
-
- protected:
- F fun_;
- const P1 p1_;
- const P2 p2_;
- const P3 p3_;
- };
-
- template <typename F, typename P1, typename P2, typename P3>
- inline ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
- {
- return ScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3);
- }
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ScopeGuardImpl4
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a standalone function or class static function
- /// with four parameters. Each parameter is copied by value - use
- /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
- /// any value returned from the call within the Execute function.
- ///
- /// This class has a single standalone helper function, MakeGuard which
- /// creates and returns a ScopeGuard.
- ///
- ////////////////////////////////////////////////////////////////
-
- template < typename F, typename P1, typename P2, typename P3, typename P4 >
- class ScopeGuardImpl4 : public ScopeGuardImplBase
- {
- public:
- static ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard(
- F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
- {
- return ScopeGuardImpl4< F, P1, P2, P3, P4 >( fun, p1, p2, p3, p4 );
- }
-
- ~ScopeGuardImpl4() throw()
- {
- SafeExecute( *this );
- }
-
- void Execute()
- {
- fun_( p1_, p2_, p3_, p4_ );
- }
-
- ScopeGuardImpl4( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) :
- fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 )
- {}
-
- protected:
- F fun_;
- const P1 p1_;
- const P2 p2_;
- const P3 p3_;
- const P4 p4_;
- };
-
- template < typename F, typename P1, typename P2, typename P3, typename P4 >
- inline ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
- {
- return ScopeGuardImpl4< F, P1, P2, P3, P4 >::MakeGuard( fun, p1, p2, p3, p4 );
- }
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ScopeGuardImpl5
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a standalone function or class static function
- /// with five parameters. Each parameter is copied by value - use
- /// ::Loki::ByRef if you must use a reference instead. ScopeGuard ignores
- /// any value returned from the call within the Execute function.
- ///
- /// This class has a single standalone helper function, MakeGuard which
- /// creates and returns a ScopeGuard.
- ///
- ////////////////////////////////////////////////////////////////
-
- template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
- class ScopeGuardImpl5 : public ScopeGuardImplBase
- {
- public:
- static ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard(
- F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
- {
- return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >( fun, p1, p2, p3, p4, p5 );
- }
-
- ~ScopeGuardImpl5() throw()
- {
- SafeExecute( *this );
- }
-
- void Execute()
- {
- fun_( p1_, p2_, p3_, p4_, p5_ );
- }
-
- ScopeGuardImpl5( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) :
- fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ), p5_( p5 )
- {}
-
- protected:
- F fun_;
- const P1 p1_;
- const P2 p2_;
- const P3 p3_;
- const P4 p4_;
- const P5 p5_;
- };
-
- template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
- inline ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
- {
- return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >::MakeGuard( fun, p1, p2, p3, p4, p5 );
- }
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ObjScopeGuardImpl0
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a class per-instance member function with no
- /// parameters. ScopeGuard ignores any value returned from the call within
- /// the Execute function.
- ///
- /// This class has 3 standalone helper functions which create a ScopeGuard.
- /// One is MakeObjGuard, which is deprecated but provided for older code.
- /// The other two are MakeGuard overloads, one which takes a pointer to an
- /// object, and the other which takes a reference.
- ///
- ////////////////////////////////////////////////////////////////
-
- template <class Obj, typename MemFun>
- class ObjScopeGuardImpl0 : public ScopeGuardImplBase
- {
- public:
- static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
- {
- return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
- }
-
- ~ObjScopeGuardImpl0() throw()
- {
- SafeExecute(*this);
- }
-
- void Execute()
- {
- (obj_.*memFun_)();
- }
-
- ObjScopeGuardImpl0(Obj& obj, MemFun memFun) : obj_(obj), memFun_(memFun)
- {}
-
- protected:
- Obj& obj_;
- MemFun memFun_;
- };
-
- template <class Obj, typename MemFun>
- inline ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
- {
- return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
- }
-
- template <typename Ret, class Obj1, class Obj2>
- inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 &obj)
- {
- return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(obj,memFun);
- }
-
- template <typename Ret, class Obj1, class Obj2>
- inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 *obj)
- {
- return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(*obj,memFun);
- }
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ObjScopeGuardImpl1
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a class per-instance member function with one
- /// parameter. The parameter is copied by value - use ::Loki::ByRef if you
- /// must use a reference instead. ScopeGuard ignores any value returned
- /// from the call within the Execute function.
- ///
- /// This class has 3 standalone helper functions which create a ScopeGuard.
- /// One is MakeObjGuard, which is deprecated but provided for older code.
- /// The other two are MakeGuard overloads, one which takes a pointer to an
- /// object, and the other which takes a reference.
- ///
- ////////////////////////////////////////////////////////////////
-
- template <class Obj, typename MemFun, typename P1>
- class ObjScopeGuardImpl1 : public ScopeGuardImplBase
- {
- public:
- static ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
- {
- return ObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1);
- }
-
- ~ObjScopeGuardImpl1() throw()
- {
- SafeExecute(*this);
- }
-
- void Execute()
- {
- (obj_.*memFun_)(p1_);
- }
-
- ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) : obj_(obj), memFun_(memFun), p1_(p1)
- {}
-
- protected:
- Obj& obj_;
- MemFun memFun_;
- const P1 p1_;
- };
-
- template <class Obj, typename MemFun, typename P1>
- inline ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
- {
- return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
- }
-
- template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
- inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 &obj, P1b p1)
- {
- return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(obj,memFun,p1);
- }
-
- template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
- inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 *obj, P1b p1)
- {
- return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(*obj,memFun,p1);
- }
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ObjScopeGuardImpl2
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a class per-instance member function with two
- /// parameters. Each parameter is copied by value - use ::Loki::ByRef if you
- /// must use a reference instead. ScopeGuard ignores any value returned
- /// from the call within the Execute function.
- ///
- /// This class has 3 standalone helper functions which create a ScopeGuard.
- /// One is MakeObjGuard, which is deprecated but provided for older code.
- /// The other two are MakeGuard overloads, one which takes a pointer to an
- /// object, and the other which takes a reference.
- ///
- ////////////////////////////////////////////////////////////////
-
- template <class Obj, typename MemFun, typename P1, typename P2>
- class ObjScopeGuardImpl2 : public ScopeGuardImplBase
- {
- public:
- static ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
- {
- return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2);
- }
-
- ~ObjScopeGuardImpl2() throw()
- {
- SafeExecute(*this);
- }
-
- void Execute()
- {
- (obj_.*memFun_)(p1_, p2_);
- }
-
- ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2)
- {}
-
- protected:
- Obj& obj_;
- MemFun memFun_;
- const P1 p1_;
- const P2 p2_;
- };
-
- template <class Obj, typename MemFun, typename P1, typename P2>
- inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
- {
- return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>::MakeObjGuard(obj, memFun, p1, p2);
- }
-
- template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
- inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 &obj, P1b p1, P2b p2)
- {
- return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(obj,memFun,p1,p2);
- }
-
- template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
- inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 *obj, P1b p1, P2b p2)
- {
- return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(*obj,memFun,p1,p2);
- }
-
- ////////////////////////////////////////////////////////////////
- ///
- /// \class ObjScopeGuardImpl3
- /// \ingroup ExceptionGroup
- ///
- /// Implementation class for a class per-instance member function with three
- /// parameters. Each parameter is copied by value - use ::Loki::ByRef if you
- /// must use a reference instead. ScopeGuard ignores any value returned
- /// from the call within the Execute function.
- ///
- /// This class has 3 standalone helper functions which create a ScopeGuard.
- /// One is MakeObjGuard, which is deprecated but provided for older code.
- /// The other two are MakeGuard overloads, one which takes a pointer to an
- /// object, and the other which takes a reference.
- ///
- ////////////////////////////////////////////////////////////////
-
- template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
- class ObjScopeGuardImpl3 : public ScopeGuardImplBase
- {
- public:
- static ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
- Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
- {
- return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >( obj, memFun, p1, p2, p3 );
- }
-
- ~ObjScopeGuardImpl3() throw()
- {
- SafeExecute( *this );
- }
-
- void Execute()
- {
- ( obj_.*memFun_ )( p1_, p2_, p3_ );
- }
-
- ObjScopeGuardImpl3( Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) :
- obj_( obj ), memFun_( memFun ), p1_( p1 ), p2_( p2 ), p3_( p3 )
- {}
-
- protected:
- Obj& obj_;
- MemFun memFun_;
- const P1 p1_;
- const P2 p2_;
- const P3 p3_;
- };
-
- template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
- inline ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
- Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
- {
- return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >::MakeObjGuard(
- obj, memFun, p1, p2, p3 );
- }
-
- template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
- typename P2a, typename P2b, typename P3a, typename P3b >
- inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
- MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 & obj, P1b p1, P2b p2, P3b p3 )
- {
- return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
- ::MakeObjGuard( obj, memFun, p1, p2, p3 );
- }
-
- template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
- typename P2a, typename P2b, typename P3a, typename P3b >
- inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
- MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 * obj, P1b p1, P2b p2, P3b p3 )
- {
- return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
- ::MakeObjGuard( *obj, memFun, p1, p2, p3 );
- }
-
-} // namespace Loki
-
-#define LOKI_CONCATENATE_DIRECT(s1, s2) s1##s2
-#define LOKI_CONCATENATE(s1, s2) LOKI_CONCATENATE_DIRECT(s1, s2)
-#define LOKI_ANONYMOUS_VARIABLE(str) LOKI_CONCATENATE(str, __LINE__)
-
-#define LOKI_ON_BLOCK_EXIT ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeGuard
-#define LOKI_ON_BLOCK_EXIT_OBJ ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeObjGuard
-
-#endif // end file guardian
-
Deleted: code/trunk/src/libraries/util/TypeTraits.h
===================================================================
--- code/trunk/src/libraries/util/TypeTraits.h 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/libraries/util/TypeTraits.h 2010-08-30 15:04:12 UTC (rev 7266)
@@ -1,285 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The Loki Library
-// Copyright (c) 2001 by Andrei Alexandrescu
-// This code accompanies the book:
-// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
-// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
-// Permission to use, copy, modify, distribute and sell this software for any
-// purpose is hereby granted without fee, provided that the above copyright
-// notice appear in all copies and that both that copyright notice and this
-// permission notice appear in supporting documentation.
-// The author or Addison-Wesley Longman make no representations about the
-// suitability of this software for any purpose. It is provided "as is"
-// without express or implied warranty.
-//
-// Changes by Orxonox (Reto)
-// Removed all stdInt, etc. type traits and function pointer traits
-// and added UnqualifiedReferredType.
-////////////////////////////////////////////////////////////////////////////////
-#ifndef LOKI_TYPETRAITS_INC_
-#define LOKI_TYPETRAITS_INC_
-
-// $Id: TypeTraits.h 835 2007-08-02 19:39:02Z syntheticpp $
-
-
-#if (defined _MSC_VER) && (_MSC_VER < 1400)
-#include <string>
-#endif
-
-
-#ifdef _MSC_VER
-#pragma warning( push )
-#pragma warning( disable : 4180 ) //qualifier applied to function type has no meaning; ignored
-#endif
-
-namespace Loki
-{
-////////////////////////////////////////////////////////////////////////////////
-// class NullType
-// Used as a placeholder for "no type here"
-// Useful as an end marker in typelists
-////////////////////////////////////////////////////////////////////////////////
-
- class NullType {};
-
-////////////////////////////////////////////////////////////////////////////////
-// class template IsCustomUnsignedInt
-// Offers a means to integrate nonstandard built-in unsigned integral types
-// (such as unsigned __int64 or unsigned long long int) with the TypeTraits
-// class template defined below.
-// Invocation: IsCustomUnsignedInt<T> where T is any type
-// Defines 'value', an enum that is 1 iff T is a custom built-in unsigned
-// integral type
-// Specialize this class template for nonstandard unsigned integral types
-// and define value = 1 in those specializations
-////////////////////////////////////////////////////////////////////////////////
-
- template <typename T>
- struct IsCustomUnsignedInt
- {
- enum { value = 0 };
- };
-
-////////////////////////////////////////////////////////////////////////////////
-// class template IsCustomSignedInt
-// Offers a means to integrate nonstandard built-in unsigned integral types
-// (such as unsigned __int64 or unsigned long long int) with the TypeTraits
-// class template defined below.
-// Invocation: IsCustomSignedInt<T> where T is any type
-// Defines 'value', an enum that is 1 iff T is a custom built-in signed
-// integral type
-// Specialize this class template for nonstandard unsigned integral types
-// and define value = 1 in those specializations
-////////////////////////////////////////////////////////////////////////////////
-
- template <typename T>
- struct IsCustomSignedInt
- {
- enum { value = 0 };
- };
-
-////////////////////////////////////////////////////////////////////////////////
-// class template IsCustomFloat
-// Offers a means to integrate nonstandard floating point types with the
-// TypeTraits class template defined below.
-// Invocation: IsCustomFloat<T> where T is any type
-// Defines 'value', an enum that is 1 iff T is a custom built-in
-// floating point type
-// Specialize this class template for nonstandard unsigned integral types
-// and define value = 1 in those specializations
-////////////////////////////////////////////////////////////////////////////////
-
- template <typename T>
- struct IsCustomFloat
- {
- enum { value = 0 };
- };
-
-////////////////////////////////////////////////////////////////////////////////
-// Helper types for class template TypeTraits defined below
-////////////////////////////////////////////////////////////////////////////////
-
- namespace Private
- {
- template <typename U> struct AddPointer
- {
- typedef U* Result;
- };
-
- template <typename U> struct AddPointer<U&>
- {
- typedef U* Result;
- };
-
- template <class U> struct AddReference
- {
- typedef U & Result;
- };
-
- template <class U> struct AddReference<U &>
- {
- typedef U & Result;
- };
-
- template <> struct AddReference<void>
- {
- typedef NullType Result;
- };
-
- template <class U> struct AddParameterType
- {
- typedef const U & Result;
- };
-
- template <class U> struct AddParameterType<U &>
- {
- typedef U & Result;
- };
-
- template <> struct AddParameterType<void>
- {
- typedef NullType Result;
- };
- }// namespace Private
-
-////////////////////////////////////////////////////////////////////////////////
-// class template TypeTraits
-//
-// Figures out at compile time various properties of any given type
-// Invocations (T is a type, TypeTraits<T>::Property):
-//
-// - isPointer : returns true if T is a pointer type
-// - PointeeType : returns the type to which T points if T is a pointer
-// type, NullType otherwise
-// - isReference : returns true if T is a reference type
-// - ReferredType : returns the type to which T refers if T is a reference
-// type, NullType otherwise
-// - ParameterType : returns the optimal type to be used as a parameter for
-// functions that take Ts
-// - isConst : returns true if T is a const-qualified type
-// - NonConstType : Type with removed 'const' qualifier from T, if any
-// - isVolatile : returns true if T is a volatile-qualified type
-// - NonVolatileType : Type with removed 'volatile' qualifier from T, if any
-// - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from
-// T, if any
-// - ParameterType : returns the optimal type to be used as a parameter
-// for functions that take 'const T's
-//
-////////////////////////////////////////////////////////////////////////////////
-
- template <typename T>
- class TypeTraits
- {
- private:
-
- template <class U> struct ReferenceTraits
- {
- enum { result = false };
- typedef U ReferredType;
- };
-
- template <class U> struct ReferenceTraits<U&>
- {
- enum { result = true };
- typedef U ReferredType;
- };
-
- template <class U> struct PointerTraits
- {
- enum { result = false };
- typedef NullType PointeeType;
- };
-
- template <class U> struct PointerTraits<U*>
- {
- enum { result = true };
- typedef U PointeeType;
- };
-
- template <class U> struct PointerTraits<U*&>
- {
- enum { result = true };
- typedef U PointeeType;
- };
-
- template <class U> struct PToMTraits
- {
- enum { result = false };
- };
-
- template <class U, class V> struct PToMTraits<U V::*>
- {
- enum { result = true };
- };
-
- template <class U, class V> struct PToMTraits<U V::*&>
- {
- enum { result = true };
- };
-
- template <class U> struct UnConst
- {
- typedef U Result;
- enum { isConst = 0 };
- };
-
- template <class U> struct UnConst<const U>
- {
- typedef U Result;
- enum { isConst = 1 };
- };
-
- template <class U> struct UnConst<const U&>
- {
- typedef U& Result;
- enum { isConst = 1 };
- };
-
- template <class U> struct UnVolatile
- {
- typedef U Result;
- enum { isVolatile = 0 };
- };
-
- template <class U> struct UnVolatile<volatile U>
- {
- typedef U Result;
- enum { isVolatile = 1 };
- };
-
- template <class U> struct UnVolatile<volatile U&>
- {
- typedef U& Result;
- enum { isVolatile = 1 };
- };
-
- public:
- typedef typename UnConst<T>::Result
- NonConstType;
- typedef typename UnVolatile<T>::Result
- NonVolatileType;
- typedef typename UnVolatile<typename UnConst<T>::Result>::Result
- UnqualifiedType;
- typedef typename PointerTraits<UnqualifiedType>::PointeeType
- PointeeType;
- typedef typename ReferenceTraits<T>::ReferredType
- ReferredType;
- typedef typename ReferenceTraits<typename UnVolatile<typename UnConst<T>::Result>::Result>::ReferredType
- UnqualifiedReferredType;
-
- enum { isConst = UnConst<T>::isConst };
- enum { isVolatile = UnVolatile<T>::isVolatile };
- enum { isReference = ReferenceTraits<UnqualifiedType>::result };
- enum { isPointer = PointerTraits<
- typename ReferenceTraits<UnqualifiedType>::ReferredType >::result};
-
- };
-}
-
-#ifdef _MSC_VER
-#pragma warning( pop )
-#endif // _MSC_VER
-
-
-#endif // end file guardian
-
Modified: code/trunk/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/trunk/src/orxonox/sound/SoundManager.cc 2010-08-30 11:19:11 UTC (rev 7265)
+++ code/trunk/src/orxonox/sound/SoundManager.cc 2010-08-30 15:04:12 UTC (rev 7266)
@@ -32,10 +32,10 @@
#include <AL/alut.h>
#include <utility>
+#include <loki/ScopeGuard.h>
#include "util/Exception.h"
#include "util/Math.h"
-#include "util/ScopeGuard.h"
#include "util/Clock.h"
#include "core/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
More information about the Orxonox-commit
mailing list