CorbaDeploymentComponent Class Reference

Inheritance diagram for CorbaDeploymentComponent:
DeploymentComponent

List of all members.

Public Member Functions

 CorbaDeploymentComponent (const std::string &name, const std::string &siteFile="")
bool createServer (const std::string &tc, bool use_naming)
 Creates a ControlTask CORBA server for a given peer TaskContext.
bool corbaComponent (const std::string &name, const std::string &type)
 Similar to loadComponent, but also creates a ControlTask CORBA server for the new component and registers it with the Naming Service.
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 setActivity (const std::string &comp_name, double period, int priority, int scheduler)
 (Re-)set the activity of a component with an 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 setSequentialActivity (const std::string &comp_name)
 (Re-)set the activity of a component with a (threadless, reactive) sequential 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 setNamedActivity (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

virtual bool componentLoaded (TaskContext *c)
 Check if c is a proxy or a local object.
virtual void componentUnloaded (TaskContext *c)
 Removes the CORBA server for this component.
bool configureHook ()
 This function imports available plugins from the path formed by the expression.
bool unloadComponentImpl (CompList::iterator cit)
 This method removes all references to the component hold in cit, on the condition that it is not running.

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::Attribute< std::string > target
ConMap conmap
CompList comps

Static Protected Attributes

static std::string default_comp_path = "/home/kaltan/src/www/orocos-1.0/export/install/lib/orocos"

Detailed Description

Definition at line 37 of file CorbaDeploymentComponent.hpp.


Member Function Documentation

bool addPeer ( const std::string &  from,
const std::string &  to 
) [inherited]

Establish a uni directional connection form one task to another.

Parameters:
from The component where the connection starts.
to The component where the connection ends.
Returns:
true if both tasks are peers of this component and a connection could be created.

Definition at line 292 of file DeploymentComponent.cpp.

Referenced by DeploymentComponent::configureComponents(), DeploymentComponent::DeploymentComponent(), and DeploymentComponent::loadComponent().

bool cleanupComponent ( const std::string &  comp_name  )  [inline, inherited]

Cleanup a single loaded and not running component.

Parameters:
comp_name name of the component.
Returns:
true if successfully cleaned up

Definition at line 601 of file DeploymentComponent.hpp.

bool cleanupComponent ( RTT::TaskContext *  instance  )  [inherited]

Cleanup a single loaded and not running component.

Parameters:
instance instance pointer of the component.
Returns:
true if successfully cleaned up

Definition at line 1581 of file DeploymentComponent.cpp.

Referenced by DeploymentComponent::kickOutComponent().

void clearConfiguration (  )  [inherited]

Clear all loaded configuration options.

This does not alter any component.

Definition at line 1204 of file DeploymentComponent.cpp.

References DeploymentComponent::root.

Referenced by DeploymentComponent::DeploymentComponent().

bool componentLoaded ( TaskContext *  c  )  [protected, virtual]

Check if c is a proxy or a local object.

If it is a local object, make it a server.

Reimplemented from DeploymentComponent.

Definition at line 123 of file CorbaDeploymentComponent.cpp.

void componentUnloaded ( TaskContext *  c  )  [protected, virtual]

Removes the CORBA server for this component.

Parameters:
c a valid TaskContext object.

Reimplemented from DeploymentComponent.

Definition at line 146 of file CorbaDeploymentComponent.cpp.

bool configure ( const std::string &  name  )  [inherited]

Configure a component by loading the property file 'name.cpf' for component with name name.

Parameters:
name The name of the component to configure. The file used will be 'name.cpf'.
Returns:
true if the component is a peer of this component and the file could be read.

Definition at line 1521 of file DeploymentComponent.cpp.

References DeploymentComponent::configureFromFile().

Referenced by DeploymentComponent::DeploymentComponent().

bool configureComponents (  )  [inherited]

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.

Returns:
true if all components could be succesfully configured.

Definition at line 816 of file DeploymentComponent.cpp.

References DeploymentComponent::addPeer(), ComponentData::instance, ComponentData::loaded, and DeploymentComponent::root.

Referenced by DeploymentComponent::DeploymentComponent(), and DeploymentComponent::kickStart().

bool configureFromFile ( const std::string &  name,
const std::string &  filename 
) [inherited]

Configure a component by loading a property file.

Parameters:
name The name of the component to configure
filename The filename where the configuration is in.
Returns:
true if the component is a peer of this component and the file could be read.

Definition at line 1526 of file DeploymentComponent.cpp.

Referenced by DeploymentComponent::configure().

bool configureHook (  )  [protected, inherited]

This function imports available plugins from the path formed by the expression.

 ComponentPath + "/rtt/"+ Target + "/plugins" 
Returns:
always true.

Definition at line 241 of file DeploymentComponent.cpp.

References ComponentLoader::Instance().

bool connectPeers ( const std::string &  one,
const std::string &  other 
) [inherited]

Establish a bidirectional connection between two tasks.

Parameters:
one The first task to connect
other The second task to connect
Returns:
true if both tasks are peers of this component and could be connected.

Definition at line 276 of file DeploymentComponent.cpp.

Referenced by DeploymentComponent::DeploymentComponent().

bool connectPorts ( const std::string &  one,
const std::string &  one_port,
const std::string &  other,
const std::string &  other_port 
) [inherited]

Connect two named ports of components.

The direction of the connection is determined by the read/write port types.

Parameters:
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
Returns:
true if the ports are present and could be connected, false otherwise.

Definition at line 326 of file DeploymentComponent.cpp.

bool connectPorts ( const std::string &  one,
const std::string &  other 
) [inherited]

Establish a data flow connection between two tasks.

The direction of the connection is determined by the read/write port types.3B

Parameters:
one The first task to connect
other The second task to connect
Returns:
true if both tasks are peers of this component and data ports could be connected.

Definition at line 308 of file DeploymentComponent.cpp.

Referenced by DeploymentComponent::DeploymentComponent().

void displayComponentTypes (  )  const [inherited]

This function prints out the component types this DeploymentComponent can create.

See also:
loadComponent()

Definition at line 1346 of file DeploymentComponent.cpp.

Referenced by DeploymentComponent::DeploymentComponent().

bool import ( const std::string &  path  )  [inherited]

Import a library or all libraries in a given directory.

This function calls loadLibrary on each found shared library in path.

Definition at line 1211 of file DeploymentComponent.cpp.

References ComponentLoader::Instance().

Referenced by DeploymentComponent::DeploymentComponent().

void kickOut ( const std::string &  config_file  )  [inherited]

Identical to kickOutAll, but it reads the name of the Components to kickOut from an XML file.

Parameters:
config_file name of an XML file (probably the same used by loadComponents() or kickStart() ).

Definition at line 1548 of file DeploymentComponent.cpp.

References DeploymentComponent::kickOutComponent().

Referenced by DeploymentComponent::DeploymentComponent().

bool kickOutComponent ( const std::string &  comp_name  )  [inherited]

Stop, cleanup and unload a single component which were loaded by this component.

Parameters:
comp_name name of the component.
Returns:
true if successfully stopped, cleaned and unloaded

Definition at line 1617 of file DeploymentComponent.cpp.

References DeploymentComponent::cleanupComponent(), DeploymentComponent::root, DeploymentComponent::stopComponent(), and DeploymentComponent::unloadComponent().

Referenced by DeploymentComponent::DeploymentComponent(), and DeploymentComponent::kickOut().

bool loadComponent ( const std::string &  name,
const std::string &  type 
) [inherited]

Load a new component in the current process.

It wil appear as a peer with name name of this component.

Parameters:
name Name the new component will receive.
type The type of the component. This is usually a library (.dll or .so) name.
Returns:
True if the component could be created, false if name is already in use or type was not an Orocos library.

Definition at line 1228 of file DeploymentComponent.cpp.

References DeploymentComponent::addPeer(), DeploymentComponent::componentLoaded(), and ComponentLoader::Instance().

Referenced by DeploymentComponent::DeploymentComponent(), and DeploymentComponent::loadComponents().

bool loadComponents ( const std::string &  config_file  )  [inherited]

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.

See also:
configureComponents to configure the components with the loaded configuration and startComponents to start them.
Parameters:
config_file A file on local disk containing the XML configuration.
Returns:
true if the configuration could be read and was valid.

Definition at line 440 of file DeploymentComponent.cpp.

References DeploymentComponent::loadComponent(), DeploymentComponent::loadLibrary(), DeploymentComponent::root, and DeploymentComponent::setNamedActivity().

Referenced by DeploymentComponent::DeploymentComponent(), DeploymentComponent::kickStart(), and DeploymentComponent::loadConfiguration().

bool loadConfiguration ( const std::string &  config_file  )  [inherited]

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.

Deprecated:
by loadComponents.
See also:
configureComponents to configure the components with the loaded configuration.
Parameters:
config_file A file on local disk containing the XML configuration.
Returns:
true if the configuration could be read and was valid.

Definition at line 435 of file DeploymentComponent.cpp.

References DeploymentComponent::loadComponents().

Referenced by DeploymentComponent::DeploymentComponent(), and DeploymentComponent::loadConfigurationString().

bool loadConfigurationString ( const std::string &  config_text  )  [inherited]

Identical to loadConfiguration, but reads the XML from a string instead of a file.

Parameters:
config_text A string containing the XML configuration.
Returns:
true if the configuration string could be read and was valid.

Definition at line 386 of file DeploymentComponent.cpp.

References DeploymentComponent::loadConfiguration().

Referenced by DeploymentComponent::DeploymentComponent().

bool loadLibrary ( const std::string &  name  )  [inherited]

Use this command to load a dynamic library into the memory of the current process.

Parameters:
name an absolute or relative path to a loadable library.
Returns:
True if it could be loaded, false otherwise.

Definition at line 1221 of file DeploymentComponent.cpp.

References ComponentLoader::Instance().

Referenced by DeploymentComponent::DeploymentComponent(), and DeploymentComponent::loadComponents().

bool setActivity ( const std::string &  comp_name,
double  period,
int  priority,
int  scheduler 
) [inherited]

(Re-)set the activity of a component with an activity.

Parameters:
comp_name The name of the component to change.
period The period of the activity (or 0.0 if non periodic).
priority The scheduler priority (OS dependent).
scheduler The scheduler type ORO_SCHED_RT or ORO_SCHED_OTHER.
Returns:
false if one of the parameters does not match or if the component is running.

Definition at line 1357 of file DeploymentComponent.cpp.

References DeploymentComponent::setNamedActivity().

Referenced by DeploymentComponent::DeploymentComponent().

bool setMasterSlaveActivity ( const std::string &  comp_name,
const std::string &  master_name 
) [inherited]

(Re-)set the activity of a component with a slave activity with master.

Parameters:
comp_name The name of the component to change.
master_name The name of the master component.
Returns:
false if one of the components is not found or comp_name is running.

Definition at line 1424 of file DeploymentComponent.cpp.

References DeploymentComponent::setNamedActivity().

Referenced by DeploymentComponent::DeploymentComponent().

bool setNamedActivity ( const std::string &  comp_name,
const std::string &  act_type,
double  period,
int  priority,
int  scheduler,
const std::string &  master_name = "" 
) [inherited]

(Re-)set the activity of a component.

Parameters:
comp_name The name of the component to change.
act_type The Activity type: 'Activity', '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.
Returns:
false if one of the parameters does not match or if the component is running.

Definition at line 1438 of file DeploymentComponent.cpp.

Referenced by DeploymentComponent::loadComponents(), DeploymentComponent::setActivity(), DeploymentComponent::setMasterSlaveActivity(), DeploymentComponent::setNonPeriodicActivity(), DeploymentComponent::setPeriodicActivity(), DeploymentComponent::setSequentialActivity(), and DeploymentComponent::setSlaveActivity().

bool setNonPeriodicActivity ( const std::string &  comp_name,
int  priority,
int  scheduler 
) [inherited]

(Re-)set the activity of a component with a non periodic activity.

Parameters:
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.
Returns:
false if one of the parameters does not match or if the component is running.

Definition at line 1385 of file DeploymentComponent.cpp.

References DeploymentComponent::setNamedActivity().

Referenced by DeploymentComponent::DeploymentComponent().

bool setPeriodicActivity ( const std::string &  comp_name,
double  period,
int  priority,
int  scheduler 
) [inherited]

(Re-)set the activity of a component with a periodic activity.

Parameters:
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.
Returns:
false if one of the parameters does not match or if the component is running.

Definition at line 1371 of file DeploymentComponent.cpp.

References DeploymentComponent::setNamedActivity().

Referenced by DeploymentComponent::DeploymentComponent().

bool setSequentialActivity ( const std::string &  comp_name  )  [inherited]

(Re-)set the activity of a component with a (threadless, reactive) sequential activity.

Parameters:
comp_name The name of the component to change.
Returns:
false if one of the parameters does not match or if the component is running.

Definition at line 1412 of file DeploymentComponent.cpp.

References DeploymentComponent::setNamedActivity().

Referenced by DeploymentComponent::DeploymentComponent().

bool setSlaveActivity ( const std::string &  comp_name,
double  period 
) [inherited]

(Re-)set the activity of a component with a (stand alone) slave activity.

Parameters:
comp_name The name of the component to change.
period The period of the activity.
Returns:
false if one of the parameters does not match or if the component is running.

Definition at line 1399 of file DeploymentComponent.cpp.

References DeploymentComponent::setNamedActivity().

Referenced by DeploymentComponent::DeploymentComponent().

bool startComponents (  )  [inherited]

Start all components in the current configuration which have AutoStart set to true.

Returns:
true if all components could be succesfully started.

Definition at line 1093 of file DeploymentComponent.cpp.

References ComponentData::instance, and DeploymentComponent::root.

Referenced by DeploymentComponent::DeploymentComponent(), and DeploymentComponent::kickStart().

bool stopComponent ( const std::string &  comp_name  )  [inline, inherited]

Stop a single loaded and running components.

Parameters:
comp_name name of the component.
Returns:
true if successfully stopped

Definition at line 584 of file DeploymentComponent.hpp.

bool stopComponent ( RTT::TaskContext *  instance  )  [inherited]

Stop a single loaded and running component.

Parameters:
instance instance pointer of the component.
Returns:
true if successfully stopped.

Definition at line 1598 of file DeploymentComponent.cpp.

Referenced by DeploymentComponent::kickOutComponent().

bool unloadComponent ( const std::string &  name  )  [inherited]

Unload a loaded component from the current process.

It may not be running.

Parameters:
name The name of a component loaded with loadComponent().
Returns:
true if name was not running and could be unloaded.

Definition at line 1327 of file DeploymentComponent.cpp.

References DeploymentComponent::unloadComponentImpl().

Referenced by DeploymentComponent::DeploymentComponent(), and DeploymentComponent::kickOutComponent().


Member Data Documentation

RTT::PropertyBag root [protected, inherited]

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