#include <plugin.hpp>
Inherited by pion::plugin_ptr< InterfaceClassType >.
Classes | |
struct | config_type |
data type for static/global plugin configuration information | |
struct | data_type |
Public Member Functions | |
bool | is_open (void) const |
returns true if a shared library is loaded/open | |
std::string | get_plugin_name (void) const |
returns the name of the plugin that is currently open | |
void | open (const std::string &plugin_name) |
void | open_file (const std::string &plugin_file) |
void | close (void) |
closes plug-in library | |
Static Public Member Functions | |
static bool | find_plugin_file (std::string &path_to_file, const std::string &name) |
static bool | find_config_file (std::string &path_to_file, const std::string &name) |
static void | add_static_entry_point (const std::string &plugin_name, void *create_func, void *destroy_func) |
static void | check_cygwin_path (boost::filesystem::path &final_path, const std::string &path_string) |
static void | add_plugin_directory (const std::string &dir) |
appends a directory to the plug-in search path | |
static void | reset_plugin_directories (void) |
clears all directories from the plug-in search path | |
static void | get_all_plugin_names (std::vector< std::string > &plugin_names) |
returns a list of all Plugins found in all Plugin directories | |
Protected Member Functions | |
plugin (void) | |
default constructor is private (use plugin_ptr class to create objects) | |
plugin (const plugin &p) | |
copy constructor | |
plugin & | operator= (const plugin &p) |
assignment operator | |
void * | get_create_function (void) |
returns a pointer to the plug-in's "create object" function | |
void * | get_destroy_function (void) |
returns a pointer to the plug-in's "destroy object" function | |
void | release_data (void) |
releases the plug-in's shared library symbols | |
void | grab_data (const plugin &p) |
grabs a reference to another plug-in's shared library symbols |
plugin: base class for plug-in management
Definition at line 30 of file plugin.hpp.
void pion::plugin::add_static_entry_point | ( | const std::string & | plugin_name, | |
void * | create_func, | |||
void * | destroy_func | |||
) | [static] |
adds an entry point for a plugin that is statically linked NOTE: USE PION_DECLARE_PLUGIN() macro instead!!!
plugin_name | the name of the plugin to add | |
create_func | - pointer to the function to be used in to create plugin object | |
destroy_func | - pointer to the function to be used to release plugin object |
Definition at line 390 of file plugin.cpp.
References pion::plugin::data_type::m_create_func, pion::plugin::data_type::m_destroy_func, and pion::plugin::data_type::m_lib_handle.
void pion::plugin::check_cygwin_path | ( | boost::filesystem::path & | final_path, | |
const std::string & | path_string | |||
) | [static] |
updates path for cygwin oddities, if necessary
final_path | path object for the file, will be modified if necessary | |
start_path | original path to the file. if final_path is not valid, this will be appended to PION_CYGWIN_DIRECTORY to attempt attempt correction of final_path for cygwin |
Definition at line 48 of file plugin.cpp.
Referenced by add_plugin_directory(), and pion::plugins::FileService::set_option().
static bool pion::plugin::find_config_file | ( | std::string & | path_to_file, | |
const std::string & | name | |||
) | [inline, static] |
searches directories for a valid plug-in configuration file
path_to_file | if found, is set to the complete path to the file | |
name | the name of the configuration file to search for |
Definition at line 53 of file plugin.hpp.
Referenced by pion::http::plugin_server::load_service_config().
static bool pion::plugin::find_plugin_file | ( | std::string & | path_to_file, | |
const std::string & | name | |||
) | [inline, static] |
searches directories for a valid plug-in file
path_to_file | the path to the plug-in file, if found | |
the | name name of the plug-in to search for |
Definition at line 40 of file plugin.hpp.
Referenced by open().
void pion::plugin::open | ( | const std::string & | plugin_name | ) |
opens plug-in library within a shared object file. If the library is already being used by another plugin object, then the existing code will be re-used and the reference count will be increased. Beware that this does NOT check the plug-in's base class (InterfaceClassType), so you must be careful to ensure that the namespace is unique between plug-ins that have different base classes. If the plug-in's name matches an existing plug-in of a different base class, the resulting behavior is undefined (it will probably crash your program).
plugin_name | name of the plug-in library to open (without extension, etc.) |
Definition at line 82 of file plugin.cpp.
References find_plugin_file(), pion::plugin::data_type::m_references, open_file(), and release_data().
Referenced by pion::plugin_manager< PluginType >::load().
void pion::plugin::open_file | ( | const std::string & | plugin_file | ) |
opens plug-in library within a shared object file. If the library is already being used by another plugin object, then the existing code will be re-used and the reference count will be increased. Beware that this does NOT check the plug-in's base class (InterfaceClassType), so you must be careful to ensure that the namespace is unique between plug-ins that have different base classes. If the plug-in's name matches an existing plug-in of a different base class, the resulting behavior is undefined (it will probably crash your program).
plugin_file | shared object file containing the plugin code |
Definition at line 106 of file plugin.cpp.
References get_plugin_name(), pion::plugin::data_type::m_plugin_name, pion::plugin::data_type::m_references, and release_data().
Referenced by open().