Reverted r26922.
svn-id: r26967
This commit is contained in:
parent
7d8619350f
commit
86104e0bf0
8 changed files with 24 additions and 3 deletions
|
@ -139,6 +139,8 @@ public:
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(PluginManager);
|
||||||
|
|
||||||
PluginManager::PluginManager() {
|
PluginManager::PluginManager() {
|
||||||
#ifndef DYNAMIC_MODULES
|
#ifndef DYNAMIC_MODULES
|
||||||
// Add the static plugin provider if we do not build with dynamic
|
// Add the static plugin provider if we do not build with dynamic
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(Common::ConfigManager);
|
||||||
|
|
||||||
#ifdef __PLAYSTATION2__
|
#ifdef __PLAYSTATION2__
|
||||||
#include "backends/platform/ps2/systemps2.h"
|
#include "backends/platform/ps2/systemps2.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,6 +37,8 @@ private:
|
||||||
Singleton<T>(const Singleton<T>&);
|
Singleton<T>(const Singleton<T>&);
|
||||||
Singleton<T>& operator= (const Singleton<T>&);
|
Singleton<T>& operator= (const Singleton<T>&);
|
||||||
|
|
||||||
|
static T* _singleton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default object factory used by the template class Singleton.
|
* The default object factory used by the template class Singleton.
|
||||||
* By specialising this template function, one can make a singleton use a
|
* By specialising this template function, one can make a singleton use a
|
||||||
|
@ -56,13 +58,16 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static T& instance() {
|
static T& instance() {
|
||||||
// TODO: We aren't thread safe.
|
// TODO: We aren't thread safe. For now we ignore it since the
|
||||||
|
// only thing using this singleton template is the config manager,
|
||||||
|
// and that is first instantiated long before any threads.
|
||||||
// TODO: We don't leak, but the destruction order is nevertheless
|
// TODO: We don't leak, but the destruction order is nevertheless
|
||||||
// semi-random. If we use multiple singletons, the destruction
|
// semi-random. If we use multiple singletons, the destruction
|
||||||
// order might become an issue. There are various approaches
|
// order might become an issue. There are various approaches
|
||||||
// to solve that problem, but for now this is sufficient
|
// to solve that problem, but for now this is sufficient
|
||||||
static T *instance = T::makeInstance();
|
if (!_singleton)
|
||||||
return *instance;
|
_singleton = T::makeInstance();
|
||||||
|
return *_singleton;
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
Singleton<T>() { }
|
Singleton<T>() { }
|
||||||
|
@ -75,6 +80,8 @@ protected:
|
||||||
typedef T SingletonBaseType;
|
typedef T SingletonBaseType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DECLARE_SINGLETON(T) template<> T* Common::Singleton<T>::_singleton=0
|
||||||
|
|
||||||
} // End of namespace Common
|
} // End of namespace Common
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
#include "common/stack.h"
|
#include "common/stack.h"
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(Graphics::CursorManager);
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
static bool g_initialized = false;
|
static bool g_initialized = false;
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "graphics/fontman.h"
|
#include "graphics/fontman.h"
|
||||||
//#include "gui/consolefont.h"
|
//#include "gui/consolefont.h"
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(Graphics::FontManager);
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
|
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "graphics/imageman.h"
|
#include "graphics/imageman.h"
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(Graphics::ImageManager);
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
ImageManager::ImageManager() : _surfaces()
|
ImageManager::ImageManager() : _surfaces()
|
||||||
#ifdef USE_ZLIB
|
#ifdef USE_ZLIB
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(GUI::NewGui);
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(Audio::AudioCDManager);
|
||||||
|
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
|
|
||||||
AudioCDManager::AudioCDManager() {
|
AudioCDManager::AudioCDManager() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue