RSC  0.19.0
rsc::plugins::Plugin Class Reference

Instances of this class represent pieces of functionality which can be loaded into a program at runtime. More...

#include <Plugin.h>

Inheritance diagram for rsc::plugins::Plugin:
Inheritance graph
Collaboration diagram for rsc::plugins::Plugin:
Collaboration graph

Public Member Functions

virtual ~Plugin ()
 
const std::string & getName () const
 Returns the name of the plugin. More...
 
void load (bool wrapExceptions=true)
 Tries to load the functionality of the plugin into the current process. More...
 
void unload (bool wrapExceptions=true)
 Tries to unload the functionality of the plugin. More...
 
bool ensureLoaded (bool wrapExceptions=true)
 Tries to load the plugin unless it is already loaded. More...
 
std::string getLibrary () const
 Returns the path to the library implementing this plugin. More...
 

Private Member Functions

 Plugin (Impl *impl)
 

Static Private Member Functions

static boost::shared_ptr< Plugincreate (const std::string &name, const std::string &library)
 

Private Attributes

boost::scoped_ptr< Implimpl
 

Friends

class Manager
 

Detailed Description

Instances of this class represent pieces of functionality which can be loaded into a program at runtime.

Plugin instances are not thread-safe and access needs to be synchronized.

Author
jmoringe

Definition at line 53 of file Plugin.h.

Constructor & Destructor Documentation

rsc::plugins::Plugin::~Plugin ( )
virtual

Definition at line 220 of file Plugin.cpp.

rsc::plugins::Plugin::Plugin ( Impl impl)
private

Definition at line 216 of file Plugin.cpp.

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

PluginPtr rsc::plugins::Plugin::create ( const std::string &  name,
const std::string &  library 
)
staticprivate

Definition at line 243 of file Plugin.cpp.

References Plugin().

Referenced by rsc::plugins::Manager::addPath().

Here is the call graph for this function:

Here is the caller graph for this function:

bool rsc::plugins::Plugin::ensureLoaded ( bool  wrapExceptions = true)

Tries to load the plugin unless it is already loaded.

Parameters
wrapExceptionsIf true, exceptions thrown in the init method of the plugin are wrapped in a runtime_error exception.
Returns
false if the plugin was already loaded. true otherwise.
Exceptions
runtime_errorIf the plugin cannot be loaded for some reason.

Definition at line 235 of file Plugin.cpp.

References impl.

string rsc::plugins::Plugin::getLibrary ( ) const

Returns the path to the library implementing this plugin.

Returns
string representing the filesystem path to the library implementing this plugin

Definition at line 239 of file Plugin.cpp.

References impl.

const string & rsc::plugins::Plugin::getName ( ) const

Returns the name of the plugin.

Returns
The name of the plugin.

Definition at line 223 of file Plugin.cpp.

References impl.

void rsc::plugins::Plugin::load ( bool  wrapExceptions = true)

Tries to load the functionality of the plugin into the current process.

Parameters
wrapExceptionsif true, exceptions generated inside the plugin init method are wrapped in a runtime_error. Otherwise they are passed through.
Exceptions
runtime_errorIf the plugin cannot be loaded for some reason.

Definition at line 227 of file Plugin.cpp.

References impl.

void rsc::plugins::Plugin::unload ( bool  wrapExceptions = true)

Tries to unload the functionality of the plugin.

Parameters
wrapExceptionsif true, exceptions generated inside the plugin init method are wrapped in a runtime_error. Otherwise they are passed through.
Exceptions
runtime_errorIf the plugin cannot be unloaded for some reason.

Definition at line 231 of file Plugin.cpp.

References impl.

Friends And Related Function Documentation

friend class Manager
friend

Definition at line 109 of file Plugin.h.

Member Data Documentation

boost::scoped_ptr<Impl> rsc::plugins::Plugin::impl
private

Definition at line 111 of file Plugin.h.

Referenced by ensureLoaded(), getLibrary(), getName(), load(), and unload().


The documentation for this class was generated from the following files: