te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE > Class Template Referenceabstract

This class defines the interface of abstract factories without initializing parameters. More...

#include <AbstractFactory.h>

Inheritance diagram for te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >:

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_typefind (const TFACTORYKEY &factoryKey)
 
static dictionary_typegetDictionary ()
 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 >
 

Detailed Description

template<class TPRODUCT, class TFACTORYKEY, class TKEYCOMPARE = std::less<TFACTORYKEY>>
class te::common::AbstractFactory< TPRODUCT, 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.

See also
ParameterizedAbstractFactory, FactoryDictionary
Note
This class is not thread-safe for multiple writers.

Definition at line 69 of file AbstractFactory.h.

Member Typedef Documentation

◆ dictionary_type

template<class TPRODUCT, class TFACTORYKEY, class TKEYCOMPARE = std::less<TFACTORYKEY>>
typedef FactoryDictionary<AbstractFactory<TPRODUCT, TFACTORYKEY, TKEYCOMPARE>, TFACTORYKEY, TKEYCOMPARE> te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::dictionary_type

Definition at line 73 of file AbstractFactory.h.

◆ factory_type

template<class TPRODUCT, class TFACTORYKEY, class TKEYCOMPARE = std::less<TFACTORYKEY>>
typedef AbstractFactory te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::factory_type

Definition at line 77 of file AbstractFactory.h.

Constructor & Destructor Documentation

◆ AbstractFactory()

template<class TPRODUCT , class TFACTORYKEY, class TKEYCOMPARE >
te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::AbstractFactory ( const TFACTORYKEY &  factoryKey)
inlineprotected

It creates the factory and automatically registers it in the dictionary.

Parameters
factoryKeyThe key that identifies the factory.

Definition at line 172 of file AbstractFactory.h.

◆ ~AbstractFactory()

template<class TPRODUCT , class TFACTORYKEY , class TKEYCOMPARE >
te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::~AbstractFactory ( )
inlineprotectedvirtual

Virtual destructor.

Note
It will automatically unregister the factory from the dictionary.

Definition at line 179 of file AbstractFactory.h.

Member Function Documentation

◆ build()

template<class TPRODUCT, class TFACTORYKEY, class TKEYCOMPARE = std::less<TFACTORYKEY>>
virtual TPRODUCT* te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::build ( )
protectedpure virtual

Concrete factories (derived from this one) must implement this method in order to create objects.

Returns
It returns an object created by the concrete factory.

Implemented in te::rp::TiePointsLocatorSURFStrategyFactory, te::rp::TiePointsLocatorMoravecStrategyFactory, te::rp::ClassifierISOSegStrategyFactory, te::rp::SegmenterRegionGrowingBaatzStrategyFactory, te::rp::SegmenterRegionGrowingMeanStrategyFactory, te::rp::ClassifierMaxLikelihoodStrategyFactory, te::rp::MixtureModelLinearStrategyFactory, te::rp::ClassifierMAPStrategyFactory, te::rp::ClassifierSAMStrategyFactory, te::rp::ClassifierEDStrategyFactory, te::rp::MixtureModelPCAStrategyFactory, te::rp::ClassifierEMStrategyFactory, te::rp::ClassifierKMeansStrategyFactory, te::rp::ClassifierDummyStrategyFactory, te::rp::SegmenterDummyStrategyFactory, te::graph::DirectedGraphFactory, te::graph::BidirectionalGraphFactory, 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::ws::ogc::wms::qt::WMSGetFeatureInfoMakerFactory, te::graph::FIFOCachePolicyFactory, te::graph::LFUCachePolicyFactory, te::qt::widgets::DateTimePropertyWidgetFactory, te::qt::widgets::GeometryPropertyWidgetFactory, te::qt::widgets::NumericPropertyWidgetFactory, te::qt::widgets::StringPropertyWidgetFactory, te::ws::ogc::wms::version_1_1_1::WMSXMLParserFactory, te::ws::ogc::wms::WMSXMLParserFactory, te::mem::RasterFactory, te::qt::plugins::rp::RasterConfigWidgetFactory, te::qt::plugins::vp::VectorProcessingConfigWidgetFactory, te::qt::widgets::ChartStyleFrameFactory, te::qt::widgets::HistogramFrameFactory, te::qt::widgets::ScatterFrameFactory, te::qt::widgets::TimeSeriesFrameFactory, te::xerces::ReaderFactory, te::xerces::WriterFactory, te::qt::af::TableWidgetFactory, te::qt::af::ToolbarsWidgetFactory, te::map::AbstractLayerRendererFactory, te::qt::widgets::DefaultFeatureInfoMakerFactory, te::gm::AffineGTFactory, te::gm::ProjectiveGTFactory, te::gm::RSTGTFactory, te::gm::SecondDegreePolynomialGTFactory, te::gm::ThirdDegreePolynomialGTFactory, te::map::QueryLayerRendererFactory, te::qt::af::DisplayWidgetFactory, te::qt::af::GeneralConfigWidgetFactory, te::ws::ogc::wms::WMSLayerRendererFactory, and ProjectWidgetFactory.

Referenced by te::common::AbstractFactory< te::qt::widgets::ChartWidget, std::string >::make().

◆ find()

template<class TPRODUCT , class TFACTORYKEY, class TKEYCOMPARE >
const AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::factory_type * te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::find ( const TFACTORYKEY &  factoryKey)
inlinestatic

◆ getDictionary()

template<class TPRODUCT , class TFACTORYKEY , class TKEYCOMPARE >
AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::dictionary_type & te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::getDictionary ( )
inlinestatic

It returns a reference to the internal dictionary of concrete factories.

The dictionary is a singleton.

Returns
A reference to the internal dictionary.

Definition at line 157 of file AbstractFactory.h.

Referenced by te::qt::af::SettingsWidgetsFactory::make().

◆ getKey()

template<class TPRODUCT , class TFACTORYKEY , class TKEYCOMPARE >
const TFACTORYKEY & te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::getKey ( ) const
inline

It returns the factory key associated to the concreate factory.

Returns
The factory key associated to the concreate factory.

Definition at line 140 of file AbstractFactory.h.

◆ make()

template<class TPRODUCT , class TFACTORYKEY, class TKEYCOMPARE >
TPRODUCT * te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::make ( const TFACTORYKEY &  factoryKey)
inlinestatic

It creates an object with the appropriated factory.

Parameters
factoryKeyA key that identifies the factory used to build the object.
Returns
It returns a new object created by the given factory.
Exceptions
ExceptionIf the concrete factory is not specified or the object can not be built for any reason this methiod may throws an exception.
Note
The caller of this method will take the ownership of the returned object.

Definition at line 146 of file AbstractFactory.h.

Friends And Related Function Documentation

◆ FactoryDictionary< AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >, TFACTORYKEY, TKEYCOMPARE >

template<class TPRODUCT, class TFACTORYKEY, class TKEYCOMPARE = std::less<TFACTORYKEY>>
friend class FactoryDictionary< AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >, TFACTORYKEY, TKEYCOMPARE >
friend

Definition at line 75 of file AbstractFactory.h.

Member Data Documentation

◆ m_factoryKey

template<class TPRODUCT, class TFACTORYKEY, class TKEYCOMPARE = std::less<TFACTORYKEY>>
TFACTORYKEY te::common::AbstractFactory< TPRODUCT, TFACTORYKEY, TKEYCOMPARE >::m_factoryKey
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.


The documentation for this class was generated from the following file: