Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

kore::Plugin Class Reference

class kore::Plugin - platform-independant representation of a dynamic library (dll). More...

#include <plugin.h>

Inheritance diagram for kore::Plugin::

kore::Module List of all members.

Public Methods

 Plugin ()
 Default constructor. More...

 Plugin (HMODULE handle, const char *libname, const char *libpath, int flags)
 Creates a plugin. More...

virtual ~Plugin ()
 Destructor. More...

virtual void pluginLoaded ()
 Callback triggered right AFTER the dll has been LOADED. More...

virtual void unloadingPlugin ()
 Callback triggered right BEFORE UNLOADING the dll. More...

virtual void initPlugin ()
 Callback triggered when a plugin gets "activated". More...

virtual void finalizePlugin ()
 Callback triggered when a plugin gets "deactivated". More...

virtual HMODULE libHandle () const
 Gets the platform-dependant representation of the dll. More...


Private Methods

void commonInit ()

Private Attributes

const Version_pluginVersion
const Version_pluginAPIVersion
const Info * _pluginInfo
const char * _libName
const char * _libPath
int _libFlags
HMODULE _libHandle

Detailed Description

class kore::Plugin - platform-independant representation of a dynamic library (dll).

One or more Kore Modules can be bundled into a dll and dynamically loaded at run-time using the PluginLoader. The kore::Plugin class provides the cross-platform abstraction for dll's, as well as a few usefull callbacks related to dynamic loading. The future versions of kore::Plugin will also provide introspective methods (similar to rtti), such as hints about modules/services provided by the ddl.

Definition at line 53 of file plugin.h.


Constructor & Destructor Documentation

Plugin::Plugin  
 

Default constructor.

Creates an empty plugin instance.

Definition at line 20 of file plugin.cpp.

References _libFlags, _libHandle, _libName, _libPath, and commonInit().

00021 {
00022     commonInit();
00023     _libHandle = 0;
00024     _libName = 0;
00025     _libPath = 0;
00026     _libFlags = 0;
00027 }

Plugin::Plugin HMODULE    libhandle,
const char *    libname,
const char *    libpath,
int    flags
 

Creates a plugin.

This constructor is usually invoked by the plugin(...) function exported by the dll: Plugin* plugin(HMODULE handle, const char* name, const char* path, int flags) { return new MyPlugin(handle,name,path,flags); }

Parameters:
handle  - platform-dependant representation of the actual dl.l
libname  - dll's name.
libpath  - dll's path.
flags  - flags used for opening the dll (platform dependant).

Definition at line 28 of file plugin.cpp.

References _libFlags, _libHandle, _libName, _libPath, commonInit(), and HMODULE.

00029 {
00030     commonInit();
00031     _libHandle = libhandle;
00032     _libName = libname;
00033     _libPath = libpath;
00034     _libFlags = flags;
00035     //cout << "HMODULE: " << libhandle << endl;
00036 }

Plugin::~Plugin   [virtual]
 

Destructor.

Definition at line 37 of file plugin.cpp.

References _pluginAPIVersion, _pluginInfo, and _pluginVersion.

00038 {
00039     delete _pluginInfo;
00040     delete _pluginVersion;
00041     delete _pluginAPIVersion;
00042 }


Member Function Documentation

void Plugin::commonInit   [private]
 

Definition at line 43 of file plugin.cpp.

References _pluginAPIVersion, _pluginInfo, _pluginVersion, PLUGIN_API_MAJOR, PLUGIN_API_MINOR, PLUGIN_API_REVISION, PLUGIN_API_VERSION, PLUGIN_DESCRIPTION, PLUGIN_MAJOR, PLUGIN_MINOR, PLUGIN_NAME, PLUGIN_REVISION, PLUGIN_TYPE, PLUGIN_VERSION, and kore::Module::setInfo().

Referenced by Plugin().

void Plugin::finalizePlugin   [virtual]
 

Callback triggered when a plugin gets "deactivated".

Here is the right place to do cleanup/unregistering the modules/services this plugin might have registered.

Definition at line 67 of file plugin.cpp.

00068 {
00069 }

void Plugin::initPlugin   [virtual]
 

Callback triggered when a plugin gets "activated".

Here is the right place for registering any modules/services provided by the dll. DO NOT use pluginLoaded() for that.

Definition at line 64 of file plugin.cpp.

00065 {
00066 }

HMODULE Plugin::libHandle   const [virtual]
 

Gets the platform-dependant representation of the dll.

Returns:
- the dll "handle".

Definition at line 50 of file plugin.cpp.

References _libHandle, and HMODULE.

00051 {
00052     return _libHandle;
00053 }

void Plugin::pluginLoaded   [virtual]
 

Callback triggered right AFTER the dll has been LOADED.

Definition at line 55 of file plugin.cpp.

00056 {
00057     //cout << "Plugin::pluginLoaded()" << endl;
00058 }

void Plugin::unloadingPlugin   [virtual]
 

Callback triggered right BEFORE UNLOADING the dll.

Definition at line 59 of file plugin.cpp.

00060 {
00061     //cout << "Plugin::unloadingPlugin()" << endl;
00062 }


Member Data Documentation

int kore::Plugin::_libFlags [private]
 

Definition at line 117 of file plugin.h.

Referenced by Plugin().

HMODULE kore::Plugin::_libHandle [private]
 

Definition at line 119 of file plugin.h.

Referenced by libHandle(), and Plugin().

const char* kore::Plugin::_libName [private]
 

Definition at line 113 of file plugin.h.

Referenced by Plugin().

const char* kore::Plugin::_libPath [private]
 

Definition at line 115 of file plugin.h.

Referenced by Plugin().

const Version* kore::Plugin::_pluginAPIVersion [private]
 

Definition at line 109 of file plugin.h.

Referenced by commonInit(), and ~Plugin().

const Info* kore::Plugin::_pluginInfo [private]
 

Definition at line 111 of file plugin.h.

Referenced by commonInit(), and ~Plugin().

const Version* kore::Plugin::_pluginVersion [private]
 

Definition at line 107 of file plugin.h.

Referenced by commonInit(), and ~Plugin().


The documentation for this class was generated from the following files:
Generated on Sat Feb 16 10:53:05 2002 for Korelib by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001