26 #ifndef __TERRALIB_COMMON_INTERNAL_ABSTRACTFACTORY_H 27 #define __TERRALIB_COMMON_INTERNAL_ABSTRACTFACTORY_H 31 #include "../core/Exception.h" 33 #include <boost/noncopyable.hpp> 68 template<
class TPRODUCT,
class TFACTORYKEY,
class TKEYCOMPARE = std::less<TFACTORYKEY> >
84 const TFACTORYKEY&
getKey()
const;
97 static TPRODUCT*
make(
const TFACTORYKEY& factoryKey);
108 static const factory_type*
find(
const TFACTORYKEY& factoryKey);
118 virtual TPRODUCT*
build() = 0;
139 template<
class TPRODUCT,
class TFACTORYKEY,
class TKEYCOMPARE>
inline 145 template<
class TPRODUCT,
class TFACTORYKEY,
class TKEYCOMPARE>
inline 151 return factory->
build();
156 template<
class TPRODUCT,
class TFACTORYKEY,
class TKEYCOMPARE>
inline 160 return factoryDictionary;
163 template<
class TPRODUCT,
class TFACTORYKEY,
class TKEYCOMPARE>
inline 171 template<
class TPRODUCT,
class TFACTORYKEY,
class TKEYCOMPARE>
inline 178 template<
class TPRODUCT,
class TFACTORYKEY,
class TKEYCOMPARE>
inline 187 #endif // __TERRALIB_COMMON_INTERNAL_ABSTRACTFACTORY_H This class defines the interface of abstract factories without initializing parameters.
FactoryDictionary< AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >, TFACTORYKEY, TKEYCOMPARE > dictionary_type
virtual ~AbstractFactory()
Virtual destructor.
void insert(const TFACTORYKEY &factoryKey, TFACTORY *factory)
It inserts a pointer to a factory and makes it associated to the factory key.
AbstractFactory factory_type
static dictionary_type & getDictionary()
It returns a reference to the internal dictionary of concrete factories.
#define TE_TR(message)
It marks a string in order to get translated.
TFACTORY * find(const TFACTORYKEY &factoryKey) const
It looks for a given factory identified by a key.
A dictionary for a Factory.
AbstractFactory(const TFACTORYKEY &factoryKey)
It creates the factory and automatically registers it in the dictionary.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
static TPRODUCT * make(const TFACTORYKEY &factoryKey)
It creates an object with the appropriated factory.
const TFACTORYKEY & getKey() const
It returns the factory key associated to the concreate factory.
static const factory_type * find(const TFACTORYKEY &factoryKey)
TFACTORYKEY m_factoryKey
The key that identifies the concrete factory: it will be used for unregistering the factory during de...
virtual TPRODUCT * build()=0
Concrete factories (derived from this one) must implement this method in order to create objects...
void remove(const TFACTORYKEY &factoryKey)
It removes the factory from the dictionary.
This class represents a dictionary of factories.