#include <DeploymentComponent.hpp>
Inherited by CorbaDeploymentComponent.
Classes | |
| struct | ComponentData |
| Each configured component is stored in a struct like this. More... | |
| struct | ConnectionData |
| Assembles all ports which share a connection. More... | |
| class | LoadedLib |
| Keep a list of all loaded libraries such that double loads are avoided during import/loadLibrary. More... | |
Public Member Functions | |
| DeploymentComponent (std::string name="Configurator") | |
| TaskContext * | myGetPeer (std::string name) |
| bool | connectPeers (const std::string &one, const std::string &other) |
| Establish a bidirectional connection between two tasks. | |
| bool | connectPorts (const std::string &one, const std::string &other) |
| Establish a data flow connection between two tasks. | |
| bool | connectPorts (const std::string &one, const std::string &one_port, const std::string &other, const std::string &other_port) |
| Connect two named ports of components. | |
| bool | addPeer (const std::string &from, const std::string &to) |
| Establish a uni directional connection form one task to another. | |
| bool | import (const std::string &path) |
| Import a library or all libraries in a given directory. | |
| bool | loadLibrary (const std::string &name) |
| Use this command to load a dynamic library into the memory of the current process. | |
| bool | loadComponent (const std::string &name, const std::string &type) |
| Load a new component in the current process. | |
| bool | unloadComponent (const std::string &name) |
| Unload a loaded component from the current process. | |
| void | displayComponentTypes () const |
| This function prints out the component types this DeploymentComponent can create. | |
| bool | setPeriodicActivity (const std::string &comp_name, double period, int priority, int scheduler) |
| (Re-)set the activity of a component with a periodic activity. | |
| bool | setNonPeriodicActivity (const std::string &comp_name, int priority, int scheduler) |
| (Re-)set the activity of a component with a non periodic activity. | |
| bool | setSlaveActivity (const std::string &comp_name, double period) |
| (Re-)set the activity of a component with a (stand alone) slave activity. | |
| bool | setMasterSlaveActivity (const std::string &comp_name, const std::string &master_name) |
| (Re-)set the activity of a component with a slave activity with master. | |
| bool | setActivity (const std::string &comp_name, const std::string &act_type, double period, int priority, int scheduler, const std::string &master_name="") |
| (Re-)set the activity of a component. | |
| bool | loadComponents (const std::string &config_file) |
| Load a (partial) application XML configuration from disk. | |
| bool | configureComponents () |
| Configure the components with loaded configuration(s). | |
| bool | startComponents () |
| Start all components in the current configuration which have AutoStart set to true. | |
| void | clearConfiguration () |
| Clear all loaded configuration options. | |
| bool | stopComponents () |
| Stop all loaded and running components. | |
| bool | cleanupComponents () |
| Cleanup all loaded and not running components. | |
| bool | unloadComponents () |
| Unload all loaded and not running components. | |
| bool | kickStart (const std::string &file_name) |
| This function runs loadComponents, configureComponents and startComponents in a row, given no failures occur along the way. | |
| bool | kickOutComponent (const std::string &comp_name) |
| Stop, cleanup and unload a single component which were loaded by this component. | |
| void | kickOut (const std::string &config_file) |
| Identical to kickOutAll, but it reads the name of the Components to kickOut from an XML file. | |
| bool | kickOutAll () |
| Stop, cleanup and unload all components loaded by the DeploymentComponent. | |
| bool | configure (const std::string &name) |
| Configure a component by loading the property file 'name.cpf' for component with name name. | |
| bool | configureFromFile (const std::string &name, const std::string &filename) |
| Configure a component by loading a property file. | |
| bool | loadConfiguration (const std::string &config_file) |
| Load a (partial) application XML configuration from disk. | |
| bool | loadConfigurationString (const std::string &config_text) |
| Identical to loadConfiguration, but reads the XML from a string instead of a file. | |
| FactoryMap & | getFactories () |
| Returns the factory singleton which creates all types of components for the DeploymentComponent. | |
| bool | stopComponent (RTT::TaskContext *instance) |
| Stop a single loaded and running component. | |
| bool | stopComponent (const std::string &comp_name) |
| Stop a single loaded and running components. | |
| bool | cleanupComponent (RTT::TaskContext *instance) |
| Cleanup a single loaded and not running component. | |
| bool | cleanupComponent (const std::string &comp_name) |
| Cleanup a single loaded and not running component. | |
Protected Types | |
|
typedef std::map< std::string, ConnectionData > | ConMap |
| This maps connection names to associated ports. | |
|
typedef std::map< std::string, ComponentData > | CompList |
| This vector holds the dynamically loaded components. | |
Protected Member Functions | |
| bool | configureHook () |
| Imports available plugins. | |
| bool | unloadComponentImpl (CompList::iterator cit) |
| This method removes all references to the component hold in cit, on the condition that it is not running. | |
| virtual bool | componentLoaded (TaskContext *c) |
| Hook function for subclasses. | |
Protected Attributes | |
| RTT::PropertyBag | root |
| This bag stores the current configuration. | |
| RTT::Property< std::string > | compPath |
| RTT::Property< bool > | autoUnload |
| RTT::Attribute< bool > | validConfig |
| RTT::Constant< int > | sched_RT |
| RTT::Constant< int > | sched_OTHER |
| RTT::Constant< int > | lowest_Priority |
| RTT::Constant< int > | highest_Priority |
| RTT::Property< std::string > | target |
| ConMap | conmap |
| CompList | comps |
| void * | handle |
| Handle of last loaded library. | |
| std::string | libname |
| Name of last loaded library. | |
Static Protected Attributes | |
| static std::vector< LoadedLib > | loadedLibs |
It allows to create connections between components, load the properties and scripts for components and setup component activities.
Definition at line 60 of file DeploymentComponent.hpp.
| bool addPeer | ( | const std::string & | from, | |
| const std::string & | to | |||
| ) |
Establish a uni directional connection form one task to another.
| from | The component where the connection starts. | |
| to | The component where the connection ends. |
Definition at line 269 of file DeploymentComponent.cpp.
Referenced by DeploymentComponent::configureComponents(), and DeploymentComponent::loadComponent().
| bool cleanupComponent | ( | const std::string & | comp_name | ) | [inline] |
Cleanup a single loaded and not running component.
| comp_name | name of the component. |
Definition at line 535 of file DeploymentComponent.hpp.
| bool cleanupComponent | ( | RTT::TaskContext * | instance | ) |
Cleanup a single loaded and not running component.
| instance | instance pointer of the component. |
Definition at line 1802 of file DeploymentComponent.cpp.
Referenced by DeploymentComponent::kickOutComponent().
| void clearConfiguration | ( | ) |
Clear all loaded configuration options.
This does not alter any component.
Definition at line 1148 of file DeploymentComponent.cpp.
References DeploymentComponent::root.
| bool componentLoaded | ( | TaskContext * | c | ) | [protected, virtual] |
Hook function for subclasses.
Allows a subclass to abort or extend the loading of a component. By default, this function returns true.
Definition at line 243 of file DeploymentComponent.cpp.
Referenced by DeploymentComponent::loadComponent().
| bool configure | ( | const std::string & | name | ) |
Configure a component by loading the property file 'name.cpf' for component with name name.
| name | The name of the component to configure. The file used will be 'name.cpf'. |
Definition at line 1743 of file DeploymentComponent.cpp.
References DeploymentComponent::configureFromFile().
| bool configureComponents | ( | ) |
Configure the components with loaded configuration(s).
This function connects components and data ports, reads properties for the components, attaches activities and loads program and state machine scripts. If a component XML entry has the AutoConf element, configure() will be called upon this component as well. If the configuration fails halfway, the system is configured as complete as possible. You can try to reconfigure by loading a new configuration (using loadConfiguration ) and call configureComponents again to resolve remaining issues.
This function tries to apply the configuration with a best effort. For example, if a program must be loaded in the component, and a program with that same name is already present, the present one is unloaded and the new one is attempted to be loaded. If that fails, the configuration process leaves the scripts as-is and proceeds with further configuration steps of the same component and other components.
The order of configuration depends on the order of components during loadConfiguration. The first encountered component is configured first. If additional loadConfiguration operations refer to the same component, the configuration order is not changed.
Definition at line 779 of file DeploymentComponent.cpp.
References DeploymentComponent::addPeer(), DeploymentComponent::ComponentData::autoconf, DeploymentComponent::ComponentData::instance, DeploymentComponent::ComponentData::loaded, DeploymentComponent::ConnectionData::owners, DeploymentComponent::ConnectionData::ports, and DeploymentComponent::root.
Referenced by DeploymentComponent::kickStart().
| bool configureFromFile | ( | const std::string & | name, | |
| const std::string & | filename | |||
| ) |
Configure a component by loading a property file.
| name | The name of the component to configure | |
| filename | The filename where the configuration is in. |
Definition at line 1748 of file DeploymentComponent.cpp.
Referenced by DeploymentComponent::configure().
| bool connectPeers | ( | const std::string & | one, | |
| const std::string & | other | |||
| ) |
Establish a bidirectional connection between two tasks.
| one | The first task to connect | |
| other | The second task to connect |
Definition at line 253 of file DeploymentComponent.cpp.
| bool connectPorts | ( | const std::string & | one, | |
| const std::string & | one_port, | |||
| const std::string & | other, | |||
| const std::string & | other_port | |||
| ) |
Connect two named ports of components.
The direction of the connection is determined by the read/write port types.
| one | Name of the first component | |
| one_port | Name of the port of the first component to connect to other_port | |
| other | Name of the second component | |
| other_port | Name of the port of the second component to connect to one_port |
Definition at line 303 of file DeploymentComponent.cpp.
| bool connectPorts | ( | const std::string & | one, | |
| const std::string & | other | |||
| ) |
Establish a data flow connection between two tasks.
The direction of the connection is determined by the read/write port types.3B
| one | The first task to connect | |
| other | The second task to connect |
Definition at line 285 of file DeploymentComponent.cpp.
| void displayComponentTypes | ( | ) | const |
This function prints out the component types this DeploymentComponent can create.
Definition at line 1608 of file DeploymentComponent.cpp.
| bool import | ( | const std::string & | path | ) |
Import a library or all libraries in a given directory.
This function calls loadLibrary on each found shared library in path.
Definition at line 1171 of file DeploymentComponent.cpp.
References DeploymentComponent::loadLibrary().
| void kickOut | ( | const std::string & | config_file | ) |
Identical to kickOutAll, but it reads the name of the Components to kickOut from an XML file.
| config_file | name of an XML file (probably the same used by loadComponents() or kickStart() ). |
Definition at line 1770 of file DeploymentComponent.cpp.
References DeploymentComponent::kickOutComponent().
| bool kickOutComponent | ( | const std::string & | comp_name | ) |
Stop, cleanup and unload a single component which were loaded by this component.
| comp_name | name of the component. |
Definition at line 1838 of file DeploymentComponent.cpp.
References DeploymentComponent::cleanupComponent(), DeploymentComponent::root, DeploymentComponent::stopComponent(), and DeploymentComponent::unloadComponent().
Referenced by DeploymentComponent::kickOut().
| bool loadComponent | ( | const std::string & | name, | |
| const std::string & | type | |||
| ) |
Load a new component in the current process.
It wil appear as a peer with name name of this component.
| name | Name the new component will receive. | |
| type | The type of the component. This is usually a library (.dll or .so) name. |
Definition at line 1458 of file DeploymentComponent.cpp.
References DeploymentComponent::addPeer(), DeploymentComponent::componentLoaded(), DeploymentComponent::handle, and DeploymentComponent::loadLibrary().
Referenced by DeploymentComponent::loadComponents().
| bool loadComponents | ( | const std::string & | config_file | ) |
Load a (partial) application XML configuration from disk.
The necessary components are located or loaded, but no component configuration is yet applied. One can load multiple configurations and call configureComponents() once to apply all settings. In case of duplicate information is the latest loaded configuration option used.
| config_file | A file on local disk containing the XML configuration. |
Definition at line 417 of file DeploymentComponent.cpp.
References DeploymentComponent::loadComponent(), DeploymentComponent::root, and DeploymentComponent::setActivity().
Referenced by DeploymentComponent::kickStart(), and DeploymentComponent::loadConfiguration().
| bool loadConfiguration | ( | const std::string & | config_file | ) |
Load a (partial) application XML configuration from disk.
The necessary components are located or loaded, but no component configuration is yet applied. One can load multiple configurations and call configureComponents() once to apply all settings. In case of duplicate information is the latest loaded configuration option used.
| config_file | A file on local disk containing the XML configuration. |
Definition at line 412 of file DeploymentComponent.cpp.
References DeploymentComponent::loadComponents().
Referenced by DeploymentComponent::loadConfigurationString().
| bool loadConfigurationString | ( | const std::string & | config_text | ) |
Identical to loadConfiguration, but reads the XML from a string instead of a file.
| config_text | A string containing the XML configuration. |
Definition at line 363 of file DeploymentComponent.cpp.
References DeploymentComponent::loadConfiguration().
| bool loadLibrary | ( | const std::string & | name | ) |
Use this command to load a dynamic library into the memory of the current process.
| name | an absolute or relative path to a loadable library. |
Definition at line 1213 of file DeploymentComponent.cpp.
References DeploymentComponent::LoadedLib::components_type, DeploymentComponent::handle, DeploymentComponent::libname, and DeploymentComponent::LoadedLib::name.
Referenced by DeploymentComponent::import(), and DeploymentComponent::loadComponent().
| bool setActivity | ( | const std::string & | comp_name, | |
| const std::string & | act_type, | |||
| double | period, | |||
| int | priority, | |||
| int | scheduler, | |||
| const std::string & | master_name = "" | |||
| ) |
(Re-)set the activity of a component.
| comp_name | The name of the component to change. | |
| act_type | The Activity type: 'PeriodicActivity', 'NonPeriodicActivity' or 'SlaveActivity'. | |
| priority | The scheduler priority (OS dependent). | |
| period | The period of the activity. | |
| scheduler | The scheduler type ORO_SCHED_RT or ORO_SCHED_OTHER. | |
| master_name | The name of the master component in case of a SlaveActivity with a master. |
Definition at line 1670 of file DeploymentComponent.cpp.
Referenced by DeploymentComponent::loadComponents(), DeploymentComponent::setMasterSlaveActivity(), DeploymentComponent::setNonPeriodicActivity(), DeploymentComponent::setPeriodicActivity(), and DeploymentComponent::setSlaveActivity().
| bool setMasterSlaveActivity | ( | const std::string & | comp_name, | |
| const std::string & | master_name | |||
| ) |
(Re-)set the activity of a component with a slave activity with master.
| comp_name | The name of the component to change. | |
| master_name | The name of the master component. |
Definition at line 1657 of file DeploymentComponent.cpp.
References DeploymentComponent::setActivity().
| bool setNonPeriodicActivity | ( | const std::string & | comp_name, | |
| int | priority, | |||
| int | scheduler | |||
| ) |
(Re-)set the activity of a component with a non periodic activity.
| comp_name | The name of the component to change. | |
| priority | The scheduler priority (OS dependent). | |
| scheduler | The scheduler type ORO_SCHED_RT or ORO_SCHED_OTHER. |
Definition at line 1632 of file DeploymentComponent.cpp.
References DeploymentComponent::setActivity().
| bool setPeriodicActivity | ( | const std::string & | comp_name, | |
| double | period, | |||
| int | priority, | |||
| int | scheduler | |||
| ) |
(Re-)set the activity of a component with a periodic activity.
| comp_name | The name of the component to change. | |
| period | The period of the activity. | |
| priority | The scheduler priority (OS dependent). | |
| scheduler | The scheduler type ORO_SCHED_RT or ORO_SCHED_OTHER. |
Definition at line 1619 of file DeploymentComponent.cpp.
References DeploymentComponent::setActivity().
| bool setSlaveActivity | ( | const std::string & | comp_name, | |
| double | period | |||
| ) |
(Re-)set the activity of a component with a (stand alone) slave activity.
| comp_name | The name of the component to change. | |
| period | The period of the activity. |
Definition at line 1645 of file DeploymentComponent.cpp.
References DeploymentComponent::setActivity().
| bool startComponents | ( | ) |
Start all components in the current configuration which have AutoStart set to true.
Definition at line 1051 of file DeploymentComponent.cpp.
References DeploymentComponent::ComponentData::autostart, DeploymentComponent::ComponentData::instance, and DeploymentComponent::root.
Referenced by DeploymentComponent::kickStart().
| bool stopComponent | ( | const std::string & | comp_name | ) | [inline] |
Stop a single loaded and running components.
| comp_name | name of the component. |
Definition at line 518 of file DeploymentComponent.hpp.
| bool stopComponent | ( | RTT::TaskContext * | instance | ) |
Stop a single loaded and running component.
| instance | instance pointer of the component. |
Definition at line 1819 of file DeploymentComponent.cpp.
Referenced by DeploymentComponent::kickOutComponent().
| bool unloadComponent | ( | const std::string & | name | ) |
Unload a loaded component from the current process.
It may not be running.
| name | The name of a component loaded with loadComponent(). |
Definition at line 1589 of file DeploymentComponent.cpp.
References DeploymentComponent::unloadComponentImpl().
Referenced by DeploymentComponent::kickOutComponent().
RTT::PropertyBag root [protected] |
This bag stores the current configuration.
It is the cumulation of all loadConfiguration() calls.
Definition at line 68 of file DeploymentComponent.hpp.
Referenced by DeploymentComponent::clearConfiguration(), DeploymentComponent::configureComponents(), DeploymentComponent::kickOutComponent(), DeploymentComponent::loadComponents(), DeploymentComponent::startComponents(), and DeploymentComponent::unloadComponentImpl().
1.5.8