BESPlugin provides a mechanism that can load C++ classes at runtime. More...
#include <BESPlugin.h>
Public Member Functions | |
BESPlugin (const string &filename) | |
Create a new BESPlugin. | |
virtual void | dump (ostream &strm) const |
M * | instantiate () throw (NoSuchLibrary, NoSuchObject) |
Instantiate the object. | |
virtual | ~BESPlugin () |
The destructor closes the library. |
BESPlugin provides a mechanism that can load C++ classes at runtime.
Classes are compiled and stored in shareable-object libraries. This class binds the name of that class (which is used by Plugin's client) to the name of the library.
Each class/library must contain at least one function. The function must have the name and type signature `extern "C" M* maker()' and must return a pointer to a new instance of the class M. Note that M is the parameter of the Plugin template. Suppose you have a base class Base and a collection of specializations S1, S2, ..., Sn. You would use N instances of BESPlugin<Base> to provide access to the implementations in those
N shareable-object libraries. The exectuable that loads the libraries must have been compiled and linked with Base.
External symbols defined in the library will be made available to subsequently loaded libraries.
Definition at line 91 of file BESPlugin.h.
Create a new BESPlugin.
filename | The name of the shareable object library that holds the class' implementation. |
Definition at line 137 of file BESPlugin.h.
The destructor closes the library.
Definition at line 141 of file BESPlugin.h.
virtual void BESPlugin< M >::dump | ( | ostream & | strm | ) | const [inline, virtual] |
Definition at line 165 of file BESPlugin.h.
M* BESPlugin< M >::instantiate | ( | ) | throw (NoSuchLibrary, NoSuchObject) [inline] |
Instantiate the object.
Using the maker function found in the shreable-object library, create a new instance of class M where M was the template parameter of BESPlugin.
Definition at line 152 of file BESPlugin.h.
Referenced by BESPluginFactory< BESAbstractModule >::get().