summaryrefslogtreecommitdiff
path: root/orkbasecxx/ObjectFactory.h
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2007-02-05 21:34:01 +0000
committerHenri Herscher <henri@oreka.org>2007-02-05 21:34:01 +0000
commit94e3eb2d0cda7df2d876d1698db2e8e75cd0a0b1 (patch)
tree35361de8c5dd9d8cf43dbb84674cf503c03b3e4a /orkbasecxx/ObjectFactory.h
parenteb3b1d6a3dcf20864d0610758f8bcf426a1af7ec (diff)
ObjectFactory becomes a home brewed singleton instead of an ACE singleton. ACE singletons have the problem of not being unique across DLL.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@398 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/ObjectFactory.h')
-rw-r--r--orkbasecxx/ObjectFactory.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/orkbasecxx/ObjectFactory.h b/orkbasecxx/ObjectFactory.h
index 4ebaf60..0c5cd31 100644
--- a/orkbasecxx/ObjectFactory.h
+++ b/orkbasecxx/ObjectFactory.h
@@ -22,18 +22,24 @@
/** The ObjectFactory can be used to instanciate Objects based on class name.
All existing Objects must be registered to the ObjectFactory at startup.
*/
+class ObjectFactory;
+
class DLL_IMPORT_EXPORT_ORKBASE ObjectFactory
{
public:
- void Initialize();
+ static void Initialize();
+ static ObjectFactory* GetSingleton();
+
ObjectRef NewInstance(CStdString& className);
void RegisterObject(ObjectRef&);
private:
+ ObjectFactory();
+ static ObjectFactory* m_singleton;
std::map<CStdString, ObjectRef> m_classes;
};
-typedef ACE_Singleton<ObjectFactory, ACE_Thread_Mutex> ObjectFactorySingleton;
+//typedef ACE_Singleton<ObjectFactory, ACE_Thread_Mutex> ObjectFactorySingleton;
#endif