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

#include <ossimObjectFactoryRegistry.h>

Inheritance diagram for ossimObjectFactoryRegistry:
ossimObject ossimFactoryListInterface< ossimObjectFactory, ossimObject > ossimReferenced

Public Member Functions

virtual ~ossimObjectFactoryRegistry ()
 
virtual ossimObjectcreateObject (const ossimString &name) const
 
virtual ossimObjectcreateObject (const ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual void getTypeNameList (std::vector< ossimString > &typeList) const
 
virtual void getTypeNameList (std::vector< ossimString > &typeList, const ossimString &baseType) const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimFactoryListInterface< ossimObjectFactory, ossimObject >
 ossimFactoryListInterface ()
 
void addFactory (ossimObjectFactory *factory)
 This is for backward compatability and calls registerFactory for simple adds. More...
 
bool isFactoryRegistered (ossimObjectFactory *factory) const
 Public access method to determine if a factory is already registered to this list. More...
 
void registerFactory (ossimObjectFactory *factory, bool pushToFrontFlag=false)
 Will register a factory to the factory list. More...
 
void unregisterFactory (ossimObjectFactory *factory)
 Will remove the factory from the registry. More...
 
void unregisterFactory (const ossimString &factoryTypeName)
 Will remove the factory from the registry by name. More...
 
void unregisterAllFactories ()
 Will remove all factories from the registry. More...
 
void registerFactoryToFront (ossimObjectFactory *factory)
 Inserts the factory to the front of the list. More...
 
void registerFactoryBefore (ossimObjectFactory *factory, ossimObjectFactory *beforeThisFactory)
 Will insert the factory before the beforeThisFactory. More...
 
void getAllTypeNamesFromRegistry (std::vector< ossimString > &typeList) const
 Will add all object types the factories can allocate. More...
 
ossimObjectcreateObjectFromRegistry (const ossimString &typeName) const
 This is the base object return for all objects in the system. More...
 
ossimObjectcreateObjectFromRegistry (const ossimKeywordlist &kwl, const char *prefix=0) const
 This is the base object return for all objects in the system. More...
 
ossimObjectcreateNativeObjectFromRegistry (const ossimString &typeName) const
 This is a helper method that calls the createObject and makes sure that the returned object is of the NativeType base type this registry supports. More...
 
ossimObjectcreateNativeObjectFromRegistry (const ossimKeywordlist &kwl, const char *prefix=0) const
 This is a helper method that calls the createObject and makes sure that the returned object is of the NativeType base type this registry supports. More...
 

Static Public Member Functions

static ossimObjectFactoryRegistryinstance ()
 

Protected Member Functions

 ossimObjectFactoryRegistry ()
 
 ossimObjectFactoryRegistry (const ossimObjectFactoryRegistry &)
 
void operator= (const ossimObjectFactoryRegistry &)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimFactoryListInterface< ossimObjectFactory, ossimObject >
bool findFactory (ossimObjectFactory *factory) const
 Utility to find a factory in the list. More...
 

Additional Inherited Members

- Public Types inherited from ossimFactoryListInterface< ossimObjectFactory, ossimObject >
typedef std::vector< ossimObjectFactory *> FactoryListType
 
typedef ossimObjectFactory FactoryType
 
typedef ossimObject NativeReturnType
 
- Protected Attributes inherited from ossimFactoryListInterface< ossimObjectFactory, ossimObject >
std::mutex m_factoryListMutex
 
FactoryListType m_factoryList
 

Detailed Description

Definition at line 20 of file ossimObjectFactoryRegistry.h.

Constructor & Destructor Documentation

◆ ~ossimObjectFactoryRegistry()

ossimObjectFactoryRegistry::~ossimObjectFactoryRegistry ( )
virtual

Definition at line 27 of file ossimObjectFactoryRegistry.cpp.

28 {
29 }

◆ ossimObjectFactoryRegistry() [1/2]

ossimObjectFactoryRegistry::ossimObjectFactoryRegistry ( )
protected

Definition at line 22 of file ossimObjectFactoryRegistry.cpp.

References ossimBaseObjectFactory::instance().

23 {
25 }
static ossimBaseObjectFactory * instance()
void registerFactory(ossimObjectFactory *factory, bool pushToFrontFlag=false)
Will register a factory to the factory list.

◆ ossimObjectFactoryRegistry() [2/2]

ossimObjectFactoryRegistry::ossimObjectFactoryRegistry ( const ossimObjectFactoryRegistry )
inlineprotected

Definition at line 60 of file ossimObjectFactoryRegistry.h.

60 :ossimObject(){}//hide

Member Function Documentation

◆ createObject() [1/2]

virtual ossimObject* ossimObjectFactoryRegistry::createObject ( const ossimString name) const
inlinevirtual

Definition at line 27 of file ossimObjectFactoryRegistry.h.

References ossimFactoryListInterface< T, NativeType >::createObjectFromRegistry().

Referenced by ossimIgenGenerator::createInput(), createObject(), ossimIgenGenerator::createOutput(), demo3(), ossimObject::dup(), and ossimInfo::printFactories().

28  {
29  return createObjectFromRegistry(name);
30  }
ossimObject * createObjectFromRegistry(const ossimString &typeName) const
This is the base object return for all objects in the system.

◆ createObject() [2/2]

virtual ossimObject* ossimObjectFactoryRegistry::createObject ( const ossimKeywordlist kwl,
const char *  prefix = 0 
) const
inlinevirtual

Definition at line 31 of file ossimObjectFactoryRegistry.h.

References ossimFactoryListInterface< T, NativeType >::createObjectFromRegistry().

33  {
34  return createObjectFromRegistry(kwl, prefix);
35  }
ossimObject * createObjectFromRegistry(const ossimString &typeName) const
This is the base object return for all objects in the system.

◆ getTypeNameList() [1/2]

virtual void ossimObjectFactoryRegistry::getTypeNameList ( std::vector< ossimString > &  typeList) const
inlinevirtual

Returns a type list of all objects that can be instantiated through the createObjectMethods above.

Definition at line 41 of file ossimObjectFactoryRegistry.h.

References ossimFactoryListInterface< T, NativeType >::getAllTypeNamesFromRegistry().

Referenced by ossimInfo::printFactories().

42  {
44  }
void getAllTypeNamesFromRegistry(std::vector< ossimString > &typeList) const
Will add all object types the factories can allocate.

◆ getTypeNameList() [2/2]

void ossimObjectFactoryRegistry::getTypeNameList ( std::vector< ossimString > &  typeList,
const ossimString baseType 
) const
virtual

returns a list of objects that are of the passed in base type. for example:

If I want all ossimImageSource objects then I call:

ossimObjectFactoryRegistry::instance()->getTypeNameList(l, "ossimImageSource");

Definition at line 140 of file ossimObjectFactoryRegistry.cpp.

References ossimObject::canCastTo(), createObject(), and ossimRefPtr< T >::valid().

142 {
143  vector<ossimString> allTypeList;
144 
145  getTypeNameList(allTypeList);
146 
147  if(baseType == "")
148  {
149  typeList.insert(typeList.end(),
150  allTypeList.begin(),
151  allTypeList.end());
152  }
153  else
154  {
155  int i = 0;
157  for(i = 0; i < (int)allTypeList.size(); ++i)
158  {
159  obj = createObject(allTypeList[i]);
160  if(obj.valid())
161  {
162  if(obj->canCastTo(baseType))
163  {
164  typeList.push_back(allTypeList[i]);
165  }
166  }
167  }
168  }
169 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
virtual ossimObject * createObject(const ossimString &name) const
virtual bool canCastTo(ossimObject *obj) const
Definition: ossimObject.cpp:74

◆ instance()

ossimObjectFactoryRegistry * ossimObjectFactoryRegistry::instance ( )
static

◆ operator=()

void ossimObjectFactoryRegistry::operator= ( const ossimObjectFactoryRegistry )
inlineprotected

Definition at line 61 of file ossimObjectFactoryRegistry.h.

61 {}//hide

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