ALBA
albaCoreFactory.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaCoreFactory
5 Authors: Marco Petrone
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaCoreFactory_h
18#define __albaCoreFactory_h
19//----------------------------------------------------------------------------
20// includes :
21//----------------------------------------------------------------------------
22#include "albaObjectFactory.h"
23
25class ALBA_EXPORT albaCoreFactory : public albaObjectFactory
26{
27public:
29 virtual const char* GetALBASourceVersion() const;
30 virtual const char* GetDescription() const;
31
32 /* Initialize the factory creating and registering a new instance */
33 static int Initialize();
35 static albaCoreFactory *GetInstance();// {if (!m_Instance) Initialize(); return m_Instance;}
36
37protected:
40
41 static bool m_Initialized;
42 // static albaCoreFactory *m_Instance;
43
44private:
45 albaCoreFactory(const albaCoreFactory&); // Not implemented.
46 void operator=(const albaCoreFactory&); // Not implemented.
47};
48
50template <class T>
52{
53 public:
54 albaPlugObject(const char *description) \
55 { \
57 if (factory) \
58 factory->RegisterNewObject(T::GetStaticTypeName(), description, T::NewObject); \
59 }
60};
61
62#endif
Object factory for objects in the ALBA library.
virtual const char * GetDescription() const
Return a descriptive string describing the factory.
albaTypeMacro(albaCoreFactory, albaObjectFactory)
static albaCoreFactory * GetInstance()
return the instance pointer of the factory.
virtual const char * GetALBASourceVersion() const
All sub-classes of albaObjectFactory should must return the version of ALBA they were built with.
static int Initialize()
static bool m_Initialized
Create instances of classes using an object factory.
void RegisterNewObject(const char *ObjectName, const char *typeName, albaCreateObjectFunction createFunction, albaReferenceCounted *args=NULL)
This function can be used by Application code to register new Objects's to the albaCoreFactory.
Plug generic object into the ALBA Core factory.
albaPlugObject(const char *description)