mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
feat(Core/Misc): remove and replace ACE_Singleton (#2418)
This commit is contained in:
@@ -22,6 +22,12 @@ PacketLog::~PacketLog()
|
||||
_file = NULL;
|
||||
}
|
||||
|
||||
PacketLog* PacketLog::instance()
|
||||
{
|
||||
static PacketLog instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void PacketLog::Initialize()
|
||||
{
|
||||
std::string logsDir = sConfigMgr->GetStringDefault("LogsDir", "");
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define ACORE_PACKETLOG_H
|
||||
|
||||
#include "Common.h"
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
enum Direction
|
||||
{
|
||||
@@ -20,13 +19,13 @@ class WorldPacket;
|
||||
|
||||
class PacketLog
|
||||
{
|
||||
friend class ACE_Singleton<PacketLog, ACE_Thread_Mutex>;
|
||||
|
||||
private:
|
||||
PacketLog();
|
||||
~PacketLog();
|
||||
|
||||
public:
|
||||
static PacketLog* instance();
|
||||
|
||||
void Initialize();
|
||||
bool CanLogPacket() const { return (_file != NULL); }
|
||||
void LogPacket(WorldPacket const& packet, Direction direction);
|
||||
@@ -35,5 +34,6 @@ class PacketLog
|
||||
FILE* _file;
|
||||
};
|
||||
|
||||
#define sPacketLog ACE_Singleton<PacketLog, ACE_Thread_Mutex>::instance()
|
||||
#define sPacketLog PacketLog::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -219,6 +219,12 @@ WorldSocketMgr::~WorldSocketMgr()
|
||||
delete m_Acceptor;
|
||||
}
|
||||
|
||||
WorldSocketMgr* WorldSocketMgr::instance()
|
||||
{
|
||||
static WorldSocketMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
int
|
||||
WorldSocketMgr::StartReactiveIO (uint16 port, const char* address)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include <ace/Basic_Types.h>
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
|
||||
class WorldSocket;
|
||||
@@ -27,8 +26,9 @@ class WorldSocketMgr
|
||||
{
|
||||
public:
|
||||
friend class WorldSocket;
|
||||
friend class ACE_Singleton<WorldSocketMgr, ACE_Thread_Mutex>;
|
||||
|
||||
static WorldSocketMgr* instance();
|
||||
|
||||
/// Start network, listen at address:port .
|
||||
int StartNetwork(uint16 port, const char* address);
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
class WorldSocketAcceptor* m_Acceptor;
|
||||
};
|
||||
|
||||
#define sWorldSocketMgr ACE_Singleton<WorldSocketMgr, ACE_Thread_Mutex>::instance()
|
||||
#define sWorldSocketMgr WorldSocketMgr::instance()
|
||||
|
||||
#endif
|
||||
/// @}
|
||||
|
||||
Reference in New Issue
Block a user