dbp::plugin_int Class Reference

Plugin interface. More...

#include <plugin.h>

Inheritance diagram for dbp::plugin_int:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~plugin_int ()
 Destructor.
virtual void load (const std::string &file_name)=0 throw (plugin_exception)
 Load plugin.
virtual disposablecreate_object (const std::string &object_name)=0
 Create object.
virtual void destroy_object (disposable *object)=0
 Destroy object.

Detailed Description

Plugin interface.

The plugin interface introduces pure virtual methods that are implemented by concrete plugin class.


Member Function Documentation

virtual disposable* dbp::plugin_int::create_object ( const std::string &  object_name  )  [pure 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.

Parameters:
object_name a name of the object to create.
Returns:
pointer to a object or NULL if this object is not supported.

Implemented in dbp::plugin.

virtual void dbp::plugin_int::destroy_object ( disposable object  )  [pure virtual]

Destroy object.

This function is used to destroy object created by create_object(const std::string&) function.

Parameters:
object the object to destroy.

Implemented in dbp::plugin.

virtual void dbp::plugin_int::load ( const std::string &  file_name  )  throw (plugin_exception) [pure virtual]

Load plugin.

Loads the plugin from a given file which should be a dynamic library.

Parameters:
file_name a name of the dynamic library file to load.
Returns:
a reference to a plugin object factory of the specified plugin.

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.

Implemented in dbp::plugin.


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

 
Support This Project
SourceForge.net Logo