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> >
97 static TPRODUCT*
make(
const TFACTORYKEY& factoryKey);
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
173 : m_factoryKey(factoryKey)
178 template<
class TPRODUCT,
class TFACTORYKEY,
class TKEYCOMPARE>
inline
181 getDictionary().remove(m_factoryKey);
A dictionary for a Factory.
#define TE_TR(message)
It marks a string in order to get translated.
This class defines the interface of abstract factories without initializing parameters.
virtual ~AbstractFactory()
Virtual destructor.
AbstractFactory factory_type
const TFACTORYKEY & getKey() const
It returns the factory key associated to the concreate factory.
TFACTORYKEY m_factoryKey
The key that identifies the concrete factory: it will be used for unregistering the factory during de...
FactoryDictionary< AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >, TFACTORYKEY, TKEYCOMPARE > dictionary_type
AbstractFactory(const TFACTORYKEY &factoryKey)
It creates the factory and automatically registers it in the dictionary.
static const factory_type * find(const TFACTORYKEY &factoryKey)
static TPRODUCT * make(const TFACTORYKEY &factoryKey)
It creates an object with the appropriated factory.
static dictionary_type & getDictionary()
It returns a reference to the internal dictionary of concrete factories.
virtual TPRODUCT * build()=0
Concrete factories (derived from this one) must implement this method in order to create objects.
This class is designed to declare objects to be thrown as exceptions by TerraLib.
This class represents a dictionary of factories.
void insert(const TFACTORYKEY &factoryKey, TFACTORY *factory)
It inserts a pointer to a factory and makes it associated to the factory key.