BasicPlugin< Class, Iface > Class Template Reference

#include <Pt/System/Plugin.h>

A plugin implementation. More...

Inherits Plugin< Iface >.

Public Member Functions

 BasicPlugin (const std::string &feature, const std::string &info=std::string())
 Constructs with feature string and info.
 
Iface * create ()
 Creates an instance.
 
void destroy (Iface *instance)
 Destroys an instance.
 
virtual const char * feature () const
 Returns the plugin feature string.
 
const std::type_info & iface () const
 Returns the type of the plugin interface.
 
virtual const char * info () const
 Returns the plugin info string.
 

Detailed Description

template<typename Class, typename Iface>
class Pt::System::BasicPlugin< Class, Iface >

In the plugin library, shared object global BasicPlugins have to be arranged in a null teminated array with C linkage. The PluginManager can be set up to resolve the symbol of this array and use the plugins.

static Pt::BasicPlugin<SomeClass, MyIface> plugin0("some-feature");
static Pt::BasicPlugin<OtherClass, MyIface> plugin1("other-feature");
extern "C" { \
PT_API Pt::PluginId* PluginList[] = { &plugin0, &plugin1, 0 }; \
}