aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <none@none>2010-12-22 20:52:47 +0100
committerShauren <none@none>2010-12-22 20:52:47 +0100
commit0948fc5bbed08ae6edee4fa1ff86df5cfbffa996 (patch)
tree12cec534711f07b659ad644dd27bb0a2dabe7d97 /src
parent7b4e1c6387a6787c2b2822494abae6b717f24547 (diff)
Core: Converted (hopefully) all remaining singletons to use ACE_Singleton class
--HG-- branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Scripting/ScriptSystem.cpp10
-rw-r--r--src/server/game/Scripting/ScriptSystem.h12
-rwxr-xr-xsrc/server/game/Server/WorldSocketMgr.cpp7
-rwxr-xr-xsrc/server/game/Server/WorldSocketMgr.h42
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp6
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h8
6 files changed, 28 insertions, 57 deletions
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index 590ff3e9ed3..672c0cca726 100755
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -21,16 +21,6 @@
#include "ObjectMgr.h"
#include "DatabaseEnv.h"
-SystemMgr::SystemMgr()
-{
-}
-
-SystemMgr& SystemMgr::Instance()
-{
- static SystemMgr pSysMgr;
- return pSysMgr;
-}
-
void SystemMgr::LoadVersion()
{
//Get Version information
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h
index 52401502c83..27a20f009a6 100644
--- a/src/server/game/Scripting/ScriptSystem.h
+++ b/src/server/game/Scripting/ScriptSystem.h
@@ -4,6 +4,7 @@
#ifndef SC_SYSTEM_H
#define SC_SYSTEM_H
+#include <ace/Singleton.h>
#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
@@ -51,13 +52,10 @@ struct StringTextData
class SystemMgr
{
- public:
-
- SystemMgr();
+ friend class ACE_Singleton<SystemMgr, ACE_Null_Mutex>;
+ SystemMgr() {}
~SystemMgr() {}
-
- static SystemMgr& Instance();
-
+ public:
//Maps and lists
typedef UNORDERED_MAP<int32, StringTextData> TextDataMap;
typedef UNORDERED_MAP<uint32, std::vector<ScriptPointMove> > PointMoveMap;
@@ -97,6 +95,6 @@ class SystemMgr
PointMoveMap m_mPointMoveMap; //coordinates for waypoints
};
-#define sScriptSystemMgr SystemMgr::Instance()
+#define sScriptSystemMgr (*ACE_Singleton<SystemMgr, ACE_Null_Mutex>::instance())
#endif
diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp
index 802541fefa4..b49d3a98ef8 100755
--- a/src/server/game/Server/WorldSocketMgr.cpp
+++ b/src/server/game/Server/WorldSocketMgr.cpp
@@ -363,10 +363,3 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
return m_NetThreads[min].AddSocket (sock);
}
-
-WorldSocketMgr*
-WorldSocketMgr::Instance()
-{
- return ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>::instance();
-}
-
diff --git a/src/server/game/Server/WorldSocketMgr.h b/src/server/game/Server/WorldSocketMgr.h
index dc00c3b4947..abc8a67b83a 100755
--- a/src/server/game/Server/WorldSocketMgr.h
+++ b/src/server/game/Server/WorldSocketMgr.h
@@ -37,42 +37,38 @@ class ACE_Event_Handler;
class WorldSocketMgr
{
public:
- friend class WorldSocket;
- friend class ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>;
+ friend class WorldSocket;
+ friend class ACE_Singleton<WorldSocketMgr, ACE_Thread_Mutex>;
- /// Start network, listen at address:port .
- int StartNetwork (ACE_UINT16 port, const char* address);
+ /// Start network, listen at address:port .
+ int StartNetwork(ACE_UINT16 port, const char* address);
- /// Stops all network threads, It will wait for all running threads .
- void StopNetwork();
+ /// Stops all network threads, It will wait for all running threads .
+ void StopNetwork();
- /// Wait untill all network threads have "joined" .
- void Wait();
-
- /// Make this class singleton .
- static WorldSocketMgr* Instance();
+ /// Wait untill all network threads have "joined" .
+ void Wait();
private:
- int OnSocketOpen(WorldSocket* sock);
+ int OnSocketOpen(WorldSocket* sock);
- int StartReactiveIO(ACE_UINT16 port, const char* address);
+ int StartReactiveIO(ACE_UINT16 port, const char* address);
private:
- WorldSocketMgr();
- virtual ~WorldSocketMgr();
+ WorldSocketMgr();
+ virtual ~WorldSocketMgr();
- ReactorRunnable* m_NetThreads;
- size_t m_NetThreadsCount;
+ ReactorRunnable* m_NetThreads;
+ size_t m_NetThreadsCount;
- int m_SockOutKBuff;
- int m_SockOutUBuff;
- bool m_UseNoDelay;
+ int m_SockOutKBuff;
+ int m_SockOutUBuff;
+ bool m_UseNoDelay;
- ACE_Event_Handler* m_Acceptor;
+ ACE_Event_Handler* m_Acceptor;
};
-#define sWorldSocketMgr WorldSocketMgr::Instance()
+#define sWorldSocketMgr ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>::instance()
#endif
/// @}
-
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index c5a1e6a35f3..925a0c947a4 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -256,12 +256,6 @@ SpellMgr::~SpellMgr()
{
}
-SpellMgr& SpellMgr::Instance()
-{
- static SpellMgr spellMgr;
- return spellMgr;
-}
-
bool SpellMgr::IsSrcTargetSpell(SpellEntry const *spellInfo) const
{
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index 7e4d51b5a99..8b5cf987267 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -21,6 +21,7 @@
// For static or at-server-startup loaded spell data
// For more high level function for sSpellStore data
+#include <ace/Singleton.h>
#include "SharedDefines.h"
#include "SpellAuraDefines.h"
@@ -914,8 +915,7 @@ inline bool IsProfessionOrRidingSkill(uint32 skill)
class SpellMgr
{
- // Constructors
- public:
+ friend class ACE_Singleton<SpellMgr, ACE_Null_Mutex>;
SpellMgr();
~SpellMgr();
@@ -1387,7 +1387,6 @@ class SpellMgr
// Modifiers
public:
- static SpellMgr& Instance();
// Loading data at server startup
void LoadSpellRanks();
@@ -1443,5 +1442,6 @@ class SpellMgr
SpellDifficultySearcherMap mSpellDifficultySearcherMap;
};
-#define sSpellMgr SpellMgr::Instance()
+#define sSpellMgr (*ACE_Singleton<SpellMgr, ACE_Null_Mutex>::instance())
+
#endif