OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimFactoryBaseTemplate.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // DESCRIPTION:
6 // Contains declaration of template class ossimFactory. This is the base
7 // type for all factories.
8 //
9 // SOFTWARE HISTORY:
10 //>
11 // 14Jun2001 Oscar Kramer (okramer@imagelinks.com)
12 // Initial coding.
13 //<
14 //*****************************************************************************
15 // $Id: ossimFactoryBaseTemplate.h 14799 2009-06-30 08:54:44Z dburken $
16 
17 #ifndef ossimFactory_HEADER
18 #define ossimFactory_HEADER
20 #include <list>
21 
22 class ossimKeywordlist;
23 class ossimString;
24 
25 /*!****************************************************************************
26  *
27  * TEMPLATE: ossimFactoryBase
28  *
29  * NOTE: This is primarily intended as an interface template only to insure
30  * that all factories prescribe to a common type. Concrete classes shall
31  * be derived from an instance of this template as:
32  *
33  * class MyFactory : public ossimFactoryBase<MyProductClass>
34  *
35  * where MyProductClass is the class type being produced.
36  *
37  * This template is applicable to "Registry" type factories that have
38  * one or more sub-factories. Thus, a common interface is provided
39  * without the client distinguishing between registries and factories.
40  *
41  * EXAMPLE: Refer to the projection factories for a working example of the
42  * use of this base class template. Specifically, refer to the files:
43  * - ../ossim_core/projections/factory/ossimProjectionFactory.h
44  * - ../ossim_core/projections/factory/ossimMapProjectionFactory.h
45  * - ../ossim_core/projections/factory/ossimSensorModelFactory.h
46  *
47  *****************************************************************************/
48 template <class Product> class OSSIMDLLEXPORT ossimFactoryBase
49 {
50 public:
73  virtual Product* create(const ossimString&) const = 0;
74  virtual Product* create(const ossimKeywordlist& kwl,
75  const char* prefix) const = 0;
76 
81  virtual std::list<ossimString> getList() const = 0;
82 
89  { if(new_factory) theRegistry.push_back(new_factory); }
90 
91 protected:
101 
102  virtual ~ossimFactoryBase() {}
103 
107  std::list<ossimFactoryBase<Product>*> theRegistry;
108 
109 };
110 
111 #endif
112 
#define OSSIMDLLEXPORT
Represents serializable keyword/value map.
std::list< ossimFactoryBase< Product > * > theRegistry
void registerFactory(ossimFactoryBase< Product > *new_factory)