OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimImageSourceFactoryRegistry.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks.com)
6 //
7 //*************************************************************************
8 // $Id: ossimImageSourceFactoryRegistry.cpp 9963 2006-11-28 21:11:01Z gpotts $
9 #include <algorithm>
13 #include <ossim/base/ossimString.h>
14 
16 
17 RTTI_DEF1(ossimImageSourceFactoryRegistry, "ossimImageSourceFactoryRegistry", ossimImageSourceFactoryBase);
18 
20 {
21  theInstance = this;
22 }
23 
25 {
27 
28  theInstance = NULL;
29 }
30 
32 {
33  if(theInstance == NULL)
34  {
38  }
39  return theInstance;
40 }
41 
43 {
44  ossimObject* result = NULL;
45  std::vector<ossimImageSourceFactoryBase*>::const_iterator factory;
46 
47  factory = theFactoryList.begin();
48  while((factory != theFactoryList.end()) && !result)
49  {
50  result = (*factory)->createObject(name);
51  ++factory;
52  }
53 
54  return result;
55 }
56 
58  const char* prefix)const
59 {
60  ossimObject* result = NULL;
61  std::vector<ossimImageSourceFactoryBase*>::const_iterator factory;
62 
63  factory = theFactoryList.begin();
64  while((factory != theFactoryList.end()) && !result)
65  {
66  result = (*factory)->createObject(kwl, prefix);
67  ++factory;
68  }
69 
70  return result;
71 
72 }
73 
74 void ossimImageSourceFactoryRegistry::getTypeNameList(std::vector<ossimString>& typeList)const
75 {
76  std::vector<ossimString> result;
77  std::vector<ossimImageSourceFactoryBase*>::const_iterator iter = theFactoryList.begin();
78 
79  while(iter != theFactoryList.end())
80  {
81  result.clear();
82  (*iter)->getTypeNameList(result);
83 
84  // now append to the end of the typeList.
85  typeList.insert(typeList.end(),
86  result.begin(),
87  result.end());
88  ++iter;
89  }
90 
91 }
92 
94 {
95  if(factory&&!findFactory(factory))
96  {
97  theFactoryList.push_back(factory);
98  }
99 }
100 
102 {
103  std::vector<ossimImageSourceFactoryBase*>::iterator iter = std::find(theFactoryList.begin(),
104  theFactoryList.end(),
105  factory);
106  if(iter != theFactoryList.end())
107  {
108  theFactoryList.erase(iter);
109  }
110 }
111 
113 {
114  return (std::find(theFactoryList.begin(),
115  theFactoryList.end(),
116  factory)!=theFactoryList.end());
117 }
118 
120 {
122 }
123 
124 // Hidden
127 {}
128 
129 // Hidden
131 {}
RTTI_DEF1(ossimImageSourceFactoryRegistry, "ossimImageSourceFactoryRegistry", ossimImageSourceFactoryBase)
Represents serializable keyword/value map.
void unregisterFactory(ossimImageSourceFactoryBase *factory)
void * ossimImageSourceFactoryRegistryGetInstance()
void operator=(ossimImageSourceFactoryRegistry &)
static ossimImageSourceFactory * instance()
bool findFactory(ossimImageSourceFactoryBase *factory) const
void registerFactory(ossimImageSourceFactoryBase *factory)
static ossimImageReconstructionFilterRegistry * instance()
std::vector< ossimImageSourceFactoryBase * > theFactoryList
static ossimImageSourceFactoryRegistry * theInstance
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
virtual ossimObject * createObject(const ossimString &name) const
static ossimImageSourceFactoryRegistry * instance()