OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimFactoryBase< Product > Class Template Referenceabstract

#include <ossimFactoryBaseTemplate.h>

Public Member Functions

virtual Product * create (const ossimString &) const =0
 
virtual Product * create (const ossimKeywordlist &kwl, const char *prefix) const =0
 
virtual std::list< ossimStringgetList () const =0
 
void registerFactory (ossimFactoryBase< Product > *new_factory)
 

Protected Member Functions

 ossimFactoryBase ()
 
virtual ~ossimFactoryBase ()
 

Protected Attributes

std::list< ossimFactoryBase< Product > * > theRegistry
 

Detailed Description

template<class Product>
class ossimFactoryBase< Product >


TEMPLATE: ossimFactoryBase
NOTE: This is primarily intended as an interface template only to insure that all factories prescribe to a common type. Concrete classes shall be derived from an instance of this template as:

class MyFactory : public ossimFactoryBase<MyProductClass>

where MyProductClass is the class type being produced.

This template is applicable to "Registry" type factories that have one or more sub-factories. Thus, a common interface is provided without the client distinguishing between registries and factories.

EXAMPLE: Refer to the projection factories for a working example of the use of this base class template. Specifically, refer to the files:

Definition at line 48 of file ossimFactoryBaseTemplate.h.

Constructor & Destructor Documentation

◆ ossimFactoryBase()

template<class Product>
ossimFactoryBase< Product >::ossimFactoryBase ( )
inlineprotected

PROTECTED DEFAULT CONSTRUCTOR Gives concrete class the opportunity to perform initialization tasks since this is called once with first instance() call. If the derived factory is to serve as a sub-factory registry, then have the derived class' constructor call registerFactory() for all of the default sub-factories involved.

Definition at line 100 of file ossimFactoryBaseTemplate.h.

100 {};

◆ ~ossimFactoryBase()

template<class Product>
virtual ossimFactoryBase< Product >::~ossimFactoryBase ( )
inlineprotectedvirtual

Definition at line 102 of file ossimFactoryBaseTemplate.h.

102 {}

Member Function Documentation

◆ create() [1/2]

template<class Product>
virtual Product* ossimFactoryBase< Product >::create ( const ossimString ) const
pure virtual

METHOD: instance() For accessing static singleton instance of concrete factory. The derived class implementation of this method invokes the factory's private constructor. MUST BE PROVIDED BY CONCRETE DERIVED CLASS as follows:

static <ossimFactoryBase-derived class>* instance();

PURE VIRTUAL METHODS: create(string), create(keywordlist, prefix)

Attempts to create an instance of the Product given a string or keywordlist. It is up to the concrete factory implementation to decide how to interpret string. It could conceivably represent a "magic number" specification of a product (such as the class name). Or, it could be a filename that the factory must open to decide which product to instantiate. The derived factory can also define other create methods following the model used here.

Returns successfully constructed product or NULL.

Implemented in ossimElevCellHandlerFactory, and ossimAnnotationObjectFactory.

◆ create() [2/2]

template<class Product>
virtual Product* ossimFactoryBase< Product >::create ( const ossimKeywordlist kwl,
const char *  prefix 
) const
pure virtual

◆ getList()

template<class Product>
virtual std::list<ossimString> ossimFactoryBase< Product >::getList ( ) const
pure virtual

PURE VIRTUAL METHOD: getList() Returns name list of all products represented by this factory:

Implemented in ossimElevCellHandlerFactory, and ossimAnnotationObjectFactory.

◆ registerFactory()

template<class Product>
void ossimFactoryBase< Product >::registerFactory ( ossimFactoryBase< Product > *  new_factory)
inline

METHOD: registerFactory() Adds sub-factories to this one. Relevant for the case where the derived factory maintains a registry of sub-factories.

Definition at line 88 of file ossimFactoryBaseTemplate.h.

89  { if(new_factory) theRegistry.push_back(new_factory); }
std::list< ossimFactoryBase< Product > * > theRegistry

Member Data Documentation

◆ theRegistry

template<class Product>
std::list<ossimFactoryBase<Product>*> ossimFactoryBase< Product >::theRegistry
protected

Member contains list of sub-factories associated with this factory:

Definition at line 107 of file ossimFactoryBaseTemplate.h.


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