This class represents a dictionary of factories. More...
#include <FactoryDictionary.h>
Public Types | |
typedef std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator | const_iterator |
Public Member Functions | |
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator | begin () const |
It returns an iterator to the first stored factory. More... | |
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator | end () const |
It returns an iterator to the end of the container. More... | |
FactoryDictionary () | |
It creates a new factory dictionary. More... | |
TFACTORY * | find (const TFACTORYKEY &factoryKey) const |
It looks for a given factory identified by a key. More... | |
void | insert (const TFACTORYKEY &factoryKey, TFACTORY *factory) |
It inserts a pointer to a factory and makes it associated to the factory key. More... | |
void | remove (const TFACTORYKEY &factoryKey) |
It removes the factory from the dictionary. More... | |
std::size_t | size () const |
It returns the number of registered factories in the dictionary. More... | |
~FactoryDictionary () | |
Destructor. More... | |
Private Member Functions | |
Copy Constructor and Assignment Operator | |
Copy constructor and assignment operator not allowed. | |
FactoryDictionary (const FactoryDictionary &rhs) | |
Copy constructor not allowed. More... | |
FactoryDictionary & | operator= (const FactoryDictionary &rhs) |
Assignment operator not allowed. More... | |
Private Attributes | |
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE > | m_factoryMap |
The internal dictionary map: key => factory. More... | |
This class represents a dictionary of factories.
An abstract factory will keep an internal dictionary for its concrete factories. A factory is identified by a key of type TFACTORYKEY that must have the less-than operator. The type TFACTORYKEY must also be copy constructible.
The abstract factory to which the dictionary will belong to has the type TFACTORY.
Note that TFACTORY is the factory type and TFACTORYKEY is the type used to identify the factory.
At destruction time, it will release the memory pointed by the registered factories.
If you are creating a plugin that registers a factory, see the Abstract and Parameterized abstract factory notes about memory management.
You should not use this class in your code. It is for internal use only.
Definition at line 67 of file FactoryDictionary.h.
typedef std::map<TFACTORYKEY, TFACTORY*, TKEYCOMPARE>::const_iterator te::common::FactoryDictionary< TFACTORY, TFACTORYKEY, TKEYCOMPARE >::const_iterator |
Definition at line 71 of file FactoryDictionary.h.
|
inline |
It creates a new factory dictionary.
Definition at line 173 of file FactoryDictionary.h.
|
inline |
Destructor.
It will release all factories registered in it. If you need to release the memory before, call remove method, it will just de-register the given factory.
Definition at line 178 of file FactoryDictionary.h.
|
private |
Copy constructor not allowed.
rhs | The right-hand-side copy that would be used to copy from. |
|
inline |
It returns an iterator to the first stored factory.
Definition at line 230 of file FactoryDictionary.h.
|
inline |
It returns an iterator to the end of the container.
Definition at line 236 of file FactoryDictionary.h.
|
inline |
It looks for a given factory identified by a key.
factoryKey | The key identifying the searched factory. |
Definition at line 219 of file FactoryDictionary.h.
Referenced by te::qt::af::SettingsWidgetsFactory::make().
|
inline |
It inserts a pointer to a factory and makes it associated to the factory key.
factoryKey | The key that will be used to access the given factory. |
factory | A valid pointer to a factory. |
Exception | It throws an exception if it can not insert the factory. |
Definition at line 193 of file FactoryDictionary.h.
References TE_TR.
Referenced by te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::AbstractFactory(), and te::common::ParameterizedAbstractFactory< TPRODUCT, TFACTORYKEY, TPARAM, TKEYCOMPARE >::ParameterizedAbstractFactory().
|
private |
Assignment operator not allowed.
rhs | The right-hand-side copy that would be used to copy from. |
|
inline |
It removes the factory from the dictionary.
It doesn't release the memory, the caller must do this when appropriated.
Exception | It throws an exception if it can not unregister the factory. |
factoryKey | The key identifying the factory. |
Definition at line 208 of file FactoryDictionary.h.
References TE_TR.
|
inline |
It returns the number of registered factories in the dictionary.
Definition at line 242 of file FactoryDictionary.h.
|
private |
The internal dictionary map: key => factory.
Definition at line 169 of file FactoryDictionary.h.