Classes | |
struct | ComponentData |
class | LoadedLib |
Keep a list of all loaded libraries such that double loads are avoided during import/loadLibrary. | |
Public Types | |
typedef boost::shared_ptr < ComponentLoader > | shared_ptr |
Public Member Functions | |
void | import (std::string const &path_list) |
Imports any Component library found in each path in path_list in the current process. | |
bool | isImported (std::string type_name) |
Checks if a given Component type or filename has been imported. | |
bool | import (std::string const &name, std::string const &path_list) |
Imports a Component type found in each path in path_list in the current process. | |
RTT::TaskContext * | loadComponent (std::string const &name, std::string const &type) |
Creates a new component an earlier discovered component type. | |
bool | unloadComponent (RTT::TaskContext *tc) |
Destroys an earlier created component. | |
std::vector< std::string > | listComponents () const |
Lists all Component created by loadComponent(). | |
std::vector< std::string > | listComponentTypes () const |
Lists all Component types discovered by the ComponentLoader. | |
std::string | getComponentPath () const |
Returns the current Component path list. | |
void | setComponentPath (std::string const &newpath) |
Sets the Component path list. | |
Static Public Member Functions | |
static boost::shared_ptr < ComponentLoader > | Instance () |
Create the instance of the ComponentLoader. | |
static void | Release () |
Release the ComponentLoader, erasing all knowledge of loaded libraries. |
Definition at line 22 of file deployment/ComponentLoader.hpp.
std::string getComponentPath | ( | ) | const |
Returns the current Component path list.
Defaults to the value of RTT_COMPONENT_PATH, when the RTT was started for the current process.
Definition at line 369 of file deployment/ComponentLoader.cpp.
bool import | ( | std::string const & | name, | |
std::string const & | path_list | |||
) |
Imports a Component type found in each path in path_list in the current process.
name | The name of the Component to import, must match the library name (without lib/dll/so pre-/suffixes). | |
path_list | A colon or semi-colon seperated list of paths to look for Components. May be the empty string. |
Definition at line 199 of file deployment/ComponentLoader.cpp.
References ComponentLoader::isImported().
void import | ( | std::string const & | path_list | ) |
Imports any Component library found in each path in path_list in the current process.
This is a best effort function, ie it will silently ignore wrong paths or paths without any Components.
path_list | A colon or semi-colon seperated list of paths to look for Components. May be the empty string. |
Definition at line 129 of file deployment/ComponentLoader.cpp.
boost::shared_ptr< ComponentLoader > Instance | ( | ) | [static] |
Create the instance of the ComponentLoader.
It will keep track of the loaded libraries for this process.
Definition at line 119 of file deployment/ComponentLoader.cpp.
Referenced by DeploymentComponent::configureHook(), DeploymentComponent::import(), ComponentLoader::isImported(), ComponentLoader::listComponentTypes(), DeploymentComponent::loadComponent(), ComponentLoader::loadComponent(), DeploymentComponent::loadLibrary(), and DeploymentComponent::unloadComponentImpl().
bool isImported | ( | std::string | type_name | ) |
Checks if a given Component type or filename has been imported.
This function accepts full filenames ('libthe_Component.so.1.99.0'), short names ('the_Component') or the name provided by the Component Factory ('AppComponent').
type_name | name of a file or the Component type. |
Definition at line 247 of file deployment/ComponentLoader.cpp.
References ComponentLoader::Instance().
Referenced by ComponentLoader::import().
std::vector< std::string > listComponents | ( | ) | const |
Lists all Component created by loadComponent().
Definition at line 429 of file deployment/ComponentLoader.cpp.
std::vector< std::string > listComponentTypes | ( | ) | const |
Lists all Component types discovered by the ComponentLoader.
Definition at line 360 of file deployment/ComponentLoader.cpp.
References ComponentLoader::Instance().
RTT::TaskContext * loadComponent | ( | std::string const & | name, | |
std::string const & | type | |||
) |
Creates a new component an earlier discovered component type.
name | The name of the to be created Component | |
type | The type of component to be created. |
Definition at line 378 of file deployment/ComponentLoader.cpp.
References ComponentLoader::Instance().
void Release | ( | ) | [static] |
Release the ComponentLoader, erasing all knowledge of loaded libraries.
No libraries will be unloaded from the process.
Definition at line 125 of file deployment/ComponentLoader.cpp.
Referenced by DeploymentComponent::~DeploymentComponent().
void setComponentPath | ( | std::string const & | newpath | ) |
Sets the Component path list.
This is typically done by RTT startup code with the contents of the RTT_COMPONENT_PATH variable.
newpath | The new paths to look for Components. |
Definition at line 373 of file deployment/ComponentLoader.cpp.
bool unloadComponent | ( | RTT::TaskContext * | tc | ) |
Destroys an earlier created component.
tc | The TaskContext to be destroyed. tc may no longer be used after this function returns true. |
Definition at line 414 of file deployment/ComponentLoader.cpp.