refactor(Core): rename namespaces and macros to acore (#2454)

This commit is contained in:
Viste
2019-12-01 15:13:31 +03:00
committed by Francesco Borzì
parent e19e95e5d0
commit e22d78ecd6
278 changed files with 1292 additions and 1309 deletions

View File

@@ -4,12 +4,12 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef _TRINITY_AUTO_PTR_H
#define _TRINITY_AUTO_PTR_H
#ifndef _ACORE_AUTO_PTR_H
#define _ACORE_AUTO_PTR_H
#include <ace/Bound_Ptr.h>
namespace Trinity
namespace acore
{
template <class Pointer, class Lock>
@@ -37,6 +37,6 @@ public:
}
};
} // namespace Trinity
} // namespace acore
#endif

View File

@@ -93,7 +93,7 @@ namespace MMAP
bool MMapManager::loadMap(uint32 mapId, int32 x, int32 y)
{
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
// make sure the mmap is loaded and ready to load tiles
if(!loadMapData(mapId))
@@ -161,7 +161,7 @@ namespace MMAP
dtStatus stat;
{
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
stat = mmap->navMesh->addTile(data, fileHeader.size, DT_TILE_FREE_DATA, 0, &tileRef);
}
@@ -188,7 +188,7 @@ namespace MMAP
bool MMapManager::unloadMap(uint32 mapId, int32 x, int32 y)
{
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
// check if we have this map loaded
if (loadedMMaps.find(mapId) == loadedMMaps.end())
@@ -217,7 +217,7 @@ namespace MMAP
dtStatus status;
{
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
status = mmap->navMesh->removeTile(tileRef, NULL, NULL);
}
@@ -245,7 +245,7 @@ namespace MMAP
bool MMapManager::unloadMap(uint32 mapId)
{
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
if (loadedMMaps.find(mapId) == loadedMMaps.end())
{
@@ -265,7 +265,7 @@ namespace MMAP
dtStatus status;
{
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
status = mmap->navMesh->removeTile(i->second, NULL, NULL);
}
@@ -291,7 +291,7 @@ namespace MMAP
bool MMapManager::unloadMapInstance(uint32 mapId, uint32 instanceId)
{
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
// check if we have this map loaded
if (loadedMMaps.find(mapId) == loadedMMaps.end())
@@ -326,7 +326,7 @@ namespace MMAP
dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId)
{
// pussywizard: moved to calling function
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
//ACORE_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
if (loadedMMaps.find(mapId) == loadedMMaps.end())
return NULL;
@@ -337,7 +337,7 @@ namespace MMAP
dtNavMeshQuery const* MMapManager::GetNavMeshQuery(uint32 mapId, uint32 instanceId)
{
// pussywizard: moved to calling function
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
//ACORE_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
if (loadedMMaps.find(mapId) == loadedMMaps.end())
return NULL;
@@ -346,7 +346,7 @@ namespace MMAP
if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end())
{
// pussywizard: different instances of the same map shouldn't access this simultaneously
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
// check again after acquiring mutex
if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end())
{

View File

@@ -262,7 +262,7 @@ namespace VMAP
WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename)
{
//! Critical section, thread safe access to iLoadedModelFiles
TRINITY_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock);
ACORE_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock);
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
if (model == iLoadedModelFiles.end())
@@ -287,7 +287,7 @@ namespace VMAP
void VMapManager2::releaseModelInstance(const std::string &filename)
{
//! Critical section, thread safe access to iLoadedModelFiles
TRINITY_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock);
ACORE_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock);
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
if (model == iLoadedModelFiles.end())
{

View File

@@ -193,23 +193,23 @@ typedef std::vector<std::string> StringVector;
#define MAX_QUERY_LEN 32*1024
#define TRINITY_GUARD(MUTEX, LOCK) \
ACE_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \
if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false);
#define ACORE_GUARD(MUTEX, LOCK) \
ACE_Guard< MUTEX > ACORE_GUARD_OBJECT (LOCK); \
if (ACORE_GUARD_OBJECT.locked() == 0) ASSERT(false);
//! For proper implementation of multiple-read, single-write pattern, use
//! ACE_RW_Mutex as underlying @MUTEX
# define TRINITY_WRITE_GUARD(MUTEX, LOCK) \
ACE_Write_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \
if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false);
# define ACORE_WRITE_GUARD(MUTEX, LOCK) \
ACE_Write_Guard< MUTEX > ACORE_GUARD_OBJECT (LOCK); \
if (ACORE_GUARD_OBJECT.locked() == 0) ASSERT(false);
//! For proper implementation of multiple-read, single-write pattern, use
//! ACE_RW_Mutex as underlying @MUTEX
# define TRINITY_READ_GUARD(MUTEX, LOCK) \
ACE_Read_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \
if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false);
# define ACORE_READ_GUARD(MUTEX, LOCK) \
ACE_Read_Guard< MUTEX > ACORE_GUARD_OBJECT (LOCK); \
if (ACORE_GUARD_OBJECT.locked() == 0) ASSERT(false);
namespace ACORE
namespace acore
{
template<class ArgumentType, class ResultType>
struct unary_function

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_COMPILERDEFS_H
#define TRINITY_COMPILERDEFS_H
#ifndef ACORE_COMPILERDEFS_H
#define ACORE_COMPILERDEFS_H
#define AC_PLATFORM_WINDOWS 0
#define AC_PLATFORM_UNIX 1

View File

@@ -15,7 +15,7 @@
#include <ace/Thread_Mutex.h>
#include <AutoPtr.h>
typedef Trinity::AutoPtr<ACE_Configuration_Heap, ACE_Null_Mutex> Config;
typedef acore::AutoPtr<ACE_Configuration_Heap, ACE_Null_Mutex> Config;
class ConfigMgr
{

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_CONTAINERS_H
#define TRINITY_CONTAINERS_H
#ifndef ACORE_CONTAINERS_H
#define ACORE_CONTAINERS_H
#include "Define.h"
#include <list>
@@ -13,7 +13,7 @@
//! Because circular includes are bad
extern uint32 urand(uint32 min, uint32 max);
namespace Trinity
namespace acore
{
namespace Containers
{
@@ -56,6 +56,6 @@ namespace Trinity
}
//! namespace Containers
}
//! namespace Trinity
//! namespace acore
#endif //! #ifdef TRINITY_CONTAINERS_H
#endif //! #ifdef ACORE_CONTAINERS_H

View File

@@ -212,7 +212,7 @@ SQLTransaction DatabaseWorkerPool<T>::BeginTransaction()
template <class T>
void DatabaseWorkerPool<T>::CommitTransaction(SQLTransaction transaction)
{
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
//! Only analyze transaction weaknesses in Debug mode.
//! Ideally we catch the faults in Debug mode and then correct them,
//! so there's no need to waste these CPU cycles in Release mode.
@@ -227,7 +227,7 @@ void DatabaseWorkerPool<T>::CommitTransaction(SQLTransaction transaction)
default:
break;
}
#endif // TRINITY_DEBUG
#endif // ACORE_DEBUG
Enqueue(new TransactionTask(transaction));
}

View File

@@ -57,10 +57,10 @@ class DatabaseWorkerPool
template<typename Format, typename... Args>
void PExecute(Format&& sql, Args&&... args)
{
if (ACORE::IsFormatEmptyOrNull(sql))
if (acore::IsFormatEmptyOrNull(sql))
return;
Execute(ACORE::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
Execute(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
}
//! Enqueues a one-way SQL operation in prepared statement format that will be executed asynchronously.
@@ -80,10 +80,10 @@ class DatabaseWorkerPool
template<typename Format, typename... Args>
void DirectPExecute(Format&& sql, Args&&... args)
{
if (ACORE::IsFormatEmptyOrNull(sql))
if (acore::IsFormatEmptyOrNull(sql))
return;
DirectExecute(ACORE::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
DirectExecute(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
}
//! Directly executes a one-way SQL operation in prepared statement format, that will block the calling thread until finished.
@@ -103,10 +103,10 @@ class DatabaseWorkerPool
template<typename Format, typename... Args>
QueryResult PQuery(Format&& sql, T* conn, Args&&... args)
{
if (ACORE::IsFormatEmptyOrNull(sql))
if (acore::IsFormatEmptyOrNull(sql))
return QueryResult(nullptr);
return Query(ACORE::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str(), conn);
return Query(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str(), conn);
}
//! Directly executes an SQL query in string format -with variable args- that will block the calling thread until finished.
@@ -114,10 +114,10 @@ class DatabaseWorkerPool
template<typename Format, typename... Args>
QueryResult PQuery(Format&& sql, Args&&... args)
{
if (ACORE::IsFormatEmptyOrNull(sql))
if (acore::IsFormatEmptyOrNull(sql))
return QueryResult(nullptr);
return Query(ACORE::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
return Query(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
}
//! Directly executes an SQL query in prepared format that will block the calling thread until finished.
@@ -138,10 +138,10 @@ class DatabaseWorkerPool
template<typename Format, typename... Args>
QueryResultFuture AsyncPQuery(Format&& sql, Args&&... args)
{
if (ACORE::IsFormatEmptyOrNull(sql))
if (acore::IsFormatEmptyOrNull(sql))
return QueryResult(nullptr);
return AsyncQuery(ACORE::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
return AsyncQuery(acore::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
}
//! Enqueues a query in prepared format that will set the value of the PreparedQueryResultFuture return object as soon as the query is executed.

View File

@@ -29,7 +29,7 @@ class Field
if (!data.value)
return 0;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_TINY))
{
sLog->outSQLDriver("Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
@@ -47,7 +47,7 @@ class Field
if (!data.value)
return 0;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_TINY))
{
sLog->outSQLDriver("Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
@@ -72,7 +72,7 @@ class Field
if (!data.value)
return 0;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR))
{
sLog->outSQLDriver("Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
@@ -90,7 +90,7 @@ class Field
if (!data.value)
return 0;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR))
{
sLog->outSQLDriver("Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
@@ -108,7 +108,7 @@ class Field
if (!data.value)
return 0;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG))
{
sLog->outSQLDriver("Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
@@ -126,7 +126,7 @@ class Field
if (!data.value)
return 0;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG))
{
sLog->outSQLDriver("Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
@@ -144,7 +144,7 @@ class Field
if (!data.value)
return 0;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT))
{
sLog->outSQLDriver("Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
@@ -162,7 +162,7 @@ class Field
if (!data.value)
return 0;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT))
{
sLog->outSQLDriver("Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
@@ -180,7 +180,7 @@ class Field
if (!data.value)
return 0.0f;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_FLOAT))
{
sLog->outSQLDriver("Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type));
@@ -198,7 +198,7 @@ class Field
if (!data.value)
return 0.0f;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_DOUBLE))
{
sLog->outSQLDriver("Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type));
@@ -216,7 +216,7 @@ class Field
if (!data.value)
return NULL;
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
if (IsNumeric())
{
sLog->outSQLDriver("Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type));
@@ -345,7 +345,7 @@ class Field
}
private:
#ifdef TRINITY_DEBUG
#ifdef ACORE_DEBUG
static char const* FieldTypeToString(enum_field_types type)
{
switch (type)

View File

@@ -48,7 +48,7 @@ class ResultSet
MYSQL_FIELD* _fields;
};
typedef Trinity::AutoPtr<ResultSet, ACE_Thread_Mutex> QueryResult;
typedef acore::AutoPtr<ResultSet, ACE_Thread_Mutex> QueryResult;
class PreparedResultSet
{
@@ -93,7 +93,7 @@ class PreparedResultSet
};
typedef Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex> PreparedQueryResult;
typedef acore::AutoPtr<PreparedResultSet, ACE_Thread_Mutex> PreparedQueryResult;
#endif

View File

@@ -39,7 +39,7 @@ class Transaction
bool _cleanedUp;
};
typedef Trinity::AutoPtr<Transaction, ACE_Thread_Mutex> SQLTransaction;
typedef acore::AutoPtr<Transaction, ACE_Thread_Mutex> SQLTransaction;
/*! Low level class*/
class TransactionTask : public SQLOperation

View File

@@ -54,12 +54,12 @@ namespace
}
}
namespace Trinity
namespace acore
{
void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message)
{
std::string formattedMessage = ACORE::StringFormat("\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message) + debugInfo + '\n';
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message) + debugInfo + '\n';
fprintf(stderr, "%s", formattedMessage.c_str());
fflush(stderr);
Crash(formattedMessage.c_str());
@@ -70,7 +70,7 @@ void Assert(char const* file, int line, char const* function, std::string const&
va_list args;
va_start(args, format);
std::string formattedMessage = ACORE::StringFormat("\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message) + FormatAssertionMessage(format, args) + '\n' + debugInfo + '\n';
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message) + FormatAssertionMessage(format, args) + '\n' + debugInfo + '\n';
va_end(args);
fprintf(stderr, "%s", formattedMessage.c_str());
@@ -84,7 +84,7 @@ void Fatal(char const* file, int line, char const* function, char const* message
va_list args;
va_start(args, message);
std::string formattedMessage = ACORE::StringFormat("\n%s:%i in %s FATAL ERROR:\n", file, line, function) + FormatAssertionMessage(message, args) + '\n';
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s FATAL ERROR:\n", file, line, function) + FormatAssertionMessage(message, args) + '\n';
va_end(args);
fprintf(stderr, "%s", formattedMessage.c_str());
@@ -96,7 +96,7 @@ void Fatal(char const* file, int line, char const* function, char const* message
void Error(char const* file, int line, char const* function, char const* message)
{
std::string formattedMessage = ACORE::StringFormat("\n%s:%i in %s ERROR:\n %s\n", file, line, function, message);
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s ERROR:\n %s\n", file, line, function, message);
fprintf(stderr, "%s", formattedMessage.c_str());
fflush(stderr);
Crash(formattedMessage.c_str());
@@ -110,7 +110,7 @@ void Warning(char const* file, int line, char const* function, char const* messa
void Abort(char const* file, int line, char const* function)
{
std::string formattedMessage = ACORE::StringFormat("\n%s:%i in %s ABORTED.\n", file, line, function);
std::string formattedMessage = acore::StringFormat("\n%s:%i in %s ABORTED.\n", file, line, function);
fprintf(stderr, "%s", formattedMessage.c_str());
fflush(stderr);
Crash(formattedMessage.c_str());
@@ -119,13 +119,13 @@ void Abort(char const* file, int line, char const* function)
void AbortHandler(int sigval)
{
// nothing useful to log here, no way to pass args
std::string formattedMessage = ACORE::StringFormat("Caught signal %i\n", sigval);
std::string formattedMessage = acore::StringFormat("Caught signal %i\n", sigval);
fprintf(stderr, "%s", formattedMessage.c_str());
fflush(stderr);
Crash(formattedMessage.c_str());
}
} // namespace Trinity
} // namespace acore
std::string GetDebugInfo()
{

View File

@@ -10,7 +10,7 @@
#include "Define.h"
#include <string>
namespace Trinity
namespace acore
{
DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message) ATTR_NORETURN;
DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message, char const* format, ...) ATTR_NORETURN ATTR_PRINTF(6, 7);
@@ -25,7 +25,7 @@ namespace Trinity
DECLSPEC_NORETURN void AbortHandler(int sigval) ATTR_NORETURN;
} // namespace Trinity
} // namespace acore
std::string GetDebugInfo();
@@ -41,12 +41,12 @@ std::string GetDebugInfo();
#define EXCEPTION_ASSERTION_FAILURE 0xC0000420L
#endif
#define WPAssert(cond, ...) ASSERT_BEGIN do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, GetDebugInfo(), #cond, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPAssert_NODEBUGINFO(cond, ...) ASSERT_BEGIN do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, "", #cond, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPFatal(cond, ...) ASSERT_BEGIN do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPError(cond, msg) ASSERT_BEGIN do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPWarning(cond, msg) ASSERT_BEGIN do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPAbort() ASSERT_BEGIN do { Trinity::Abort(__FILE__, __LINE__, __FUNCTION__); } while(0) ASSERT_END
#define WPAssert(cond, ...) ASSERT_BEGIN do { if (!(cond)) acore::Assert(__FILE__, __LINE__, __FUNCTION__, GetDebugInfo(), #cond, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPAssert_NODEBUGINFO(cond, ...) ASSERT_BEGIN do { if (!(cond)) acore::Assert(__FILE__, __LINE__, __FUNCTION__, "", #cond, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPFatal(cond, ...) ASSERT_BEGIN do { if (!(cond)) acore::Fatal(__FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); } while(0) ASSERT_END
#define WPError(cond, msg) ASSERT_BEGIN do { if (!(cond)) acore::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPWarning(cond, msg) ASSERT_BEGIN do { if (!(cond)) acore::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPAbort() ASSERT_BEGIN do { acore::Abort(__FILE__, __LINE__, __FUNCTION__); } while(0) ASSERT_END
#ifdef PERFORMANCE_PROFILING
#define ASSERT(cond, ...) ((void)0)

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_DEFINE_H
#define TRINITY_DEFINE_H
#ifndef ACORE_DEFINE_H
#define ACORE_DEFINE_H
#include <cstddef>
#include <cinttypes>
@@ -17,19 +17,19 @@
#define OS_WIN
#endif
#define TRINITY_LITTLEENDIAN 0
#define TRINITY_BIGENDIAN 1
#define ACORE_LITTLEENDIAN 0
#define ACORE_BIGENDIAN 1
#if !defined(TRINITY_ENDIAN)
#if !defined(ACORE_ENDIAN)
# if defined (ACE_BIG_ENDIAN)
# define TRINITY_ENDIAN TRINITY_BIGENDIAN
# define ACORE_ENDIAN ACORE_BIGENDIAN
# else //ACE_BYTE_ORDER != ACE_BIG_ENDIAN
# define TRINITY_ENDIAN TRINITY_LITTLEENDIAN
# define ACORE_ENDIAN ACORE_LITTLEENDIAN
# endif //ACE_BYTE_ORDER
#endif //TRINITY_ENDIAN
#endif //ACORE_ENDIAN
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
# define TRINITY_PATH_MAX MAX_PATH
# define ACORE_PATH_MAX MAX_PATH
# ifndef DECLSPEC_NORETURN
# define DECLSPEC_NORETURN __declspec(noreturn)
# endif //DECLSPEC_NORETURN
@@ -37,18 +37,18 @@
# define DECLSPEC_DEPRECATED __declspec(deprecated)
# endif //DECLSPEC_DEPRECATED
#else //AC_PLATFORM != AC_PLATFORM_WINDOWS
# define TRINITY_PATH_MAX PATH_MAX
# define ACORE_PATH_MAX PATH_MAX
# define DECLSPEC_NORETURN
# define DECLSPEC_DEPRECATED
#endif //AC_PLATFORM
#if !defined(COREDEBUG)
# define TRINITY_INLINE inline
# define ACORE_INLINE inline
#else //COREDEBUG
# if !defined(TRINITY_DEBUG)
# define TRINITY_DEBUG
# endif //TRINITY_DEBUG
# define TRINITY_INLINE
# if !defined(ACORE_DEBUG)
# define ACORE_DEBUG
# endif //ACORE_DEBUG
# define ACORE_INLINE
#endif //!COREDEBUG
#if AC_COMPILER == AC_COMPILER_GNU
@@ -80,4 +80,4 @@ typedef std::uint32_t uint32;
typedef std::uint16_t uint16;
typedef std::uint8_t uint8;
#endif //TRINITY_DEFINE_H
#endif //ACORE_DEFINE_H

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_FACTORY_HOLDER
#define TRINITY_FACTORY_HOLDER
#ifndef ACORE_FACTORY_HOLDER
#define ACORE_FACTORY_HOLDER
#include "Define.h"
#include "Dynamic/TypeList.h"

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_OBJECTREGISTRY_H
#define TRINITY_OBJECTREGISTRY_H
#ifndef ACORE_OBJECTREGISTRY_H
#define ACORE_OBJECTREGISTRY_H
#include "Define.h"
#include <ace/Singleton.h>

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_TYPECONTAINER_H
#define TRINITY_TYPECONTAINER_H
#ifndef ACORE_TYPECONTAINER_H
#define ACORE_TYPECONTAINER_H
/*
* Here, you'll find a series of containers that allow you to hold multiple
@@ -86,19 +86,19 @@ template<class OBJECT_TYPES>
class TypeMapContainer
{
public:
template<class SPECIFIC_TYPE> size_t Count() const { return Trinity::Count(i_elements, (SPECIFIC_TYPE*)NULL); }
template<class SPECIFIC_TYPE> size_t Count() const { return acore::Count(i_elements, (SPECIFIC_TYPE*)NULL); }
/// inserts a specific object into the container
template<class SPECIFIC_TYPE> bool insert(SPECIFIC_TYPE *obj)
{
SPECIFIC_TYPE* t = Trinity::Insert(i_elements, obj);
SPECIFIC_TYPE* t = acore::Insert(i_elements, obj);
return (t != NULL);
}
/// Removes the object from the container, and returns the removed object
//template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj)
//{
// SPECIFIC_TYPE* t = Trinity::Remove(i_elements, obj);
// SPECIFIC_TYPE* t = acore::Remove(i_elements, obj);
// return (t != NULL);
//}

View File

@@ -17,7 +17,7 @@
#include "Dynamic/TypeList.h"
#include <map>
namespace Trinity
namespace acore
{
/* ContainerMapList Helpers */
// count functions

View File

@@ -17,7 +17,7 @@
#include "Utilities/TypeList.h"
#include <map>
namespace Trinity
namespace acore
{
/* ContainerMapList Helpers */
// count functions

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_TYPECONTAINERVISITOR_H
#define TRINITY_TYPECONTAINERVISITOR_H
#ifndef ACORE_TYPECONTAINERVISITOR_H
#define ACORE_TYPECONTAINERVISITOR_H
/*
* @class TypeContainerVisitor is implemented as a visitor pattern. It is

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_TYPELIST_H
#define TRINITY_TYPELIST_H
#ifndef ACORE_TYPELIST_H
#define ACORE_TYPELIST_H
/*
@struct TypeList

View File

@@ -199,8 +199,8 @@ FILE* Log::openGmlogPerAccount(uint32 account)
if (m_gmlog_filename_format.empty())
return NULL;
char namebuf[TRINITY_PATH_MAX];
snprintf(namebuf, TRINITY_PATH_MAX, m_gmlog_filename_format.c_str(), account);
char namebuf[ACORE_PATH_MAX];
snprintf(namebuf, ACORE_PATH_MAX, m_gmlog_filename_format.c_str(), account);
return fopen(namebuf, "a");
}

View File

@@ -80,8 +80,8 @@ int DelayExecutor::start(int num_threads, ACE_Method_Request* pre_svc_hook, ACE_
queue_.queue()->activate();
// pussywizard:
//ACORE::ThreadPriority tp;
//int _priority = tp.getPriority(ACORE::Priority_Highest);
//acore::ThreadPriority tp;
//int _priority = tp.getPriority(acore::Priority_Highest);
//if (ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE, num_threads, 0, _priority) == -1)
// return -1;

View File

@@ -10,7 +10,7 @@
#include <chrono>
#include <system_error>
using namespace ACORE;
using namespace acore;
Thread::Thread() : m_task(nullptr), m_iThreadId(), m_ThreadImp()
{

View File

@@ -13,7 +13,7 @@
#include <thread>
#include <atomic>
namespace ACORE
namespace acore
{
class Runnable
{

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_BYTECONVERTER_H
#define TRINITY_BYTECONVERTER_H
#ifndef ACORE_BYTECONVERTER_H
#define ACORE_BYTECONVERTER_H
/** ByteConverter reverse your byte order. This is use
for cross platform where they have different endians.
@@ -32,7 +32,7 @@ namespace ByteConverter
}
}
#if TRINITY_ENDIAN == TRINITY_BIGENDIAN
#if ACORE_ENDIAN == ACORE_BIGENDIAN
template<typename T> inline void EndianConvert(T& val) { ByteConverter::apply<T>(&val); }
template<typename T> inline void EndianConvertReverse(T&) { }
template<typename T> inline void EndianConvertPtr(void* val) { ByteConverter::apply<T>(val); }

View File

@@ -9,7 +9,7 @@
#include <ace/Event_Handler.h>
namespace Trinity
namespace acore
{
/// Handle termination signals

View File

@@ -9,7 +9,7 @@
#include "fmt/printf.h"
namespace ACORE
namespace acore
{
/// Default AC string format function.
template<typename Format, typename... Args>

View File

@@ -4,8 +4,8 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef TRINITY_TIMER_H
#define TRINITY_TIMER_H
#ifndef ACORE_TIMER_H
#define ACORE_TIMER_H
#include "ace/OS_NS_sys_time.h"
#include "Common.h"