Shared/Misc: Removed some more ACE dependencies

This commit is contained in:
Subv
2014-06-22 13:17:47 -05:00
parent fa1da7a921
commit 79440b3d9d
4 changed files with 12 additions and 11 deletions

View File

@@ -30,15 +30,13 @@ class FactoryHolder
{
public:
typedef ObjectRegistry<FactoryHolder<T, Key >, Key > FactoryHolderRegistry;
friend class ACE_Singleton<FactoryHolderRegistry, ACE_Null_Mutex>;
typedef ACE_Singleton<FactoryHolderRegistry, ACE_Null_Mutex> FactoryHolderRepository;
FactoryHolder(Key k) : i_key(k) { }
virtual ~FactoryHolder() { }
inline Key key() const { return i_key; }
void RegisterSelf(void) { FactoryHolderRepository::instance()->InsertItem(this, i_key); }
void DeregisterSelf(void) { FactoryHolderRepository::instance()->RemoveItem(this, false); }
void RegisterSelf(void) { FactoryHolderRegistry::instance()->InsertItem(this, i_key); }
void DeregisterSelf(void) { FactoryHolderRegistry::instance()->RemoveItem(this, false); }
/// Abstract Factory create method
virtual T* Create(void *data = NULL) const = 0;

View File

@@ -20,12 +20,9 @@
#define TRINITY_OBJECTREGISTRY_H
#include "Define.h"
#include <ace/Singleton.h>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
/** ObjectRegistry holds all registry item of the same type
*/
@@ -33,7 +30,13 @@ template<class T, class Key = std::string>
class ObjectRegistry
{
public:
typedef std::map<Key, T *> RegistryMapType;
typedef std::map<Key, T*> RegistryMapType;
static ObjectRegistry<T, Key>* instance()
{
static ObjectRegistry<T, Key>* instance = new ObjectRegistry<T, Key>();
return instance;
}
/// Returns a registry item
const T* GetRegistryItem(Key key) const

View File

@@ -45,7 +45,7 @@ AppenderFile::~AppenderFile()
void AppenderFile::_write(LogMessage const& message)
{
bool exceedMaxSize = maxFileSize > 0 && (fileSize.value() + message.Size()) > maxFileSize;
bool exceedMaxSize = maxFileSize > 0 && (fileSize.load() + message.Size()) > maxFileSize;
if (dynamicName)
{

View File

@@ -19,7 +19,7 @@
#define APPENDERFILE_H
#include "Appender.h"
#include "ace/Atomic_Op.h"
#include <atomic>
class AppenderFile: public Appender
{
@@ -38,7 +38,7 @@ class AppenderFile: public Appender
bool dynamicName;
bool backup;
uint64 maxFileSize;
ACE_Atomic_Op<ACE_Thread_Mutex, uint64> fileSize;
std::atomic<uint64> fileSize;
};
#endif