CppCMS
|
#include <cppcms/plugin.h>
Public Types | |
typedef booster::intrusive_ptr< booster::refcounted > | refcounted_ptr |
typedef refcounted_ptr(* | entry_point_type) () |
Public Member Functions | |
template<typename Signature > | |
booster::callback< Signature > | entry (std::string const &plugin_name, std::string const &entry_name) |
template<typename Signature > | |
bool | has_entry (std::string const &plugin, std::string const &name) |
entry_point_type | get_entry (std::string const &plugin, std::string const &name) |
std::string | signature (std::string const &plugin, std::string const &name) |
void | add_entry (char const *plugin_name, char const *entry_name, entry_point_type entry, char const *signature) |
void | remove_entry (entry_point_type entry) |
std::set< std::string > | plugins () |
std::set< std::string > | entries (std::string const &plugin) |
bool | has_plugin (std::string const &name) |
Static Public Member Functions | |
static manager & | instance () |
Related Functions | |
(Note that these are not member functions.) | |
#define | CPPCMS_FULL_PLUGIN_ENTRY(plugin_name, entry_name, call, type) |
#define | CPPCMS_PLUGIN_ENTRY(name, call, type) CPPCMS_FULL_PLUGIN_ENTRY(#name,#call,& name :: call,type) |
#define | CPPCMS_NAMED_PLUGIN_ENTRY(name, entry, call, type) CPPCMS_FULL_PLUGIN_ENTRY(#name,#entry,& name :: call,type) |
Central class that manages registration of plugins.
It is used as singleton and accessed via manager::instance().
Each plugin registers itself in the constructor and destructor implemented in shared library.
typedef refcounted_ptr(* cppcms::plugin::manager::entry_point_type) () |
Functions registered as plugin entry points
void cppcms::plugin::manager::add_entry | ( | char const * | plugin_name, |
char const * | entry_name, | ||
entry_point_type | entry, | ||
char const * | signature | ||
) |
Addes entry to the plugin manager - thread safe function
std::set<std::string> cppcms::plugin::manager::entries | ( | std::string const & | plugin | ) |
Get list of all entry names for plugin
|
inline |
Get plugin entry by plugin_name, entry_name and Signature
If entry is not found or no entry point is created throws cppcms_error,if Signature mismatches the callback type throws booster::bad_cast
For example
Or
References get_entry().
entry_point_type cppcms::plugin::manager::get_entry | ( | std::string const & | plugin, |
std::string const & | name | ||
) |
Get entry point that creates a base of booster::callback::callable_type
Referenced by entry().
|
inline |
Check if plugin entry of type Signature exists in a plugin plugin named name
bool cppcms::plugin::manager::has_plugin | ( | std::string const & | name | ) |
Returns true if plugin name is loaded
|
static |
Get the instance of the manager
std::set<std::string> cppcms::plugin::manager::plugins | ( | ) |
Get list of all plugin names
void cppcms::plugin::manager::remove_entry | ( | entry_point_type | entry | ) |
Removes entry from the plugin manager - thread safe function
std::string cppcms::plugin::manager::signature | ( | std::string const & | plugin, |
std::string const & | name | ||
) |
Get textual representation of entry point signature - for logging purposes, if not found returns empty string
|
related |
Install generic plugin entry in plugin named plugin_name - string, the entry name entry_name - string and such that following expression is valid callback iniitalization: booster::callback<type> cb = call;
For example
it is accessed as manager::instance().entry<plugin_api *(std::string const &)>("myplugin","my_class::create")
|
related |
Install common function entry such that name is plugin name, entry is entry name and &name::call
is valid assignment for booster::callback<type>
Usually name should be namespace or class name, call is function or static member functions
For example
it is accessed as manager::instance().entry<plugin_api *(std::string const &)>("myplugin","api")
|
related |
Install common function entry such that name is plugin name, call is entry name and &name::call
is valid assignment for booster::callback<type>
Usually name should be namespace or class name, call is function or static member functions
For example
it is accessed as manager::instance().entry<plugin_api *(std::string const &)>("myplugin","my_class::create")