Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
OCL::DeploymentComponent Class Reference

#include <DeploymentComponent.hpp>

Inheritance diagram for OCL::DeploymentComponent:
Inheritance graph
[legend]

Classes

struct  ComponentData
 
struct  ConnectionData
 

Public Member Functions

bool addPeer (const std::string &from, const std::string &target)
 
bool aliasPeer (const std::string &from, const std::string &target, const std::string &alias)
 
bool cleanupComponent (RTT::TaskContext *instance)
 
bool cleanupComponent (const std::string &comp_name)
 
bool cleanupComponents ()
 
bool cleanupComponentsGroup (const int group)
 
void clearConfiguration ()
 
bool configure (const std::string &name)
 
bool configureComponent (RTT::TaskContext *instance)
 
bool configureComponent (const std::string &comp_name)
 
bool configureComponents ()
 
bool configureComponentsGroup (const int group)
 
bool configureFromFile (const std::string &name, const std::string &filename)
 
bool connect (const std::string &one, const std::string &other, ConnPolicy policy)
 
bool connectOperations (const std::string &required, const std::string &provided)
 
bool connectPeers (const std::string &one, const std::string &other)
 
bool connectPorts (const std::string &one, const std::string &other)
 
bool connectPorts (const std::string &one, const std::string &one_port, const std::string &other, const std::string &other_port)
 
bool connectServices (const std::string &one, const std::string &other)
 
bool createConnectionMapFromPortsTag (RTT::Property< RTT::PropertyBag > &comp, RTT::TaskContext *c, const bool ignoreNonexistentPorts)
 
bool createDataPortConnections (const bool skipUnconnected)
 
bool createStream (const std::string &component, const std::string &port, ConnPolicy policy)
 
 DeploymentComponent (std::string name="Deployer", std::string siteFile="")
 
void displayComponentTypes () const
 
std::vector< std::string > getComponentTypes () const
 
const RTT::FactoryMapgetFactories () const
 
bool import (const std::string &package)
 
void kickOut (const std::string &config_file)
 
bool kickOutAll ()
 
bool kickOutComponent (const std::string &comp_name)
 
bool kickOutGroup (const int group)
 
bool kickStart (const std::string &file_name)
 
bool kickStart2 (const std::string &configurationfile, const bool doStart, bool &loadOk, bool &configureOk, bool &startOk)
 
bool loadComponent (const std::string &name, const std::string &type)
 
bool loadComponents (const std::string &config_file)
 
bool loadComponentsInGroup (const std::string &config_file, const int group)
 
bool loadConfiguration (const std::string &config_file)
 
bool loadConfigurationString (const std::string &config_text)
 
bool loadLibrary (const std::string &name)
 
bool loadService (const std::string &component, const std::string &service)
 
RTT::TaskContextmyGetPeer (std::string name)
 
void path (const std::string &path)
 
bool reloadLibrary (const std::string &filepath)
 
bool runScript (const std::string &file_name)
 
bool setActivity (const std::string &comp_name, double period, int priority, int scheduler)
 
bool setActivityOnCPU (const std::string &comp_name, double period, int priority, int scheduler, unsigned int cpu_nr)
 
bool setFileDescriptorActivity (const std::string &comp_name, double timeout, int priority, int scheduler)
 
bool setMasterSlaveActivity (const std::string &comp_name, const std::string &master_name)
 
bool setNamedActivity (const std::string &comp_name, const std::string &act_type, double period, int priority, int scheduler, const std::string &master_name="")
 
bool setNamedActivity (const std::string &comp_name, const std::string &act_type, double period, int priority, int scheduler, unsigned cpu_affinity, const std::string &master_name="")
 
bool setPeriodicActivity (const std::string &comp_name, double period, int priority, int scheduler)
 
bool setSequentialActivity (const std::string &comp_name)
 
bool setSlaveActivity (const std::string &comp_name, double period)
 
bool setWaitPeriodPolicy (const std::string &comp_name, int policy)
 
void shutdownDeployment ()
 
bool startComponent (RTT::TaskContext *instance)
 
bool startComponent (const std::string &comp_name)
 
bool startComponents ()
 
bool startComponentsGroup (const int group)
 
bool stopComponent (RTT::TaskContext *instance)
 
bool stopComponent (const std::string &comp_name)
 
bool stopComponents ()
 
bool stopComponentsGroup (const int group)
 
bool stream (const std::string &port, ConnPolicy policy)
 
bool unloadComponent (const std::string &name)
 
bool unloadComponents ()
 
bool unloadComponentsGroup (const int group)
 
bool waitForInterrupt ()
 
bool waitForSignal (int signumber)
 
bool waitForSignals (int *sigs, std::size_t sig_count)
 
 ~DeploymentComponent ()
 
- Public Member Functions inherited from RTT::TaskContext
bool addAttribute (const std::string &name, T &attr)
 
bool addAttribute (base::AttributeBase &a)
 
bool addAttribute (base::AttributeBase &a)
 
bool addAttribute (const std::string &name, T &attr)
 
bool addConstant (const std::string &name, const T &attr)
 
bool addConstant (const std::string &name, const T &attr)
 
base::InputPortInterfaceaddEventPort (const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 
base::InputPortInterfaceaddEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 
Operation< Signature > & addOperation (Operation< Signature > &op)
 
Operation< Signature > & addOperation (Operation< Signature > &op)
 
Operation< typename internal::GetSignature< Func >::Signature > & addOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread)
 
Operation< Signature > & addOperation (const std::string name, Signature *func, ExecutionThread et=ClientThread)
 
Operation< typename internal::GetSignature< Func >::Signature > & addOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread)
 
Operation< Signature > & addOperation (const std::string name, Signature *func, ExecutionThread et=ClientThread)
 
virtual bool addPeer (TaskContext *peer, std::string alias="")
 
virtual bool addPeer (TaskContext *peer, std::string alias="")
 
base::PortInterfaceaddPort (const std::string &name, base::PortInterface &port)
 
base::PortInterfaceaddPort (base::PortInterface &port)
 
Property< T > & addProperty (const std::string &name, T &attr)
 
bool addProperty (base::PropertyBase &pb)
 
Property< T > & addProperty (const std::string &name, T &attr)
 
bool addProperty (base::PropertyBase &pb)
 
ConfigurationInterfaceattributes ()
 
ConfigurationInterfaceattributes ()
 
virtual void clear ()
 
virtual bool connectPeers (TaskContext *peer)
 
virtual bool connectPeers (TaskContext *peer)
 
virtual bool connectPorts (TaskContext *peer)
 
virtual bool connectServices (TaskContext *peer)
 
virtual bool connectServices (TaskContext *peer)
 
virtual void disconnect ()
 
virtual void disconnect ()
 
virtual void disconnectPeers (const std::string &name)
 
virtual void disconnectPeers (const std::string &name)
 
base::ActivityInterfacegetActivity ()
 
T * getActivity ()
 
base::AttributeBasegetAttribute (const std::string &name) const
 
base::AttributeBasegetAttribute (const std::string &name) const
 
virtual const std::string & getName () const
 
OperationInterfacePartgetOperation (std::string name)
 
OperationInterfacePartgetOperation (std::string name)
 
virtual TaskContextgetPeer (const std::string &peer_name) const
 
virtual TaskContextgetPeer (const std::string &peer_name) const
 
virtual PeerList getPeerList () const
 
virtual PeerList getPeerList () const
 
base::PortInterfacegetPort (const std::string &name) const
 
base::PropertyBasegetProperty (const std::string &name) const
 
base::PropertyBasegetProperty (const std::string &name) const
 
boost::shared_ptr< ServiceType > getProvider (const std::string &name)
 
boost::shared_ptr< ServiceType > getProvider (const std::string &name)
 
virtual bool hasPeer (const std::string &peer_name) const
 
virtual bool hasPeer (const std::string &peer_name) const
 
bool loadService (const std::string &service_name)
 
bool loadService (const std::string &service_name)
 
OperationInterfaceoperations ()
 
OperationInterfaceoperations ()
 
DataFlowInterfaceports ()
 
const DataFlowInterfaceports () const
 
PropertyBagproperties ()
 
PropertyBagproperties ()
 
Service::shared_ptr provides (const std::string &service_name)
 
Service::shared_ptr provides ()
 
Service::shared_ptr provides ()
 
Service::shared_ptr provides (const std::string &service_name)
 
virtual bool ready ()
 
virtual void removePeer (const std::string &name)
 
virtual void removePeer (TaskContext *peer)
 
virtual void removePeer (TaskContext *peer)
 
virtual void removePeer (const std::string &name)
 
ServiceRequester::shared_ptr requires (const std::string &service_name)
 
ServiceRequester::shared_ptr requires (const std::string &service_name)
 
ServiceRequester::shared_ptr requires ()
 
ServiceRequester::shared_ptr requires ()
 
bool setActivity (base::ActivityInterface *new_act)
 
virtual bool start ()
 
virtual bool stop ()
 
 TaskContext (const std::string &name, TaskState initial_state=Stopped)
 
virtual ~TaskContext ()
 
- Public Member Functions inherited from RTT::base::TaskCore
virtual bool activate ()
 
virtual bool activate ()
 
virtual bool cleanup ()
 
virtual bool cleanup ()
 
virtual bool configure ()
 
virtual bool configure ()
 
const ExecutionEngineengine () const
 
ExecutionEngineengine ()
 
virtual void error ()
 
virtual void error ()
 
virtual unsigned getCpuAffinity () const
 
virtual unsigned getCpuAffinity () const
 
unsigned int getCycleCounter () const
 
unsigned int getIOCounter () const
 
virtual Seconds getPeriod () const
 
virtual Seconds getPeriod () const
 
virtual TaskState getTargetState () const
 
virtual TaskState getTaskState () const
 
unsigned int getTimeOutCounter () const
 
unsigned int getTriggerCounter () const
 
virtual bool inException () const
 
virtual bool inException () const
 
virtual bool inFatalError () const
 
virtual bool inFatalError () const
 
virtual bool inRunTimeError () const
 
virtual bool inRunTimeError () const
 
virtual bool isActive () const
 
virtual bool isActive () const
 
virtual bool isConfigured () const
 
virtual bool isConfigured () const
 
virtual bool isRunning () const
 
virtual bool isRunning () const
 
virtual bool recover ()
 
virtual bool recover ()
 
virtual bool setCpuAffinity (unsigned cpu)
 
virtual bool setCpuAffinity (unsigned cpu)
 
virtual bool setPeriod (Seconds s)
 
virtual bool setPeriod (Seconds s)
 
 TaskCore (TaskState initial_state=Stopped, const std::string &name=std::string())
 
virtual bool trigger ()
 
virtual bool trigger ()
 
virtual bool update ()
 
virtual bool update ()
 
virtual ~TaskCore ()
 

Protected Types

typedef std::list< std::string > CompList
 
typedef std::map< std::string, ComponentDataCompMap
 
typedef std::map< std::string, ConnectionDataConMap
 

Protected Member Functions

virtual bool componentLoaded (RTT::TaskContext *c)
 
virtual void componentUnloaded (RTT::TaskContext *c)
 
bool configureHook ()
 
base::PortInterfacestringToPort (std::string const &names)
 
Service::shared_ptr stringToService (std::string const &names)
 
ServiceRequester::shared_ptr stringToServiceRequester (std::string const &names)
 
bool unloadComponentImpl (CompMap::iterator cit)
 
- Protected Member Functions inherited from RTT::TaskContext
virtual void dataOnPortCallback (base::PortInterface *port)
 
virtual bool dataOnPortHook (base::PortInterface *port)
 
void forceActivity (base::ActivityInterface *new_act)
 
- Protected Member Functions inherited from RTT::base::TaskCore
virtual bool breakUpdateHook ()
 
virtual void cleanupHook ()
 
virtual void errorHook ()
 
virtual void exception ()
 
virtual void exceptionHook ()
 
virtual void fatal ()
 
virtual bool startHook ()
 
virtual void stopHook ()
 
virtual void updateHook ()
 

Protected Attributes

RTT::Property< bool > autoUnload
 
CompMap compmap
 
std::string compPath
 
CompList comps
 
ConMap conmap
 
int defaultWaitPeriodPolicy
 
RTT::Constant< int > highest_Priority
 
RTT::Constant< int > lowest_Priority
 
int nextGroup
 Next group number. More...
 
RTT::PropertyBag root
 
RTT::Constant< int > sched_OTHER
 
RTT::Constant< int > sched_RT
 
RTT::Attribute< std::string > target
 
RTT::Attribute< bool > validConfig
 
- Protected Attributes inherited from RTT::base::TaskCore
ExecutionEngineee
 
unsigned int mCycleCounter
 
unsigned int mIOCounter
 
std::string mName
 
TaskState mTaskState
 
unsigned int mTimeOutCounter
 
unsigned int mTriggerCounter
 
bool mTriggerOnStart
 

Additional Inherited Members

- Public Types inherited from RTT::TaskContext
typedef std::vector< std::string > PeerList
 
typedef boost::function< void(base::PortInterface *)> SlotFunction
 
- Public Types inherited from RTT::base::TaskCore
enum  TaskState
 
- Public Attributes inherited from RTT::base::TaskCore
 Exception
 
 FatalError
 
 Init
 
 PreOperational
 
 Running
 
 RunTimeError
 
 Stopped
 

Detailed Description

A Component for deploying (configuring) other components in an application. It allows to create connections between components, load the properties and scripts for components and setup component activities.

The main idea is to load an XML file as described in the Deployment Component Manual. It dictates the libraries to load, the components to create, configure and start. Every aspect of the XML file can be expressed in a program script as well. If you want this component to execute a program script, assign it a periodic activity using either a 'site local' XML script (see below), or by listing the DeploymentComponent in your main XML file.

Automatically loading a site local XML file

It is possible to store site local settings in a separate XML configuration file which will be automatically loaded when the DeploymentComponent is created. The default name of this file is 'this->getName() + "-site.cpf"'. It is only looked for and loaded in the constructor of this class.

Configuring the DeploymentComponent itself.

When reading an XML file (for example, when using kickStart() or loadComponents() ) the DeploymentComponent checks if a section is devoted to itself by comparing the listed component name with its own name ( this->getName() ). If it matches, it applies the configuration instructions to itself in the same manner as it would configure other components.

Definition at line 86 of file DeploymentComponent.hpp.

Member Typedef Documentation

typedef std::list<std::string> OCL::DeploymentComponent::CompList
protected

Definition at line 171 of file DeploymentComponent.hpp.

typedef std::map<std::string, ComponentData> OCL::DeploymentComponent::CompMap
protected

This list and map hold the dynamically loaded components.

Definition at line 170 of file DeploymentComponent.hpp.

typedef std::map<std::string, ConnectionData> OCL::DeploymentComponent::ConMap
protected

This maps connection names to associated ports.

Definition at line 164 of file DeploymentComponent.hpp.

Constructor & Destructor Documentation

OCL::DeploymentComponent::DeploymentComponent ( std::string  name = "Deployer",
std::string  siteFile = "" 
)

Constructs and configures this component.

The constructor looks for the site local configuration XML file ('name + "-site.cpf"') and if found, kickStart()'s it. You need to set AutoConf to true in order to force a call to configureHook(). In case this file is not present in the current working directory, the component is configured and is thus constructed in the Stopped state. Using a site file does not prevent you from kickstarting or loading other XML files lateron.

Parameters
nameThe name of this component. By default: Deployer
siteFileThe site-specific XML file which, if found, will be used for a site-specific kickStart. If left empty, the value becomes by default: name + "-site.cpf"
See also
kickStart
configureHook

Definition at line 97 of file DeploymentComponent.cpp.

OCL::DeploymentComponent::~DeploymentComponent ( )

Cleans up all configuration related information. If the property 'AutoUnload' is set to true, it will also call kickOutAll(), otherwise, the loaded components are left as-is.

Definition at line 281 of file DeploymentComponent.cpp.

Member Function Documentation

bool OCL::DeploymentComponent::addPeer ( const std::string &  from,
const std::string &  target 
)

Make one component a peer of the other, in one direction, such that one can use the services of the other.

Parameters
fromThe component that must 'see' target and use its services.
targetThe component that is 'seen' and used by from.
Returns
true if both components are peers of this deployment component and target became a peer of from.

Definition at line 357 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::aliasPeer ( const std::string &  from,
const std::string &  target,
const std::string &  alias 
)

Make one component a peer of the other, in one direction, with an alternative name, such that one can use the services of the other and knows it under the name of the alias.

Parameters
fromThe component that must 'see' target and use its services.
targetThe component that is 'seen' and used by from.
aliasThe name of the target as it will be seen by from.
Returns
true if both components are peers of this deployment component and target became a peer of from.

Definition at line 377 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::cleanupComponent ( RTT::TaskContext instance)

Cleanup a single loaded and not running component.

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

Definition at line 2319 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::cleanupComponent ( const std::string &  comp_name)
inline

Cleanup a single loaded and not running component.

Parameters
comp_namename of the component.
Returns
true if successfully cleaned up

Definition at line 967 of file DeploymentComponent.hpp.

bool OCL::DeploymentComponent::cleanupComponents ( )

Cleanup all loaded and not running components.

Definition at line 1757 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::cleanupComponentsGroup ( const int  group)

Cleanup all loaded and not running components.

Parameters
groupThe group number to cleanup

Definition at line 1767 of file DeploymentComponent.cpp.

void OCL::DeploymentComponent::clearConfiguration ( )

Clear all loaded configuration options. This does not alter any component.

Definition at line 1848 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::componentLoaded ( RTT::TaskContext c)
protectedvirtual

Hook function for subclasses. Allows a subclass to abort or extend the loading of a component. By default, this function returns true.

Returns
false if the component should be unloaded again, true if loading was succesful.

Reimplemented in OCL::CorbaDeploymentComponent.

Definition at line 277 of file DeploymentComponent.cpp.

void OCL::DeploymentComponent::componentUnloaded ( RTT::TaskContext c)
protectedvirtual

Hook function for subclasses. Allows a subclass to take notice of a component being deleted.

Parameters
ca valid TaskContext object.

Reimplemented in OCL::CorbaDeploymentComponent.

Definition at line 279 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::configure ( const std::string &  name)

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

Parameters
nameThe 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 2265 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::configureComponent ( RTT::TaskContext instance)

Configure a single loaded and running component.

Parameters
instanceinstance pointer of the component.
Returns
true if successfully configured.

Definition at line 2337 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::configureComponent ( const std::string &  comp_name)
inline

Configure a single loaded and running components.

Parameters
comp_namename of the component.
Returns
true if successfully configured

Definition at line 916 of file DeploymentComponent.hpp.

bool OCL::DeploymentComponent::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.

Returns
true if all components could be succesfully configured.

Definition at line 1426 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::configureComponentsGroup ( const int  group)

Configure the components in group group.

See also
configureComponents()
Returns
true if all the group's components could be succesfully configured.

Definition at line 1437 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::configureFromFile ( const std::string &  name,
const std::string &  filename 
)

Configure a component by loading a property file.

Parameters
nameThe name of the component to configure
filenameThe 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 2270 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::configureHook ( )
protectedvirtual

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

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

Reimplemented from RTT::base::TaskCore.

Definition at line 261 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::connect ( const std::string &  one,
const std::string &  other,
ConnPolicy  policy 
)

Connect two named ports of components. The direction of the connection is determined by the read/write port types.

Parameters
oneA dot-separated path to a port in a service
otherA dot-separated path to a port in a service
policyThe connection policy of the new connetion.
Returns
true if the ports are present and could be connected, false otherwise.

Definition at line 567 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::connectOperations ( const std::string &  required,
const std::string &  provided 
)

Connects a required operation to a provided operation.

Parameters
requiredThe dot-separated name of a required operation
providedThe dot-separated name of a provided operation
Returns
true if required is connected to provided

Definition at line 621 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::connectPeers ( const std::string &  one,
const std::string &  other 
)

Make two components peers in both directions, such that both can use each other's services.

Parameters
oneThe component that must 'see' other.
otherThe component that must 'see' one.
Returns
true if both components are peers of this deployment component and could be connected.

Definition at line 341 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::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.

Note
Using this function is not advised, since it relies on equal port names on both components. Use the alternative form of connectPorts() which specify component/service and port name.
Deprecated:
by connect()
Parameters
oneThe first component
otherThe second component
Returns
true if both tasks are peers of this component and data ports could be connected.

Definition at line 496 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::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.

Parameters
oneName of the first component or a dot-separated path to its service
one_portName of the port of the first component to connect to other_port
otherName of the second component or a dot-separated path to its service
other_portName of the port of the second component to connect to one_port
Deprecated:
by connect()
Returns
true if the ports are present and could be connected, false otherwise.

Definition at line 514 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::connectServices ( const std::string &  one,
const std::string &  other 
)

Connects the required services of one component to the provided services of another and vice versa.

Parameters
oneThe name of a provided service or a dot-separated path to a Service
oneThe name of a required service or a dot-separated path to a ServiceRequester
Note
One of the parameters must be a Service and the other a ServiceRequester, or vice versa.

Definition at line 603 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::createConnectionMapFromPortsTag ( RTT::Property< RTT::PropertyBag > &  comp,
RTT::TaskContext c,
const bool  ignoreNonexistentPorts 
)

Make connection map from the <Ports> tag of comp.

Parameters
compProperty bag describing component to scan the <Ports> tag of.
cThe TaskContext instance corresponding to comp
ignoreNonexistentPortsWhether to ignore ports listed in the <Ports> tag that do not exist, otherwise to throw an error if such ports do not exist.
Returns
true if all elements in the <Ports> tag are strings (and so contain port names) and either ignoreNonexistentPorts or !ignoreNonexistentPorts and all ports named exist in c.
Precondition
0 != c

Definition at line 797 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::createDataPortConnections ( const bool  skipUnconnected)

Create data connections for all known connections in the conmap. This can be run multiple times, and it will only try to create any data connections that don't already exist.

Parameters
skipUnconnectedWhether to skip connections that have only one port. This may occur when the port for one side of a connection does not yet exist, but will be created later in the deployment process (e.g. by a component that dynamically creates ports in its configureHook() ). If skipUnconnected==false then a connection with only one port will attempt to create a stream for the connection.
Returns
true if all connections have an output port and all port connections were made succesfully.

Definition at line 1341 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::createStream ( const std::string &  component,
const std::string &  port,
ConnPolicy  policy 
)
Deprecated:
by stream()

Definition at line 553 of file DeploymentComponent.cpp.

void OCL::DeploymentComponent::displayComponentTypes ( ) const

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

See also
loadComponent()

Definition at line 2018 of file DeploymentComponent.cpp.

std::vector< std::string > OCL::DeploymentComponent::getComponentTypes ( ) const

This function returns the component types this DeploymentComponent can create in a comma separated list.

See also
loadComponent()

Definition at line 2029 of file DeploymentComponent.cpp.

const FactoryMap & OCL::DeploymentComponent::getFactories ( ) const

Returns the factory singleton which creates all types of components for the DeploymentComponent.

Definition at line 2287 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::import ( const std::string &  package)

Import a component package or directory. The import statement searches through the component paths set with path() or set using the RTT_COMPONENT_PATH environment variable.

Parameters
packageA (ros) package or directory name. All components, plugins and typekits in package will be loaded and become available to the application. As a special case, you may specify a path to a library directly, which will be loaded when found.
Returns
true if the package could be found and loaded, false if no such package was found in the search path.

Definition at line 1855 of file DeploymentComponent.cpp.

void OCL::DeploymentComponent::kickOut ( const std::string &  config_file)

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

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

Definition at line 2292 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::kickOutAll ( )

Stop, cleanup and unload all components loaded by the DeploymentComponent.

Postcondition
0 == nextGroup

Definition at line 763 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::kickOutComponent ( const std::string &  comp_name)

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

Parameters
comp_namename of the component.
Returns
true if successfully stopped, cleaned and unloaded

Definition at line 2393 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::kickOutGroup ( const int  group)

Stop, cleanup and unload all components in group group.

Definition at line 776 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::kickStart ( const std::string &  file_name)

This function runs loadComponents, configureComponents and startComponents in a row, given no failures occur along the way.

Definition at line 705 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::kickStart2 ( const std::string &  configurationfile,
const bool  doStart,
bool &  loadOk,
bool &  configureOk,
bool &  startOk 
)

This function runs loadComponents and configureComponents, and optionally startComponents, in a row, given no failures occur along the way.

Parameters
configurationfileThe file to load
doStartTrue to run startComponents, otherwise the components are only loaded and configured.
loadOkTrue if successfully loaded the file
configureOkTrue if successfully configured all components loaded from the file
startOkTrue if did not want to start (doStart==false) or did want to start (doStart==true) and successfully started all components loaded from the file, otherwise false
Returns
(loadOk && configureOk && (!doStart || startOk))

Definition at line 721 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::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.

Parameters
nameName the new component will receive.
typeThe 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 1896 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::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. The components are loaded into the next group number, and the next group number is incremented.

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

Definition at line 859 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::loadComponentsInGroup ( const std::string &  config_file,
const int  group 
)

Load a (partial) application XML configuration from disk into a specific group.

If the group already exists, then adds to that group. Does not affect existing members of the group.

See also
loadComponents for general details
Parameters
config_fileA file on local disk containing the XML configuration.
groupThe group number to load into
Precondition
0 <= group
Returns
true if the configuration could be read and was valid.

Definition at line 866 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::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.

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

Definition at line 854 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::loadConfigurationString ( const std::string &  config_text)

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

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

Definition at line 667 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::loadLibrary ( const std::string &  name)

Use this command to load a plugin or component library into the memory of the current process. This is a low-level function which you should only use if you could not use import().

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

Definition at line 1868 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::loadService ( const std::string &  component,
const std::string &  service 
)

Loads a service in the given component. If a service with the name of service is already loaded, does nothing and returns true.

Note
If the loaded service uses another name to expose itself or does not register itself with an RTT::Service object, this function will load the service anyway in case it has been loaded before.
Parameters
componentA peer of this component.
serviceA service discovered by the PluginLoader which will be loaded into component.
Returns
false if component is not a peer or service is not known. true otherwise.

Definition at line 1880 of file DeploymentComponent.cpp.

RTT::TaskContext* OCL::DeploymentComponent::myGetPeer ( std::string  name)
inline

Definition at line 264 of file DeploymentComponent.hpp.

void OCL::DeploymentComponent::path ( const std::string &  path)

Add an additional path to search for component packages.

Parameters
acolon or semi-colon separated list of directories to search for. Typically, paths have the form prefix1/lib/orocos:prefix2/lib/orocos etc.

Definition at line 1861 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::reloadLibrary ( const std::string &  filepath)

Use this command to reload a component library into the memory of the current process. This is a low-level function which you should only use for testing/development

Parameters
filepathan absolute path to a loaded library.
Returns
True if it could be reloaded, false otherwise.

Definition at line 1874 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::runScript ( const std::string &  file_name)

Scripting-alternative to kickStart: runs this script in the Orocos scripting service.

Definition at line 676 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::setActivity ( const std::string &  comp_name,
double  period,
int  priority,
int  scheduler 
)

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

Parameters
comp_nameThe name of the component to change.
periodThe period of the activity (or 0.0 if non periodic).
priorityThe scheduler priority (OS dependent).
schedulerThe 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 2039 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::setActivityOnCPU ( const std::string &  comp_name,
double  period,
int  priority,
int  scheduler,
unsigned int  cpu_nr 
)

(Re-)set the activity of a component and run it on a given CPU.

Parameters
comp_nameThe name of the component to change.
periodThe period of the activity (or 0.0 if non periodic).
priorityThe scheduler priority (OS dependent).
schedulerThe scheduler type ORO_SCHED_RT or ORO_SCHED_OTHER.
cpu_nrThe CPU to run the thread on. Numbering starts from zero.
Returns
false if one of the parameters does not match or if the component is running.

Definition at line 2067 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::setFileDescriptorActivity ( const std::string &  comp_name,
double  timeout,
int  priority,
int  scheduler 
)

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

Parameters
comp_nameThe name of the component to change.
timeoutThe timeout of the activity (or 0.0 if no timeout).
priorityThe scheduler priority (OS dependent).
schedulerThe 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 2053 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::setMasterSlaveActivity ( const std::string &  comp_name,
const std::string &  master_name 
)

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

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

Definition at line 2121 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::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.

CPU affinity defaults to all available CPUs

Parameters
comp_nameThe name of the component to change.
act_typeThe RTT::Activity type: 'Activity', 'PeriodicActivity', 'SequentialActivity' or 'SlaveActivity'.
priorityThe scheduler priority (OS dependent).
periodThe period of the activity.
schedulerThe scheduler type ORO_SCHED_RT or ORO_SCHED_OTHER.
master_nameThe name of the master component in case of a extras::SlaveActivity with a master.
Returns
false if one of the parameters does not match or if the component is running.

Definition at line 2135 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::setNamedActivity ( const std::string &  comp_name,
const std::string &  act_type,
double  period,
int  priority,
int  scheduler,
unsigned  cpu_affinity,
const std::string &  master_name = "" 
)

(Re-)set the activity of a component.

Parameters
comp_nameThe name of the component to change.
act_typeThe RTT::Activity type: 'Activity', 'PeriodicActivity', 'SequentialActivity' or 'SlaveActivity'.
priorityThe scheduler priority (OS dependent).
periodThe period of the activity.
schedulerThe scheduler type ORO_SCHED_RT or ORO_SCHED_OTHER.
cpu_affinityThe prefered cpu to run on (a mask)
master_nameThe name of the master component in case of a extras::SlaveActivity with a master.
Returns
false if one of the parameters does not match or if the component is running.

Definition at line 2149 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::setPeriodicActivity ( const std::string &  comp_name,
double  period,
int  priority,
int  scheduler 
)

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

Parameters
comp_nameThe name of the component to change.
periodThe period of the activity.
priorityThe scheduler priority (OS dependent).
schedulerThe 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 2082 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::setSequentialActivity ( const std::string &  comp_name)

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

Parameters
comp_nameThe 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 2109 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::setSlaveActivity ( const std::string &  comp_name,
double  period 
)

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

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

Definition at line 2096 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::setWaitPeriodPolicy ( const std::string &  comp_name,
int  policy 
)

(Re-)set the wait period policy of a component's thread.

Parameters
comp_nameThe name of the component to change.
policyThe new policy ORO_WAIT_ABS or ORO_WAIT_REL
Returns
false if one of the parameters does not match.

Definition at line 2248 of file DeploymentComponent.cpp.

void OCL::DeploymentComponent::shutdownDeployment ( )

Clean up and shutdown the entire deployment If an operation named "shutdownDeployment" is found in a peer component named "Application", then that operation is called otherwise if a scripting program named "shutdown" is loaded, then that will be executed, otherwise nothing occurs.

Definition at line 2413 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::startComponent ( RTT::TaskContext instance)

Stop a single loaded and running component.

Parameters
instanceinstance pointer of the component.
Returns
true if successfully started.

Definition at line 2355 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::startComponent ( const std::string &  comp_name)
inline

Stop a single loaded and running components.

Parameters
comp_namename of the component.
Returns
true if successfully started

Definition at line 933 of file DeploymentComponent.hpp.

bool OCL::DeploymentComponent::startComponents ( )

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 1662 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::startComponentsGroup ( const int  group)

Start all components in group group which have AutoStart set to true.

Returns
true if all the group's components could be succesfully started.

Definition at line 1672 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::stopComponent ( RTT::TaskContext instance)

Stop a single loaded and running component.

Parameters
instanceinstance pointer of the component.
Returns
true if successfully stopped.

Definition at line 2374 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::stopComponent ( const std::string &  comp_name)
inline

Stop a single loaded and running components.

Parameters
comp_namename of the component.
Returns
true if successfully stopped

Definition at line 950 of file DeploymentComponent.hpp.

bool OCL::DeploymentComponent::stopComponents ( )

Stop all loaded and running components.

Definition at line 1725 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::stopComponentsGroup ( const int  group)

Stop all loaded and running components in group group.

Parameters
groupThe group number to stop

Definition at line 1735 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::stream ( const std::string &  port,
ConnPolicy  policy 
)

Creates a stream from a given port of a component.

Parameters
portThe dot-separated path to an input or output port of component or service.
policyThe connection policy that instructs how to set up the stream. The policy.transport field is mandatory, the policy.name_id field is highly recommended.
Returns
true if the stream could be setup.

Definition at line 594 of file DeploymentComponent.cpp.

base::PortInterface * OCL::DeploymentComponent::stringToPort ( std::string const &  names)
protected

Converts a dot-separated path to a service to a Port object.

Parameters
namea dot-separated path name to a port. The first part of the name must be the component name. Example: "Controller.arm.input".
Returns
null if the port could not be found, the port otherwise

Definition at line 457 of file DeploymentComponent.cpp.

Service::shared_ptr OCL::DeploymentComponent::stringToService ( std::string const &  names)
protected

Converts a dot-separated path to a service to a Service object.

Parameters
namea dot-separated path name to a service. The first part of the name must be the component name. For example 'Controller.arm'.
Returns
null if the service could not be found, the service otherwise

Definition at line 393 of file DeploymentComponent.cpp.

ServiceRequester::shared_ptr OCL::DeploymentComponent::stringToServiceRequester ( std::string const &  names)
protected

Converts a dot-separated path to a service to a ServiceRequester object.

Parameters
namea dot-separated path name to a service. The first part of the name must be the component name. For example 'Controller.arm'.
Returns
null if the service could not be found, the service otherwise

Definition at line 427 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::unloadComponent ( const std::string &  name)

Unload a loaded component from the current process. It may not be running.

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

Definition at line 1999 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::unloadComponentImpl ( CompMap::iterator  cit)
protected

This method removes all references to the component hold in cit, on the condition that it is not running.

Definition at line 1938 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::unloadComponents ( )

Unload all loaded and not running components.

Definition at line 1812 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::unloadComponentsGroup ( const int  group)

Unload all loaded and not running components in group group

Parameters
groupThe group number to unload

Definition at line 1822 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::waitForInterrupt ( )

Waits for SIGINT, SIGTERM or SIGHUP and then returns.

Returns
false if this function could not install a signal handler.

Definition at line 289 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::waitForSignal ( int  signumber)

Waits for any signal and then returns.

Returns
false if this function could not install a signal handler.

Definition at line 297 of file DeploymentComponent.cpp.

bool OCL::DeploymentComponent::waitForSignals ( int *  sigs,
std::size_t  sig_count 
)

Waits for any signal in the list and then returns.

Parameters
sigsa pointer to the first element in the list of signals
thenumber of signals in the list
Returns
false if this function could not install a signal handler.

Definition at line 301 of file DeploymentComponent.cpp.

Member Data Documentation

RTT::Property<bool> OCL::DeploymentComponent::autoUnload
protected

Definition at line 97 of file DeploymentComponent.hpp.

CompMap OCL::DeploymentComponent::compmap
protected

Definition at line 172 of file DeploymentComponent.hpp.

std::string OCL::DeploymentComponent::compPath
protected

Definition at line 95 of file DeploymentComponent.hpp.

CompList OCL::DeploymentComponent::comps
protected

Definition at line 173 of file DeploymentComponent.hpp.

ConMap OCL::DeploymentComponent::conmap
protected

Definition at line 165 of file DeploymentComponent.hpp.

int OCL::DeploymentComponent::defaultWaitPeriodPolicy
protected

Definition at line 96 of file DeploymentComponent.hpp.

RTT::Constant<int> OCL::DeploymentComponent::highest_Priority
protected

Definition at line 102 of file DeploymentComponent.hpp.

RTT::Constant<int> OCL::DeploymentComponent::lowest_Priority
protected

Definition at line 101 of file DeploymentComponent.hpp.

int OCL::DeploymentComponent::nextGroup
protected

Next group number.

Definition at line 105 of file DeploymentComponent.hpp.

RTT::PropertyBag OCL::DeploymentComponent::root
protected

This bag stores the current configuration. It is the cumulation of all loadConfiguration() calls.

Definition at line 94 of file DeploymentComponent.hpp.

RTT::Constant<int> OCL::DeploymentComponent::sched_OTHER
protected

Definition at line 100 of file DeploymentComponent.hpp.

RTT::Constant<int> OCL::DeploymentComponent::sched_RT
protected

Definition at line 99 of file DeploymentComponent.hpp.

RTT::Attribute<std::string> OCL::DeploymentComponent::target
protected

Definition at line 103 of file DeploymentComponent.hpp.

RTT::Attribute<bool> OCL::DeploymentComponent::validConfig
protected

Definition at line 98 of file DeploymentComponent.hpp.


The documentation for this class was generated from the following files:


ocl
Author(s): OCL Development Team
autogenerated on Mon Mar 23 2020 04:47:20