25#ifndef __TERRALIB_COMMON_INTERNAL_FACTORYDICTIONARY_H
26#define __TERRALIB_COMMON_INTERNAL_FACTORYDICTIONARY_H
66 template<
class TFACTORY,
class TFACTORYKEY,
class TKEYCOMPARE = std::less<TFACTORYKEY> >
71 typedef typename std::map<TFACTORYKEY, TFACTORY*, TKEYCOMPARE>::const_iterator
const_iterator;
95 void insert(
const TFACTORYKEY& factoryKey, TFACTORY* factory);
106 void remove(
const TFACTORYKEY& factoryKey);
117 TFACTORY*
find(
const TFACTORYKEY& factoryKey)
const;
126 typename std::map<TFACTORYKEY, TFACTORY*, TKEYCOMPARE>::const_iterator
begin()
const;
133 typename std::map<TFACTORYKEY, TFACTORY*, TKEYCOMPARE>::const_iterator
end()
const;
172 template<
class TFACTORY,
class TFACTORYKEY,
class TKEYCOMPARE>
inline
177 template<
class TFACTORY,
class TFACTORYKEY,
class TKEYCOMPARE>
inline
192 template<
class TFACTORY,
class TFACTORYKEY,
class TKEYCOMPARE>
inline
197 throw Exception(
TE_TR(
"Could not insert the given factory into the dictionary. The factory is a NULL object!"));
199 typename std::map<TFACTORYKEY, TFACTORY*, TKEYCOMPARE>::const_iterator it =
m_factoryMap.find(factoryKey);
202 throw Exception(
TE_TR(
"Could not insert the given factory into the dictionary. There is a factory already registered with the given key."));
207 template<
class TFACTORY,
class TFACTORYKEY,
class TKEYCOMPARE>
inline
210 typename std::map<TFACTORYKEY, TFACTORY*, TKEYCOMPARE>::iterator it =
m_factoryMap.find(factoryKey);
215 throw Exception(
TE_TR(
"Could not unregister the informed factory. Object factory not found!"));
218 template<
class TFACTORY,
class TFACTORYKEY,
class TKEYCOMPARE>
inline
221 typename std::map<TFACTORYKEY, TFACTORY*, TKEYCOMPARE>::const_iterator it =
m_factoryMap.find(factoryKey);
229 template<
class TFACTORY,
class TFACTORYKEY,
class TKEYCOMPARE>
inline
235 template<
class TFACTORY,
class TFACTORYKEY,
class TKEYCOMPARE>
inline
241 template<
class TFACTORY,
class TFACTORYKEY,
class TKEYCOMPARE>
inline
This class is designed for dealing with multi-language text translation in TerraLib.
#define TE_TR(message)
It marks a string in order to get translated.
This class is designed to declare objects to be thrown as exceptions by TerraLib.
std::map< TFACTORYKEY, AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE > *, TKEYCOMPARE > m_factoryMap
FactoryDictionary(const FactoryDictionary &rhs)
Copy constructor not allowed.
std::map< TFACTORYKEY, AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE > *, TKEYCOMPARE >::const_iterator const_iterator
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator end() const
It returns an iterator to the end of the container.
void remove(const TFACTORYKEY &factoryKey)
It removes the factory from the dictionary.
std::size_t size() const
It returns the number of registered factories in the dictionary.
void insert(const TFACTORYKEY &factoryKey, TFACTORY *factory)
It inserts a pointer to a factory and makes it associated to the factory key.
FactoryDictionary()
It creates a new factory dictionary.
TFACTORY * find(const TFACTORYKEY &factoryKey) const
It looks for a given factory identified by a key.
FactoryDictionary & operator=(const FactoryDictionary &rhs)
Assignment operator not allowed.
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator begin() const
It returns an iterator to the first stored factory.
~FactoryDictionary()
Destructor.
This class is designed to declare objects to be thrown as exceptions by TerraLib.
Namespace for the Common module of TerraLib.