OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossim::FactoryListBase< T > Class Template Reference

#include <FactoryListBase.h>

Public Types

typedef std::vector< T > FactoryListType
 
typedef std::vector< ossimStringTypeNameList
 

Public Member Functions

 FactoryListBase ()
 
void addFactory (T factory)
 This is for backward compatability and calls registerFactory for simple adds. More...
 
bool isFactoryRegistered (T factory) const
 Public access method to determine if a factory is already registered to this list. More...
 
void registerFactory (T factory, bool pushToFrontFlag=false)
 Will register a factory to the factory list. More...
 
void unregisterFactory (T factory)
 Will remove the factory from the registry. More...
 
void unregisterAllFactories ()
 Will remove all factories from the registry. More...
 
void registerFactoryToFront (T factory)
 Inserts the factory to the front of the list. More...
 
void registerFactoryBefore (T factory, T beforeThisFactory)
 Will insert the factory before the beforeThisFactory. More...
 

Protected Member Functions

bool findFactory (T factory) const
 Utility to find a factory in the list. More...
 

Protected Attributes

ossim::RWLock m_rwlock
 
FactoryListType m_factoryList
 

Detailed Description

template<class T>
class ossim::FactoryListBase< T >

Definition at line 20 of file FactoryListBase.h.

Member Typedef Documentation

◆ FactoryListType

template<class T>
typedef std::vector<T> ossim::FactoryListBase< T >::FactoryListType

Definition at line 23 of file FactoryListBase.h.

◆ TypeNameList

template<class T>
typedef std::vector<ossimString> ossim::FactoryListBase< T >::TypeNameList

Definition at line 24 of file FactoryListBase.h.

Constructor & Destructor Documentation

◆ FactoryListBase()

template<class T>
ossim::FactoryListBase< T >::FactoryListBase ( )
inline

Definition at line 26 of file FactoryListBase.h.

26 {}

Member Function Documentation

◆ addFactory()

template<class T>
void ossim::FactoryListBase< T >::addFactory ( factory)
inline

This is for backward compatability and calls registerFactory for simple adds.

Definition at line 31 of file FactoryListBase.h.

32  {
33  registerFactory(factory);
34  }
void registerFactory(T factory, bool pushToFrontFlag=false)
Will register a factory to the factory list.

◆ findFactory()

template<class T>
bool ossim::FactoryListBase< T >::findFactory ( factory) const
inlineprotected

◆ isFactoryRegistered()

template<class T>
bool ossim::FactoryListBase< T >::isFactoryRegistered ( factory) const
inline

Public access method to determine if a factory is already registered to this list.

Definition at line 40 of file FactoryListBase.h.

41  {
42  if(!factory) return false;
43  ScopeReadLock scopedReadLock(m_rwlock);
44 
45  return findFactory(factory);
46  }
bool findFactory(T factory) const
Utility to find a factory in the list.

◆ registerFactory()

template<class T>
void ossim::FactoryListBase< T >::registerFactory ( factory,
bool  pushToFrontFlag = false 
)
inline

Will register a factory to the factory list.

Will append the passed in factory if not already registered to the list.

Definition at line 52 of file FactoryListBase.h.

Referenced by ossim::FactoryListBase< std::shared_ptr< ossim::StateFactoryBase< std::shared_ptr< ossim::ImageHandlerState > > > >::addFactory().

53  {
54  if(!factory) return;
55  ScopeWriteLock scopedWriteLock(m_rwlock);
56  if(!findFactory(factory))
57  {
58  if (pushToFrontFlag)
59  {
60  m_factoryList.insert(m_factoryList.begin(), factory);
61  }
62  else
63  {
64  m_factoryList.push_back(factory);
65  }
66  }
67  }
FactoryListType m_factoryList
bool findFactory(T factory) const
Utility to find a factory in the list.

◆ registerFactoryBefore()

template<class T>
void ossim::FactoryListBase< T >::registerFactoryBefore ( factory,
beforeThisFactory 
)
inline

Will insert the factory before the beforeThisFactory.

If not found it will do a simple append.

Definition at line 110 of file FactoryListBase.h.

111  {
112  ScopeWriteLock scopedWriteLock(m_rwlock);
113 
114  if(!findFactory(factory))
115  {
116  ossim_uint32 idx = 0;
117  for(idx = 0; idx < m_factoryList.size(); ++idx)
118  {
119  if(beforeThisFactory == m_factoryList[idx])
120  {
121  m_factoryList.insert(m_factoryList.begin() + idx, factory);
122  return;
123  }
124  }
125  m_factoryList.push_back(factory);
126  }
127  }
FactoryListType m_factoryList
unsigned int ossim_uint32
bool findFactory(T factory) const
Utility to find a factory in the list.

◆ registerFactoryToFront()

template<class T>
void ossim::FactoryListBase< T >::registerFactoryToFront ( factory)
inline

Inserts the factory to the front of the list.

Definition at line 97 of file FactoryListBase.h.

98  {
99  ScopeWriteLock scopedWriteLock(m_rwlock);
100  if(!findFactory(factory))
101  {
102  m_factoryList.insert(m_factoryList.begin(), factory);
103  }
104  }
FactoryListType m_factoryList
bool findFactory(T factory) const
Utility to find a factory in the list.

◆ unregisterAllFactories()

template<class T>
void ossim::FactoryListBase< T >::unregisterAllFactories ( )
inline

Will remove all factories from the registry.

Definition at line 88 of file FactoryListBase.h.

89  {
90  ScopeWriteLock scopedWriteLock(m_rwlock);
91  m_factoryList.clear();
92  }
FactoryListType m_factoryList

◆ unregisterFactory()

template<class T>
void ossim::FactoryListBase< T >::unregisterFactory ( factory)
inline

Will remove the factory from the registry.

Definition at line 71 of file FactoryListBase.h.

72  {
73  ScopeWriteLock scopedWriteLock(m_rwlock);
74  ossim_uint32 idx = 0;
75  for(idx = 0; idx < m_factoryList.size(); ++idx)
76  {
77  if(factory == m_factoryList[idx])
78  {
79  m_factoryList.erase(m_factoryList.begin() + idx);
80  return;
81  }
82  }
83  }
FactoryListType m_factoryList
unsigned int ossim_uint32

Member Data Documentation

◆ m_factoryList

template<class T>
FactoryListType ossim::FactoryListBase< T >::m_factoryList
protected

◆ m_rwlock

template<class T>
ossim::RWLock ossim::FactoryListBase< T >::m_rwlock
mutableprotected

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