ComponentLoader Class Reference

List of all members.

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.

Detailed Description

Definition at line 22 of file deployment/ComponentLoader.hpp.


Member Function Documentation

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.

Returns:
A colon separated list of paths or the empty string if not set.

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.

Parameters:
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.

Parameters:
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]
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').

Parameters:
type_name name of a file or the Component type.
Returns:
true if so.

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().

Returns:
A list of Component names

Definition at line 429 of file deployment/ComponentLoader.cpp.

std::vector< std::string > listComponentTypes (  )  const

Lists all Component types discovered by the ComponentLoader.

Returns:
A list of Component type names

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.

Parameters:
name The name of the to be created Component
type The type of component to be created.
Returns:
null on error or a new component.

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.

Parameters:
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.

Parameters:
tc The TaskContext to be destroyed. tc may no longer be used after this function returns true.
Returns:
false if tc was not loaded by this ComponentLoader.

Definition at line 414 of file deployment/ComponentLoader.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Dec 23 15:05:29 2010 for OrocosComponentLibrary by  doxygen 1.6.3