1 #ifndef ORO_COMPONENTLOADER_HPP_ 2 #define ORO_COMPONENTLOADER_HPP_ 6 #include <boost/shared_ptr.hpp> 30 LoadedLib(std::string n, std::string short_name,
void* h)
31 : filename(n), shortname(short_name), handle(h)
41 std::string shortname;
48 std::vector<std::string> components_type;
51 struct ComponentData {
53 : instance(0), type(
"")
65 typedef std::map<std::string, ComponentData> CompList;
70 std::vector< LoadedLib > loadedLibs;
72 std::vector< std::string > loadedPackages;
77 std::string component_path;
87 bool loadInProcess(std::string filename, std::string shortname,
bool log_error );
95 bool reloadInProcess(std::string filename, std::string shortname);
104 bool isCompatibleComponent(std::string
const& filepath);
109 bool importInstalledPackage(std::string
const& package, std::string
const& path_list);
117 static boost::shared_ptr<ComponentLoader>
Instance();
132 bool import(std::string
const& path_list);
152 bool import(std::string
const& name, std::string
const& path_list);
TaskContext *(* ComponentLoaderSignature)(std::string instance_name)
This signature defines how a component can be instantiated.
boost::shared_ptr< ComponentLoader > shared_ptr
bool isImported(std::string type_name)
Checks if a given Component type, filename or package name has been imported.
RTT::TaskContext * loadComponent(std::string const &name, std::string const &type)
Creates a new component an earlier discovered component type.
void addFactory(std::string const &name, ComponentLoaderSignature factory)
Adds a factory to the component factory map.
static boost::shared_ptr< ComponentLoader > Instance()
Create the instance of the ComponentLoader.
std::map< std::string, ComponentLoaderSignature > FactoryMap
This file contains the macros and definitions to create dynamically loadable components.
std::vector< std::string > listComponents() const
Lists all Component created by loadComponent().
std::string getComponentPath() const
Returns the current Component path list.
bool loadLibrary(std::string const &path)
Loads a library as component library.
std::vector< std::string > listComponentTypes() const
Lists all Component types discovered by the ComponentLoader.
bool reloadLibrary(std::string const &filepath)
Reloads a component library.
void setComponentPath(std::string const &newpath)
Sets the Component path list.
bool unloadComponent(RTT::TaskContext *tc)
Destroys an earlier created component.
The TaskContext is the C++ representation of an Orocos component.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
static void Release()
Release the ComponentLoader, erasing all knowledge of loaded libraries.
const FactoryMap & getFactories() const
Returns the factory singleton which creates all types of components for the ComponentLoader.