OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimDatumFactoryRegistry.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: See top level LICENSE.txt file
4 //
5 // Author: David Burken
6 //
7 // Description: Class definition of Registry (singleton) for datum factories.
8 //
9 //----------------------------------------------------------------------------
10 // $Id$
11 
15 #include <ossim/base/ossimDatum.h>
16 #include <ossim/base/ossimString.h>
17 
18 //ossimDatumFactoryRegistry* ossimDatumFactoryRegistry::theInstance = 0;
19 
21 {
22 }
23 
25 {
26  static ossimDatumFactoryRegistry inst;
27 
28  return &inst;
29  //if (!theInstance)
30  //{
31  // theInstance = new ossimDatumFactoryRegistry;
32  // }
33  // return theInstance;
34 }
35 
38 {
39  if (factory)
40  {
41  theFactoryList.push_back(factory);
42  }
43 }
44 
46  const ossimString &code)const
47 {
48  const ossimDatum* result = 0;
49 
50  std::vector<ossimDatumFactoryInterface*>::const_iterator i =
51  theFactoryList.begin();
52 
53  while (i != theFactoryList.end())
54  {
55  result = (*i)->create(code);
56  if (result)
57  {
58  break;
59  }
60  ++i; // go to next factory
61  }
62  return result;
63 }
64 
66  const char *prefix)const
67 {
68  const ossimDatum* result = 0;
69  std::vector<ossimDatumFactoryInterface*>::const_iterator i = theFactoryList.begin();
70 
71  while (i != theFactoryList.end())
72  {
73  result = (*i)->create(kwl, prefix);
74  if (result)
75  return result;
76 
77  ++i; // go to next factory
78  }
79  return result;
80 }
81 
82 void ossimDatumFactoryRegistry::getList(std::vector<ossimString>& list) const
83 {
84  std::vector<ossimDatumFactoryInterface*>::const_iterator i =
85  theFactoryList.begin();
86  while (i != theFactoryList.end())
87  {
88  (*i)->getList(list);
89  ++i;
90  }
91 }
92 
94  : theFactoryList()
95 {
98 }
void registerFactory(ossimDatumFactoryInterface *factory)
Method to add factory to registry.
Represents serializable keyword/value map.
static ossimDatumFactoryRegistry * instance()
instance method
std::vector< ossimDatumFactoryInterface * > theFactoryList
virtual const ossimDatum * create(const ossimString &code) const
create method
static ossimDatumFactory * instance()
virtual void getList(std::vector< ossimString > &list) const
getList method to return a combined list of all datums from registered datum factories.
static ossimEpsgDatumFactory * instance()
Singleton implementation.
ossimDatumFactoryRegistry()
hidden from use default constructor