Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtl::ObjectFactoryBase Class Reference

Create instances of classes using an object factory. More...

#include <igtlObjectFactoryBase.h>

Inheritance diagram for igtl::ObjectFactoryBase:
igtl::Object igtl::LightObject igtl::ObjectFactory< T >

List of all members.

Classes

class  OverrideInformation
 Internal implementation class for ObjectFactorBase. More...

Public Types

typedef SmartPointer< const SelfConstPointer
typedef SmartPointer< SelfPointer
typedef ObjectFactoryBase Self
typedef Object Superclass

Public Member Functions

virtual LightObject::Pointer CreateAnother () const
virtual void DebugOff () const
virtual void DebugOn () const
virtual void Delete ()
virtual void Disable (const char *className)
virtual std::list< std::string > GetClassOverrideDescriptions ()
virtual std::list< std::string > GetClassOverrideNames ()
virtual std::list< std::string > GetClassOverrideWithNames ()
bool GetDebug () const
virtual const char * GetDescription (void) const =0
virtual bool GetEnableFlag (const char *className, const char *subclassName)
virtual std::list< bool > GetEnableFlags ()
virtual const char * GetIGTLSourceVersion (void) const =0
const char * GetLibraryPath ()
virtual const char * GetNameOfClass () const
virtual int GetReferenceCount () const
 igtlTypeMacro (ObjectFactoryBase, Object)
 igtlTypeMacro (Object, LightObject)
void Print (std::ostream &os) const
virtual void Register () const
void SetDebug (bool debugFlag) const
virtual void SetEnableFlag (bool flag, const char *className, const char *subclassName)
virtual void SetReferenceCount (int)
virtual void UnRegister () const

Static Public Member Functions

static void BreakOnError ()
static std::list
< LightObject::Pointer
CreateAllInstance (const char *igtlclassname)
static LightObject::Pointer CreateInstance (const char *igtlclassname)
static std::list
< ObjectFactoryBase * > 
GetRegisteredFactories ()
static Pointer New ()
static void RegisterFactory (ObjectFactoryBase *)
static void ReHash ()
static void UnRegisterAllFactories ()
static void UnRegisterFactory (ObjectFactoryBase *)
static void SetGlobalWarningDisplay (bool flag)
static bool GetGlobalWarningDisplay ()
static void GlobalWarningDisplayOn ()
static void GlobalWarningDisplayOff ()

Protected Member Functions

virtual LightObject::Pointer CreateObject (const char *igtlclassname)
 ObjectFactoryBase ()
virtual void PrintSelf (std::ostream &os) const
void RegisterOverride (const char *classOverride, const char *overrideClassName, const char *description, bool enableFlag, CreateObjectFunctionBase *createFunction)
virtual ~ObjectFactoryBase ()
virtual void PrintHeader (std::ostream &os) const
virtual void PrintTrailer (std::ostream &os) const

Protected Attributes

volatile int m_ReferenceCount
SimpleFastMutexLock m_ReferenceCountLock

Detailed Description

Create instances of classes using an object factory.

ObjectFactoryBase is used to create igtl objects. The base class ObjectFactoryBase contains a static method CreateInstance() that is used to create igtl objects from the list of registerd ObjectFactoryBase sub-classes. The first time CreateInstance() is called, all dll's or shared libraries in the environment variable IGTL_AUTOLOAD_PATH are loaded into the current process. The C function igtlLoad is called on each dll. igtlLoad should return an instance of the factory sub-class implemented in the shared library. IGTL_AUTOLOAD_PATH is an environment variable containing a colon separated (semi-colon on win32) list of paths.

This can be use to overide the creation of any object in IGTL.

Definition at line 65 of file igtlObjectFactoryBase.h.


Member Typedef Documentation

Reimplemented from igtl::Object.

Definition at line 72 of file igtlObjectFactoryBase.h.

Reimplemented from igtl::Object.

Definition at line 71 of file igtlObjectFactoryBase.h.

Standard class typedefs.

Reimplemented from igtl::Object.

Definition at line 69 of file igtlObjectFactoryBase.h.

Reimplemented from igtl::Object.

Definition at line 70 of file igtlObjectFactoryBase.h.


Constructor & Destructor Documentation

igtl::ObjectFactoryBase::ObjectFactoryBase ( ) [protected]
virtual igtl::ObjectFactoryBase::~ObjectFactoryBase ( ) [protected, virtual]

Member Function Documentation

static void igtl::LightObject::BreakOnError ( ) [static, inherited]

This method is called when igtlExceptionMacro executes. It allows the debugger to break on error.

static std::list<LightObject::Pointer> igtl::ObjectFactoryBase::CreateAllInstance ( const char *  igtlclassname) [static]

Create and return all possible instances of the named igtl object. Each loaded ObjectFactoryBase will be asked in the order the factory was in the IGTL_AUTOLOAD_PATH. All created objects will be returned in the list.

virtual LightObject::Pointer igtl::Object::CreateAnother ( ) const [virtual, inherited]

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from igtl::LightObject.

static LightObject::Pointer igtl::ObjectFactoryBase::CreateInstance ( const char *  igtlclassname) [static]

Create and return an instance of the named igtl object. Each loaded ObjectFactoryBase will be asked in the order the factory was in the IGTL_AUTOLOAD_PATH. After the first factory returns the object no other factories are asked.

Referenced by igtl::ObjectFactory< T >::Create().

virtual LightObject::Pointer igtl::ObjectFactoryBase::CreateObject ( const char *  igtlclassname) [protected, virtual]

This method is provided by sub-classes of ObjectFactoryBase. It should create the named igtl object or return 0 if that object is not supported by the factory implementation.

virtual void igtl::Object::DebugOff ( ) const [virtual, inherited]

Turn debugging output off.

virtual void igtl::Object::DebugOn ( ) const [virtual, inherited]

Turn debugging output on.

virtual void igtl::LightObject::Delete ( ) [virtual, inherited]

Delete an igtl object. This method should always be used to delete an object when the new operator was used to create it. Using the C delete method will not work with reference counting.

virtual void igtl::ObjectFactoryBase::Disable ( const char *  className) [virtual]

Set all enable flags for the given class to 0. This will mean that the factory will stop producing class with the given name.

virtual std::list<std::string> igtl::ObjectFactoryBase::GetClassOverrideDescriptions ( ) [virtual]

Return a list of descriptions for class overrides.

virtual std::list<std::string> igtl::ObjectFactoryBase::GetClassOverrideNames ( ) [virtual]

Return a list of classes that this factory overrides.

virtual std::list<std::string> igtl::ObjectFactoryBase::GetClassOverrideWithNames ( ) [virtual]

Return a list of the names of classes that override classes.

bool igtl::Object::GetDebug ( ) const [inherited]

Get the value of the debug flag.

virtual const char* igtl::ObjectFactoryBase::GetDescription ( void  ) const [pure virtual]

Return a descriptive string describing the factory.

virtual bool igtl::ObjectFactoryBase::GetEnableFlag ( const char *  className,
const char *  subclassName 
) [virtual]

Get the Enable flag for the specific override of className.

virtual std::list<bool> igtl::ObjectFactoryBase::GetEnableFlags ( ) [virtual]

Return a list of enable flags.

static bool igtl::Object::GetGlobalWarningDisplay ( ) [static, inherited]

This is a global flag that controls whether any debug, warning or error messages are displayed.

virtual const char* igtl::ObjectFactoryBase::GetIGTLSourceVersion ( void  ) const [pure virtual]

All sub-classes of ObjectFactoryBase should must return the version of IGTL they were built with. This should be implemented with the macro IGTL_SOURCE_VERSION and NOT a call to Version::GetIGTLSourceVersion. As the version needs to be compiled into the file as a string constant. This is critical to determine possible incompatible dynamic factory loads.

const char* igtl::ObjectFactoryBase::GetLibraryPath ( )

This returns the path to a dynamically loaded factory.

virtual const char* igtl::LightObject::GetNameOfClass ( ) const [inline, virtual, inherited]

Return the name of this class as a string. Used by the object factory (implemented in New()) to instantiate objects of a named type. Also used for debugging and other output information.

Definition at line 86 of file igtlLightObject.h.

virtual int igtl::LightObject::GetReferenceCount ( ) const [inline, virtual, inherited]

Gets the reference count on this object.

Definition at line 112 of file igtlLightObject.h.

static std::list<ObjectFactoryBase*> igtl::ObjectFactoryBase::GetRegisteredFactories ( ) [static]

Return the list of all registered factories. This is NOT a copy, do not remove items from this list!

static void igtl::Object::GlobalWarningDisplayOff ( ) [inline, static, inherited]

This is a global flag that controls whether any debug, warning or error messages are displayed.

Definition at line 118 of file igtlObject.h.

References igtl::Object::SetGlobalWarningDisplay().

static void igtl::Object::GlobalWarningDisplayOn ( ) [inline, static, inherited]

This is a global flag that controls whether any debug, warning or error messages are displayed.

Definition at line 116 of file igtlObject.h.

References igtl::Object::SetGlobalWarningDisplay().

igtl::ObjectFactoryBase::igtlTypeMacro ( ObjectFactoryBase  ,
Object   
)

Run-time type information (and related methods).

igtl::Object::igtlTypeMacro ( Object  ,
LightObject   
) [inherited]

Standard part of all igtl objects.

static Pointer igtl::Object::New ( ) [static, inherited]

Method for creation through the object factory.

Reimplemented from igtl::LightObject.

Referenced by igtl::CreateObjectFunction< T >::CreateObject().

void igtl::LightObject::Print ( std::ostream &  os) const [inherited]

Cause the object to print itself out.

virtual void igtl::LightObject::PrintHeader ( std::ostream &  os) const [protected, virtual, inherited]

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

virtual void igtl::ObjectFactoryBase::PrintSelf ( std::ostream &  os) const [protected, virtual]

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from igtl::Object.

virtual void igtl::LightObject::PrintTrailer ( std::ostream &  os) const [protected, virtual, inherited]

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

virtual void igtl::Object::Register ( ) const [virtual, inherited]

Return this objects modified time. Update the modification time for this object. Many filters rely on the modification time to determine if they need to recompute their data. Increase the reference count (mark as used by another object).

Reimplemented from igtl::LightObject.

static void igtl::ObjectFactoryBase::RegisterFactory ( ObjectFactoryBase ) [static]

Register a factory so it can be used to create igtl objects.

void igtl::ObjectFactoryBase::RegisterOverride ( const char *  classOverride,
const char *  overrideClassName,
const char *  description,
bool  enableFlag,
CreateObjectFunctionBase createFunction 
) [protected]

Register object creation information with the factory.

static void igtl::ObjectFactoryBase::ReHash ( ) [static]

Re-check the IGTL_AUTOLOAD_PATH for new factory libraries. This calls UnRegisterAll before re-loading.

void igtl::Object::SetDebug ( bool  debugFlag) const [inherited]

Set the value of the debug flag. A non-zero value turns debugging on.

virtual void igtl::ObjectFactoryBase::SetEnableFlag ( bool  flag,
const char *  className,
const char *  subclassName 
) [virtual]

Set the Enable flag for the specific override of className.

static void igtl::Object::SetGlobalWarningDisplay ( bool  flag) [static, inherited]

This is a global flag that controls whether any debug, warning or error messages are displayed.

Referenced by igtl::Object::GlobalWarningDisplayOff(), and igtl::Object::GlobalWarningDisplayOn().

virtual void igtl::Object::SetReferenceCount ( int  ) [virtual, inherited]

Sets the reference count (use with care)

Reimplemented from igtl::LightObject.

virtual void igtl::Object::UnRegister ( ) const [virtual, inherited]

Decrease the reference count (release by another object).

Reimplemented from igtl::LightObject.

static void igtl::ObjectFactoryBase::UnRegisterAllFactories ( ) [static]

Unregister all factories.

static void igtl::ObjectFactoryBase::UnRegisterFactory ( ObjectFactoryBase ) [static]

Remove a factory from the list of registered factories.


Member Data Documentation

volatile int igtl::LightObject::m_ReferenceCount [mutable, protected, inherited]

Number of uses of this object by other objects.

Definition at line 133 of file igtlLightObject.h.

Mutex lock to protect modification to the reference count

Definition at line 136 of file igtlLightObject.h.


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

Generated at Sat Dec 3 2011 08:54:22 for OpenIGTLink by doxygen 1.7.4 written by Dimitri van Heesch, © 1997-2000