OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfDesFactoryRegistry.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // LICENSE: See top level LICENSE.txt file.
4 //
5 // Author:
6 //
7 // Description: Nitf support class
8 //
9 //********************************************************************
10 // $Id: ossimNitfDesFactoryRegistry.cpp 22875 2014-08-27 13:52:03Z dburken $
11 
14 
15 #include <algorithm> /* for std::find */
16 
18 {
20 }
21 
23 {
24 }
25 
27 {
28  if(aFactory&&!exists(aFactory))
29  {
30  theFactoryList.push_back(aFactory);
31  }
32 }
33 
36 {
37  std::vector<ossimNitfDesFactory*>::iterator iter =
38  std::find(theFactoryList.begin(),
39  theFactoryList.end(),
40  aFactory);
41  if(iter != theFactoryList.end())
42  {
43  theFactoryList.erase(iter);
44  }
45 }
46 
48 {
49  static ossimNitfDesFactoryRegistry inst;
50  return &inst;
51 }
52 
54 {
55  std::vector<ossimNitfDesFactory*>::const_iterator factory;
57 
58  factory = theFactoryList.begin();
59  while(factory != theFactoryList.end())
60  {
61  result = (*factory)->create(desName);
62 
63  if(result.valid())
64  {
65  return result;
66  }
67  ++factory;
68  }
69 
70  return result;
71  //ossimRefPtr<ossimNitfRegisteredDes> des = new ossimNitfUnknownDes;
72  //return des;
73 }
74 
76 {
78 }
79 
81 {
82  std::vector<ossimNitfDesFactory*>::const_iterator iter = std::find(theFactoryList.begin(),
83  theFactoryList.end(),
84  factory);
85 
86  return (iter != theFactoryList.end());
87 
88 }
89 
92 {
93 }
94 
97 {
98  return *this;
99 }
void unregisterFactory(ossimNitfDesFactory *aFactory)
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimNitfRegisteredDes > create(const ossimString &desName) const
static ossimNitfRegisteredDesFactory * instance()
std::vector< ossimNitfDesFactory * > theFactoryList
static ossimNitfDesFactoryRegistry * instance()
const ossimNitfDesFactoryRegistry & operator=(const ossimNitfDesFactoryRegistry &factory)
hidden operator=
void registerFactory(ossimNitfDesFactory *aFactory)
bool exists(ossimNitfDesFactory *factory) const