This class defines the interface of abstract factories without initializing parameters. More...
#include <AbstractFactory.h>
Public Types | |
typedef FactoryDictionary< AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >, TFACTORYKEY, TKEYCOMPARE > | dictionary_type |
typedef AbstractFactory | factory_type |
Public Member Functions | |
const TFACTORYKEY & | getKey () const |
It returns the factory key associated to the concreate factory. More... | |
Static Public Member Functions | |
static const factory_type * | find (const TFACTORYKEY &factoryKey) |
static dictionary_type & | getDictionary () |
It returns a reference to the internal dictionary of concrete factories. More... | |
static TPRODUCT * | make (const TFACTORYKEY &factoryKey) |
It creates an object with the appropriated factory. More... | |
Protected Member Functions | |
AbstractFactory (const TFACTORYKEY &factoryKey) | |
It creates the factory and automatically registers it in the dictionary. More... | |
virtual TPRODUCT * | build ()=0 |
Concrete factories (derived from this one) must implement this method in order to create objects. More... | |
virtual | ~AbstractFactory () |
Virtual destructor. More... | |
Protected Attributes | |
TFACTORYKEY | m_factoryKey |
The key that identifies the concrete factory: it will be used for unregistering the factory during destruction. More... | |
Friends | |
class | FactoryDictionary< AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >, TFACTORYKEY, TKEYCOMPARE > |
This class defines the interface of abstract factories without initializing parameters.
The abstract factory keeps an internal dictionary (a singleton) to access their concrete factories.
A concrete factory is identified by a key of type TFACTORYKEY. TFACTORYKEY must be copy constructible.
It will create objects of type TPRODUCT. Note that TPRODUCT is the object type that the factory knows how to create.
In order to create an abstract factory, the concrete classes will have to extend the build method. When an object from a concrete factory is created, it is automatically registered in the abstract factory.
If you need to initialize the objects created by the factories try to use a derived class from ParameterizedAbstractFactory instead.
Definition at line 69 of file AbstractFactory.h.
typedef FactoryDictionary<AbstractFactory<TPRODUCT, TFACTORYKEY, TKEYCOMPARE>, TFACTORYKEY, TKEYCOMPARE> te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::dictionary_type |
Definition at line 73 of file AbstractFactory.h.
typedef AbstractFactory te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::factory_type |
Definition at line 77 of file AbstractFactory.h.
|
inlineprotected |
It creates the factory and automatically registers it in the dictionary.
factoryKey | The key that identifies the factory. |
Definition at line 172 of file AbstractFactory.h.
References te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::getDictionary(), and te::common::FactoryDictionary< TFACTORY, TFACTORYKEY, TKEYCOMPARE >::insert().
|
inlineprotectedvirtual |
Virtual destructor.
Definition at line 179 of file AbstractFactory.h.
|
protectedpure virtual |
Concrete factories (derived from this one) must implement this method in order to create objects.
Implemented in te::rp::TiePointsLocatorSURFStrategyFactory, te::rp::TiePointsLocatorMoravecStrategyFactory, te::rp::SegmenterRegionGrowingBaatzStrategyFactory, te::rp::SegmenterRegionGrowingMeanStrategyFactory, te::rp::ClassifierISOSegStrategyFactory, te::rp::ClassifierMAPStrategyFactory, te::rp::ClassifierSAMStrategyFactory, te::rp::ClassifierEMStrategyFactory, te::rp::ClassifierKMeansStrategyFactory, te::rp::ClassifierDummyStrategyFactory, te::rp::MixtureModelLinearStrategyFactory, te::rp::MixtureModelPCAStrategyFactory, te::rp::SegmenterDummyStrategyFactory, te::graph::BidirectionalGraphFactory, te::graph::DirectedGraphFactory, te::graph::GraphFactory, te::graph::UndirectedGraphFactory, te::qt::widgets::LocalGraphicWidgetFactory, te::qt::widgets::BasicFillWidgetFactory, te::qt::widgets::GlyphGraphicWidgetFactory, te::qt::widgets::GraphicFillWidgetFactory, te::qt::widgets::WellKnownGraphicWidgetFactory, te::graph::BoxLoaderStrategyFactory, te::graph::SequenceLoaderStrategyFactory, te::mem::ExpansibleRasterFactory, te::gdal::RasterFactory, te::grib::RasterFactory, te::graph::FIFOCachePolicyFactory, te::graph::LFUCachePolicyFactory, te::qt::widgets::DateTimePropertyWidgetFactory, te::qt::widgets::GeometryPropertyWidgetFactory, te::qt::widgets::NumericPropertyWidgetFactory, te::qt::widgets::StringPropertyWidgetFactory, te::mem::RasterFactory, te::qt::widgets::ChartStyleFrameFactory, te::qt::widgets::HistogramFrameFactory, te::qt::widgets::ScatterFrameFactory, te::qt::widgets::TimeSeriesFrameFactory, te::qt::af::TableWidgetFactory, te::qt::af::ToolbarsWidgetFactory, te::map::AbstractLayerRendererFactory, te::gm::AffineGTFactory, te::gm::ProjectiveGTFactory, te::gm::RSTGTFactory, te::gm::SecondDegreePolynomialGTFactory, te::gm::ThirdDegreePolynomialGTFactory, te::map::DataSetLayerRendererFactory, te::map::QueryLayerRendererFactory, te::map::RasterLayerRendererFactory, te::qt::af::DisplayWidgetFactory, te::qt::af::GeneralConfigWidgetFactory, te::xerces::ReaderFactory, te::xerces::WriterFactory, ProjectWidgetFactory, te::plugin::CppPluginEngineFactory, and te::wms::WMSLayerRendererFactory.
Referenced by te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::make().
|
inlinestatic |
Definition at line 164 of file AbstractFactory.h.
References te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::find().
Referenced by te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::find(), and te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::make().
|
inlinestatic |
It returns a reference to the internal dictionary of concrete factories.
The dictionary is a singleton.
Definition at line 157 of file AbstractFactory.h.
Referenced by te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::AbstractFactory(), and te::qt::af::SettingsWidgetsFactory::make().
|
inline |
It returns the factory key associated to the concreate factory.
Definition at line 140 of file AbstractFactory.h.
|
inlinestatic |
It creates an object with the appropriated factory.
factoryKey | A key that identifies the factory used to build the object. |
Exception | If the concrete factory is not specified or the object can not be built for any reason this methiod may throws an exception. |
Definition at line 146 of file AbstractFactory.h.
References te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::build(), te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::find(), and TE_TR.
|
friend |
Definition at line 75 of file AbstractFactory.h.
|
protected |
The key that identifies the concrete factory: it will be used for unregistering the factory during destruction.
Definition at line 136 of file AbstractFactory.h.