#include <osaDynamicLoaderAndFactory.h>
Inheritance diagram for osaDynamicLoaderAndFactory< BaseClass >:


This is a templated class that is used to dynamically load "plugin" modules that are implemented as derived classes of the specified base class (template parameter). The advantage of this class over osaDynamicLoader is that any class can serve as the base class. It is not necessary for the base or derived class to inherit from cmnGenericObject. The only requirement is that it contain a public VERSION enum that specifies the "interface version" of the base class. The VERSION should be changed for any base class changes that could affect the derived classes (e.g., adding member data, changing public methods, etc.).
If the base class is cmnGenericObject (or derived from it), the osaDynamicLoader class should be used instead.
Definition at line 76 of file osaDynamicLoaderAndFactory.h.
| osaDynamicLoaderAndFactory< BaseClass >::osaDynamicLoaderAndFactory | ( | ) | [inline] |
Default constructor. Calls Reset() method.
Definition at line 83 of file osaDynamicLoaderAndFactory.h.
| virtual osaDynamicLoaderAndFactory< BaseClass >::~osaDynamicLoaderAndFactory | ( | ) | [inline, virtual] |
Destructor. Does not unload library in case any objects created from within the library still exist. To close library, call Reset().
Definition at line 86 of file osaDynamicLoaderAndFactory.h.
| bool osaDynamicLoaderAndFactory< BaseClass >::Init | ( | const char * | name, | |
| const char * | file, | |||
| const char * | path = 0 | |||
| ) | [inline] |
Load the derived class from the specified file. Note that a file may contain more than one derived class, but each derived class must be accessed via a new dynamic loader object. The operating system ensures that a library is only loaded once.
| name | Name of derived class | |
| file | File name for derived class (do not include extension) | |
| path | Path to file (0 -> use default library load paths) |
Definition at line 97 of file osaDynamicLoaderAndFactory.h.
| bool osaDynamicLoaderAndFactory< BaseClass >::Init | ( | const char * | name | ) | [inline] |
Load the derived class from a file that has the same name as the derived class (no extension).
| name | Name of derived class |
Definition at line 105 of file osaDynamicLoaderAndFactory.h.
| void osaDynamicLoaderAndFactory< BaseClass >::Reset | ( | ) | [inline] |
Unload the library file and clear the factory functions. Do not call this method unless you are sure that all instances of the derived class have already been destroyed.
Reimplemented from osaDynamicLoaderAndFactoryBase.
Definition at line 111 of file osaDynamicLoaderAndFactory.h.
| BaseClass* osaDynamicLoaderAndFactory< BaseClass >::CreateObject | ( | ) | const [inline] |
Create a new instance of the derived class (from the dynamically loaded library).
Definition at line 116 of file osaDynamicLoaderAndFactory.h.
References osaDynamicLoaderAndFactoryBase::create.
| void osaDynamicLoaderAndFactory< BaseClass >::DestroyObject | ( | BaseClass * | obj | ) | const [inline] |
Delete an instance of the derived class.
| obj | Pointer to object to be destroyed. |
Definition at line 122 of file osaDynamicLoaderAndFactory.h.
References osaDynamicLoaderAndFactoryBase::destroy.