diff options
Diffstat (limited to 'src/framework/Policies')
-rw-r--r-- | src/framework/Policies/CreationPolicy.h | 22 | ||||
-rw-r--r-- | src/framework/Policies/ObjectLifeTime.cpp | 12 | ||||
-rw-r--r-- | src/framework/Policies/ObjectLifeTime.h | 18 | ||||
-rw-r--r-- | src/framework/Policies/Singleton.h | 22 | ||||
-rw-r--r-- | src/framework/Policies/SingletonImp.h | 40 | ||||
-rw-r--r-- | src/framework/Policies/ThreadingModel.h | 26 |
6 files changed, 76 insertions, 64 deletions
diff --git a/src/framework/Policies/CreationPolicy.h b/src/framework/Policies/CreationPolicy.h index 20419982965..fbf606dc28b 100644 --- a/src/framework/Policies/CreationPolicy.h +++ b/src/framework/Policies/CreationPolicy.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> * * 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 @@ -8,27 +10,27 @@ * * 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 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_CREATIONPOLICY_H -#define MANGOS_CREATIONPOLICY_H +#ifndef TRINITY_CREATIONPOLICY_H +#define TRINITY_CREATIONPOLICY_H #include <stdlib.h> #include "Platform/Define.h" -namespace MaNGOS +namespace Trinity { /** * OperatorNew policy creates an object on the heap using new. */ template <class T> - class MANGOS_DLL_DECL OperatorNew + class TRINITY_DLL_DECL OperatorNew { public: static T* Create(void) { return (new T); } @@ -40,7 +42,7 @@ namespace MaNGOS * the first time call Create. */ template <class T> - class MANGOS_DLL_DECL LocalStaticCreation + class TRINITY_DLL_DECL LocalStaticCreation { union MaxAlign { @@ -69,7 +71,7 @@ namespace MaNGOS * CreateUsingMalloc by pass the memory manger. */ template<class T> - class MANGOS_DLL_DECL CreateUsingMalloc + class TRINITY_DLL_DECL CreateUsingMalloc { public: static T* Create() @@ -90,7 +92,7 @@ namespace MaNGOS * CreateOnCallBack creates the object base on the call back. */ template<class T, class CALL_BACK> - class MANGOS_DLL_DECL CreateOnCallBack + class TRINITY_DLL_DECL CreateOnCallBack { public: static T* Create() diff --git a/src/framework/Policies/ObjectLifeTime.cpp b/src/framework/Policies/ObjectLifeTime.cpp index af40edc1274..0f2de5a752b 100644 --- a/src/framework/Policies/ObjectLifeTime.cpp +++ b/src/framework/Policies/ObjectLifeTime.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> * * 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 @@ -8,25 +10,25 @@ * * 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 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <cstdlib> #include "ObjectLifeTime.h" -namespace MaNGOS +namespace Trinity { extern "C" void external_wrapper(void *p) { std::atexit( (void (*)())p ); } - void MANGOS_DLL_SPEC at_exit( void (*func)() ) + void TRINITY_DLL_SPEC at_exit( void (*func)() ) { external_wrapper((void*)func); } diff --git a/src/framework/Policies/ObjectLifeTime.h b/src/framework/Policies/ObjectLifeTime.h index c47daaca339..bfdda4491f3 100644 --- a/src/framework/Policies/ObjectLifeTime.h +++ b/src/framework/Policies/ObjectLifeTime.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> * * 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 @@ -8,28 +10,28 @@ * * 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 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_OBJECTLIFETIME_H -#define MANGOS_OBJECTLIFETIME_H +#ifndef TRINITY_OBJECTLIFETIME_H +#define TRINITY_OBJECTLIFETIME_H #include <stdexcept> #include "Platform/Define.h" typedef void (* Destroyer)(void); -namespace MaNGOS +namespace Trinity { - void MANGOS_DLL_SPEC at_exit( void (*func)() ); + void TRINITY_DLL_SPEC at_exit( void (*func)() ); template <class T> - class MANGOS_DLL_DECL ObjectLifeTime + class TRINITY_DLL_DECL ObjectLifeTime { public: inline static void ScheduleCall(void (*destroyer)() ) diff --git a/src/framework/Policies/Singleton.h b/src/framework/Policies/Singleton.h index b70c5486dff..5c78a267398 100644 --- a/src/framework/Policies/Singleton.h +++ b/src/framework/Policies/Singleton.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> * * 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 @@ -8,16 +10,16 @@ * * 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 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SINGLETON_H -#define MANGOS_SINGLETON_H +#ifndef TRINITY_SINGLETON_H +#define TRINITY_SINGLETON_H /** * @brief class Singleton @@ -27,16 +29,16 @@ #include "ThreadingModel.h" #include "ObjectLifeTime.h" -namespace MaNGOS +namespace Trinity { template < typename T, - class ThreadingModel = MaNGOS::SingleThreaded<T>, - class CreatePolicy = MaNGOS::OperatorNew<T>, - class LifeTimePolicy = MaNGOS::ObjectLifeTime<T> + class ThreadingModel = Trinity::SingleThreaded<T>, + class CreatePolicy = Trinity::OperatorNew<T>, + class LifeTimePolicy = Trinity::ObjectLifeTime<T> > - class MANGOS_DLL_DECL Singleton + class TRINITY_DLL_DECL Singleton { public: static T& Instance(); diff --git a/src/framework/Policies/SingletonImp.h b/src/framework/Policies/SingletonImp.h index ce0a4403472..6634332f052 100644 --- a/src/framework/Policies/SingletonImp.h +++ b/src/framework/Policies/SingletonImp.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> * * 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 @@ -8,16 +10,16 @@ * * 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 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SINGLETONIMPL_H -#define MANGOS_SINGLETONIMPL_H +#ifndef TRINITY_SINGLETONIMPL_H +#define TRINITY_SINGLETONIMPL_H #include "Singleton.h" @@ -32,7 +34,7 @@ class CreatePolicy, class LifeTimePolicy > T& -MaNGOS::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy >::Instance() +Trinity::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy >::Instance() { if( !si_instance ) { @@ -61,7 +63,7 @@ class CreatePolicy, class LifeTimePolicy > void -MaNGOS::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy>::DestroySingleton() +Trinity::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy>::DestroySingleton() { CreatePolicy::Destroy(si_instance); si_instance = NULL; @@ -69,22 +71,22 @@ MaNGOS::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy>::DestroySingl } #define INSTANTIATE_SINGLETON_1(TYPE) \ - template class MANGOS_DLL_DECL MaNGOS::Singleton<TYPE, MaNGOS::SingleThreaded<TYPE>, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >; \ - template<> TYPE* MaNGOS::Singleton<TYPE, MaNGOS::SingleThreaded<TYPE>, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >::si_instance = 0; \ - template<> bool MaNGOS::Singleton<TYPE, MaNGOS::SingleThreaded<TYPE>, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >::si_destroyed = false + template class TRINITY_DLL_DECL Trinity::Singleton<TYPE, Trinity::SingleThreaded<TYPE>, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >; \ + template<> TYPE* Trinity::Singleton<TYPE, Trinity::SingleThreaded<TYPE>, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >::si_instance = 0; \ + template<> bool Trinity::Singleton<TYPE, Trinity::SingleThreaded<TYPE>, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >::si_destroyed = false #define INSTANTIATE_SINGLETON_2(TYPE, THREADINGMODEL) \ - template class MANGOS_DLL_DECL MaNGOS::Singleton<TYPE, THREADINGMODEL, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >; \ - template<> TYPE* MaNGOS::Singleton<TYPE, THREADINGMODEL, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >::si_instance = 0; \ - template<> bool MaNGOS::Singleton<TYPE, THREADINGMODEL, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >::si_destroyed = false + template class TRINITY_DLL_DECL Trinity::Singleton<TYPE, THREADINGMODEL, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >; \ + template<> TYPE* Trinity::Singleton<TYPE, THREADINGMODEL, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >::si_instance = 0; \ + template<> bool Trinity::Singleton<TYPE, THREADINGMODEL, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >::si_destroyed = false #define INSTANTIATE_SINGLETON_3(TYPE, THREADINGMODEL, CREATIONPOLICY ) \ - template class MANGOS_DLL_DECL MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, MaNGOS::ObjectLifeTime<TYPE> >; \ - template<> TYPE* MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, MaNGOS::ObjectLifeTime<TYPE> >::si_instance = 0; \ - template<> bool MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, MaNGOS::ObjectLifeType<TYPE> >::si_destroyed = false + template class TRINITY_DLL_DECL Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, Trinity::ObjectLifeTime<TYPE> >; \ + template<> TYPE* Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, Trinity::ObjectLifeTime<TYPE> >::si_instance = 0; \ + template<> bool Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, Trinity::ObjectLifeType<TYPE> >::si_destroyed = false #define INSTANTIATE_SINGLETON_4(TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME) \ - template class MANGOS_DLL_DECL MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >; \ - template<> TYPE* MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >::si_instance = 0; \ - template<> bool MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >::si_destroyed = false + template class TRINITY_DLL_DECL Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >; \ + template<> TYPE* Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >::si_instance = 0; \ + template<> bool Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >::si_destroyed = false #endif diff --git a/src/framework/Policies/ThreadingModel.h b/src/framework/Policies/ThreadingModel.h index 8175b3f82af..53a6939c52e 100644 --- a/src/framework/Policies/ThreadingModel.h +++ b/src/framework/Policies/ThreadingModel.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> * * 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 @@ -8,16 +10,16 @@ * * 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 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_THREADINGMODEL_H -#define MANGOS_THREADINGMODEL_H +#ifndef TRINITY_THREADINGMODEL_H +#define TRINITY_THREADINGMODEL_H /** * @class ThreadingModel<T> @@ -26,11 +28,11 @@ #include "Platform/Define.h" -namespace MaNGOS +namespace Trinity { inline void Guard(void *) {} - template<typename MUTEX> class MANGOS_DLL_DECL GeneralLock + template<typename MUTEX> class TRINITY_DLL_DECL GeneralLock { public: GeneralLock(MUTEX &m) : i_mutex(m) @@ -49,7 +51,7 @@ namespace MaNGOS }; template <class T> - class MANGOS_DLL_DECL SingleThreaded + class TRINITY_DLL_DECL SingleThreaded { public: @@ -67,7 +69,7 @@ namespace MaNGOS // object level lockable template<class T, class MUTEX> - class MANGOS_DLL_DECL ObjectLevelLockable + class TRINITY_DLL_DECL ObjectLevelLockable { public: ObjectLevelLockable() : i_mtx() {} @@ -96,7 +98,7 @@ namespace MaNGOS }; template<class T, class MUTEX> - class MANGOS_DLL_DECL ClassLevelLockable + class TRINITY_DLL_DECL ClassLevelLockable { public: class Lock; @@ -120,8 +122,8 @@ namespace MaNGOS } -template<class T, class MUTEX> MUTEX MaNGOS::ClassLevelLockable<T, MUTEX>::si_mtx; +template<class T, class MUTEX> MUTEX Trinity::ClassLevelLockable<T, MUTEX>::si_mtx; #define INSTANTIATE_CLASS_MUTEX(CTYPE,MUTEX) \ - template class MANGOS_DLL_DECL MaNGOS::ClassLevelLockable<CTYPE, MUTEX > + template class TRINITY_DLL_DECL Trinity::ClassLevelLockable<CTYPE, MUTEX > #endif |