Plugin loader. More...
#include <plugin.h>


Public Member Functions | |
| plugin () | |
| Constructor. | |
| ~plugin () | |
| Destructor. | |
| virtual void | load (const std::string &file_name) throw (plugin_exception) |
| Load plugin. | |
| virtual disposable * | create_object (const std::string &object_name) |
| Create object. | |
| virtual void | destroy_object (disposable *object) |
| Destroy object. | |
Plugin loader.
Plugin loader loads a dynamic library (.so, .dll) as a program plugin.
| virtual disposable* dbp::plugin::create_object | ( | const std::string & | object_name | ) | [virtual] |
Create object.
This function creates an object by its name. Each object created by this function should be properly destroyed by calling destroy_object to avoid memory leaks.
| object_name | a name of the object to create. |
Implements dbp::plugin_int.
| virtual void dbp::plugin::destroy_object | ( | disposable * | object | ) | [virtual] |
Destroy object.
This function is used to destroy object created by create_object(const std::string&) function.
| object | the object to destroy. |
Implements dbp::plugin_int.
| virtual void dbp::plugin::load | ( | const std::string & | file_name | ) | throw (plugin_exception) [virtual] |
Load plugin.
Loads the plugin from a given file which should be a dynamic library.
| file_name | a name of the dynamic library file to load. |
The plugin (dynamic library) should export two following C-functions:
void* create_object(const char*); void destroy_object(void*);
First function should create the specified class and return the pointer to the class instance created.
Second function should destroy object created by create_object(const std::string&) and free up the memory.
Implements dbp::plugin_int.