OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ossimInfoFactoryRegistry Class Reference

#include <ossimInfoFactoryRegistry.h>

Public Member Functions

 ~ossimInfoFactoryRegistry ()
 destructor More...
 
void registerFactory (ossimInfoFactoryInterface *factory)
 Method to add factory to registry. More...
 
void registerFactoryToFront (ossimInfoFactoryInterface *factory)
 Adds factory to the front of the registry. More...
 
void unregisterFactory (ossimInfoFactoryInterface *factory)
 Method to remove a factory from the registry. More...
 
std::shared_ptr< ossimInfoBasecreate (const ossimFilename &file) const
 Create method. More...
 
std::shared_ptr< ossimInfoBasecreate (std::shared_ptr< ossim::istream > &str, const std::string &connectionString) const
 Create method. More...
 

Static Public Member Functions

static ossimInfoFactoryRegistryinstance ()
 instance method More...
 

Protected Member Functions

 ossimInfoFactoryRegistry ()
 Hidden from use default constructor. More...
 
 ossimInfoFactoryRegistry (const ossimInfoFactoryRegistry &obj)
 hidden from use copy constructor More...
 
const ossimInfoFactoryRegistryoperator= (const ossimInfoFactoryRegistry &rhs)
 hidden from use assignment operator More...
 

Protected Attributes

std::vector< ossimInfoFactoryInterface * > m_factoryList
 
std::mutex m_mutex
 

Static Protected Attributes

static ossimInfoFactoryRegistrym_instance = 0
 

Detailed Description

Definition at line 27 of file ossimInfoFactoryRegistry.h.

Constructor & Destructor Documentation

◆ ~ossimInfoFactoryRegistry()

ossimInfoFactoryRegistry::~ossimInfoFactoryRegistry ( )

destructor

Definition at line 24 of file ossimInfoFactoryRegistry.cpp.

References m_factoryList.

25 {
26  m_factoryList.clear();
27 }
std::vector< ossimInfoFactoryInterface * > m_factoryList

◆ ossimInfoFactoryRegistry() [1/2]

ossimInfoFactoryRegistry::ossimInfoFactoryRegistry ( )
protected

Hidden from use default constructor.

hidden from use default constructor

Note
Adds ossimInfoFactory to registry.

Definition at line 133 of file ossimInfoFactoryRegistry.cpp.

References ossimInfoFactory::instance(), and registerFactory().

Referenced by instance().

134  : m_factoryList(),
135  m_mutex()
136 {
138 }
std::vector< ossimInfoFactoryInterface * > m_factoryList
static ossimInfoFactory * instance()
void registerFactory(ossimInfoFactoryInterface *factory)
Method to add factory to registry.

◆ ossimInfoFactoryRegistry() [2/2]

ossimInfoFactoryRegistry::ossimInfoFactoryRegistry ( const ossimInfoFactoryRegistry obj)
protected

hidden from use copy constructor

Definition at line 141 of file ossimInfoFactoryRegistry.cpp.

143 {}

Member Function Documentation

◆ create() [1/2]

std::shared_ptr< ossimInfoBase > ossimInfoFactoryRegistry::create ( const ossimFilename file) const

Create method.

Parameters
fileSome file you want info for.
Returns
ossimInfoBase* on success 0 on failure. Caller is responsible for memory.

Definition at line 74 of file ossimInfoFactoryRegistry.cpp.

References ossimString::c_str(), ossim::StreamFactoryRegistry::instance(), and m_factoryList.

Referenced by ossimJpipProjectionFactory::createProjection(), ossimInfo::dumpImage(), and ossimInfo::prettyPrint().

76 {
77  std::shared_ptr<ossimInfoBase> result(0);
78 
79  std::shared_ptr<ossim::istream> str = ossim::StreamFactoryRegistry::instance()->
80  createIstream( file.c_str(), std::ios_base::in|std::ios_base::binary );
81  if ( str )
82  {
83  std::string connectionString = file.c_str();
84  result = create( str, connectionString );
85  str.reset();
86  }
87 
88  if(!result)
89  {
90  std::vector<ossimInfoFactoryInterface*>::const_iterator i =
91  m_factoryList.begin();
92 
93  while ( i != m_factoryList.end() )
94  {
95  result = (*i)->create( file );
96  if ( result )
97  {
98  break;
99  }
100  ++i;
101  }
102  }
103 
104  return result;
105 }
static StreamFactoryRegistry * instance()
std::vector< ossimInfoFactoryInterface * > m_factoryList
std::shared_ptr< ossimInfoBase > create(const ossimFilename &file) const
Create method.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396

◆ create() [2/2]

std::shared_ptr< ossimInfoBase > ossimInfoFactoryRegistry::create ( std::shared_ptr< ossim::istream > &  str,
const std::string &  connectionString 
) const

Create method.

Parameters
fileSome file you want info for.
Returns
ossimInfoBase* on success 0 on failure. Caller is responsible for memory.

Definition at line 107 of file ossimInfoFactoryRegistry.cpp.

References m_factoryList.

110 {
111  std::shared_ptr<ossimInfoBase> result(0);
112  if ( str )
113  {
114  std::vector<ossimInfoFactoryInterface*>::const_iterator i =
115  m_factoryList.begin();
116 
117  while ( i != m_factoryList.end() )
118  {
119  result = (*i)->create(str, connectionString);
120  if ( result )
121  {
122  break;
123  }
124  str->clear();
125  str->seekg(0);
126  ++i;
127  }
128  }
129  return result;
130 }
std::vector< ossimInfoFactoryInterface * > m_factoryList

◆ instance()

ossimInfoFactoryRegistry * ossimInfoFactoryRegistry::instance ( )
static

instance method

Returns
Pointer to the instance of the registry.

Definition at line 29 of file ossimInfoFactoryRegistry.cpp.

References m_instance, and ossimInfoFactoryRegistry().

Referenced by ossimJpipProjectionFactory::createProjection(), ossimInfo::dumpImage(), ossimSharedLibraryFinalize(), ossimSharedLibraryInitialize(), and ossimInfo::prettyPrint().

30 {
31  if ( !m_instance )
32  {
34  }
35  return m_instance;
36 }
ossimInfoFactoryRegistry()
Hidden from use default constructor.
static ossimInfoFactoryRegistry * m_instance

◆ operator=()

const ossimInfoFactoryRegistry & ossimInfoFactoryRegistry::operator= ( const ossimInfoFactoryRegistry rhs)
protected

hidden from use assignment operator

hidden from use operator =

Definition at line 146 of file ossimInfoFactoryRegistry.cpp.

148 {
149  return *this;
150 }

◆ registerFactory()

void ossimInfoFactoryRegistry::registerFactory ( ossimInfoFactoryInterface factory)

Method to add factory to registry.

Parameters
factoryFactory to register.

Definition at line 38 of file ossimInfoFactoryRegistry.cpp.

References m_factoryList, and m_mutex.

Referenced by ossimInfoFactoryRegistry(), and ossimSharedLibraryInitialize().

40 {
41  if (factory)
42  {
43  m_mutex.lock();
44  m_factoryList.push_back(factory);
45  m_mutex.unlock();
46  }
47 }
std::vector< ossimInfoFactoryInterface * > m_factoryList

◆ registerFactoryToFront()

void ossimInfoFactoryRegistry::registerFactoryToFront ( ossimInfoFactoryInterface factory)

Adds factory to the front of the registry.

Parameters
factoryFactory to register.

Definition at line 49 of file ossimInfoFactoryRegistry.cpp.

References m_factoryList, and m_mutex.

Referenced by ossimSharedLibraryInitialize().

51 {
52  if (factory)
53  {
54  m_mutex.lock();
55  m_factoryList.insert( m_factoryList.begin(), factory );
56  m_mutex.unlock();
57  }
58 }
std::vector< ossimInfoFactoryInterface * > m_factoryList

◆ unregisterFactory()

void ossimInfoFactoryRegistry::unregisterFactory ( ossimInfoFactoryInterface factory)

Method to remove a factory from the registry.

Used by plugins when they are unloaded.

Parameters
factoryFactory to remove.

Definition at line 60 of file ossimInfoFactoryRegistry.cpp.

References m_factoryList, and m_mutex.

62 {
63  m_mutex.lock();
64  std::vector<ossimInfoFactoryInterface*>::iterator i =
65  std::find(m_factoryList.begin(), m_factoryList.end(), factory);
66 
67  if( i != m_factoryList.end() )
68  {
69  m_factoryList.erase(i);
70  }
71  m_mutex.unlock();
72 }
std::vector< ossimInfoFactoryInterface * > m_factoryList

Member Data Documentation

◆ m_factoryList

std::vector<ossimInfoFactoryInterface*> ossimInfoFactoryRegistry::m_factoryList
protected

◆ m_instance

ossimInfoFactoryRegistry * ossimInfoFactoryRegistry::m_instance = 0
staticprotected

Definition at line 100 of file ossimInfoFactoryRegistry.h.

Referenced by instance().

◆ m_mutex

std::mutex ossimInfoFactoryRegistry::m_mutex
protected

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