PionNetworkLibrary
|
#include <plugin.hpp>
Classes | |
struct | data_type |
Public Member Functions | |
virtual | ~plugin () |
bool | is_open (void) const |
returns true if a shared library is loaded/open More... | |
std::string | get_plugin_name (void) const |
returns the name of the plugin that is currently open More... | |
void | open (const std::string &plugin_name) |
void | open_file (const std::string &plugin_file) |
void | close (void) |
closes plug-in library More... | |
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 More... | |
static void | reset_plugin_directories (void) |
clears all directories from the plug-in search path More... | |
static void | get_all_plugin_names (std::vector< std::string > &plugin_names) |
returns a list of all Plugins found in all Plugin directories More... | |
Protected Member Functions | |
plugin (void) | |
default constructor is private (use plugin_ptr class to create objects) More... | |
plugin (const plugin &p) | |
copy constructor More... | |
plugin & | operator= (const plugin &p) |
assignment operator More... | |
void * | get_create_function (void) |
returns a pointer to the plug-in's "create object" function More... | |
void * | get_destroy_function (void) |
returns a pointer to the plug-in's "destroy object" function More... | |
void | release_data (void) |
releases the plug-in's shared library symbols More... | |
void | grab_data (const plugin &p) |
grabs a reference to another plug-in's shared library symbols More... | |
plugin: base class for plug-in management
|
inlinevirtual |
|
inlineprotected |
default constructor is private (use plugin_ptr class to create objects)
|
inlineprotected |
copy constructor
|
static |
appends a directory to the plug-in search path
References check_cygwin_path().
Referenced by pion::http::plugin_server::load_service_config().
|
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 |
References pion::plugin::data_type::m_create_func, pion::plugin::data_type::m_destroy_func, and pion::plugin::data_type::m_lib_handle.
|
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 |
References PION_CYGWIN_DIRECTORY.
Referenced by add_plugin_directory().
|
inline |
closes plug-in library
|
inlinestatic |
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 |
Referenced by pion::http::plugin_server::load_service_config().
|
inlinestatic |
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 |
Referenced by open().
|
static |
returns a list of all Plugins found in all Plugin directories
References get_plugin_name(), pion::plugin::data_type::m_lib_handle, and pion::plugin::data_type::m_plugin_name.
|
inlineprotected |
returns a pointer to the plug-in's "create object" function
Referenced by pion::plugin_ptr< InterfaceClassType >::create().
|
inlineprotected |
returns a pointer to the plug-in's "destroy object" function
Referenced by pion::plugin_ptr< InterfaceClassType >::destroy().
|
inline |
returns the name of the plugin that is currently open
Referenced by get_all_plugin_names(), and open_file().
|
protected |
grabs a reference to another plug-in's shared library symbols
References pion::plugin::data_type::m_references, and release_data().
Referenced by pion::plugin_ptr< InterfaceClassType >::operator=().
|
inline |
returns true if a shared library is loaded/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.) |
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 |
References get_plugin_name(), pion::plugin::data_type::m_plugin_name, pion::plugin::data_type::m_references, and release_data().
Referenced by open().
|
protected |
releases the plug-in's shared library symbols
References pion::plugin::data_type::m_lib_handle, pion::plugin::data_type::m_plugin_name, and pion::plugin::data_type::m_references.
Referenced by grab_data(), open(), and open_file().
|
static |
clears all directories from the plug-in search path