Orocos Real-Time Toolkit
2.6.0
|
The Interface of a TaskContext which exposes its data-flow ports. More...
#include <rtt/DataFlowInterface.hpp>
Public Types | |
typedef std::vector < base::PortInterface * > | Ports |
A sequence of pointers to ports. | |
typedef std::vector< std::string > | PortNames |
A sequence of names of ports. | |
typedef boost::function< void(base::PortInterface *) | SlotFunction ) |
Public Member Functions | |
DataFlowInterface (Service *parent=0) | |
Construct the DataFlow interface of a Service. | |
base::PortInterface & | addPort (const std::string &name, base::PortInterface &port) |
Name and add a Port to the interface of this task and add a Service with the same name of the port. | |
base::PortInterface & | addPort (base::PortInterface &port) |
Add a Port to the interface of this task and add a Service with the same name of the port. | |
base::InputPortInterface & | addEventPort (const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction()) |
Name and add an Event triggering Port to the interface of this task and add a Service with the same name of the port. | |
base::InputPortInterface & | addEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction()) |
Add an Event triggering Port to the interface of this task and add a Service with the same name of the port. | |
void | removePort (const std::string &name) |
Remove a Port from this interface. | |
Ports | getPorts () const |
Get all ports of this interface. | |
PortNames | getPortNames () const |
Get all port names of this interface. | |
base::PortInterface * | getPort (const std::string &name) const |
Get an added port. | |
std::string | getPortDescription (const std::string &name) const |
Get the description of an added Port. | |
bool | setPortDescription (const std::string &name, const std::string description) |
Sets the description for the service of an added port. | |
TaskContext * | getOwner () const |
Returns the component this interface belongs to. | |
Service * | getService () const |
Returns the service this interface belongs to. | |
base::PortInterface & | addLocalPort (base::PortInterface &port) |
Add a Port to this task without registering a service for it. | |
base::InputPortInterface & | addLocalEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction()) |
Add an Event triggering Port to this task without registering a service for it. | |
template<class Type > | |
Type * | getPortType (const std::string &name) |
Get a port of a specific type. | |
void | clear () |
Remove all added ports from this interface and all associated TaskObjects. | |
void | dataOnPort (base::PortInterface *port) |
Used by the input ports to notify this class of new data. | |
Protected Member Functions | |
Service * | createPortObject (const std::string &name) |
Create a Service through which one can access a Port. | |
bool | chkPtr (const std::string &where, const std::string &name, const void *ptr) |
Protected Attributes | |
Ports | mports |
All our ports. | |
Service * | mservice |
The parent Service. |
The Interface of a TaskContext which exposes its data-flow ports.
Definition at line 59 of file DataFlowInterface.hpp.
RTT::DataFlowInterface::DataFlowInterface | ( | Service * | parent = 0 | ) |
Construct the DataFlow interface of a Service.
parent | If not null, a Service will be added to parent for each port added to this interface. |
Definition at line 48 of file DataFlowInterface.cpp.
base::InputPortInterface& RTT::DataFlowInterface::addEventPort | ( | const std::string & | name, |
base::InputPortInterface & | port, | ||
SlotFunction | callback = SlotFunction() |
||
) | [inline] |
Name and add an Event triggering Port to the interface of this task and add a Service with the same name of the port.
name | The name to give to the port. |
port | The port to add. |
callback | (Optional) provide a function which will be called asynchronously when new data arrives on this port. You can add more functions by using the port directly using base::PortInterface::getNewDataOnPort(). |
Definition at line 114 of file DataFlowInterface.hpp.
References RTT::base::PortInterface::setName().
InputPortInterface & RTT::DataFlowInterface::addEventPort | ( | base::InputPortInterface & | port, |
SlotFunction | callback = SlotFunction() |
||
) |
Add an Event triggering Port to the interface of this task and add a Service with the same name of the port.
When data arrives on this port your TaskContext will be woken up and updateHook will be executed.
port | The port to add. |
callback | (Optional) provide a function which will be called when new data arrives on this port. The callback function will be called in sequence with updateHook(), so asynchronously with regard to the arrival of data on the port. |
Definition at line 93 of file DataFlowInterface.cpp.
References addLocalEventPort(), RTT::Service::addService(), createPortObject(), RTT::base::PortInterface::getName(), RTT::Service::hasService(), mservice, and RTT::Service::removeService().
InputPortInterface & RTT::DataFlowInterface::addLocalEventPort | ( | base::InputPortInterface & | port, |
SlotFunction | callback = SlotFunction() |
||
) |
Add an Event triggering Port to this task without registering a service for it.
When data arrives on this port your TaskContext will be woken up and updateHook will be executed.
port | The port to add. |
callback | (Optional) provide a function which will be called when new data arrives on this port. The callback function will be called in sequence with updateHook(), so asynchronously with regard to the arrival of data on the port. |
Definition at line 127 of file DataFlowInterface.cpp.
References addLocalPort(), RTT::base::PortInterface::getName(), RTT::Service::getName(), RTT::Service::getOwner(), mservice, and RTT::base::InputPortInterface::signalInterface().
Referenced by addEventPort().
Add a Port to this task without registering a service for it.
If a port with the same name already exists, addPort will replace it with port and log a warning.
Definition at line 78 of file DataFlowInterface.cpp.
References RTT::base::PortInterface::getName(), mports, removePort(), and RTT::base::PortInterface::setInterface().
Referenced by addLocalEventPort(), and addPort().
base::PortInterface& RTT::DataFlowInterface::addPort | ( | const std::string & | name, |
base::PortInterface & | port | ||
) | [inline] |
Name and add a Port to the interface of this task and add a Service with the same name of the port.
name | The name to give to the port. |
port | The port to add. |
Definition at line 89 of file DataFlowInterface.hpp.
References RTT::base::PortInterface::setName().
Add a Port to the interface of this task and add a Service with the same name of the port.
If a port or service with the name already exists, addPort will replace them with port and log a warning.
port | The port to add. |
Definition at line 59 of file DataFlowInterface.cpp.
References addLocalPort(), RTT::Service::addService(), createPortObject(), RTT::base::PortInterface::getName(), RTT::Service::hasService(), mservice, and RTT::Service::removeService().
Service * RTT::DataFlowInterface::createPortObject | ( | const std::string & | name | ) | [protected] |
Create a Service through which one can access a Port.
name | The port name |
Definition at line 211 of file DataFlowInterface.cpp.
References RTT::base::PortInterface::createPortObject(), RTT::Service::doc(), getPort(), and getPortDescription().
Referenced by addEventPort(), and addPort().
PortInterface * RTT::DataFlowInterface::getPort | ( | const std::string & | name | ) | const |
Get an added port.
name | The port name |
Definition at line 184 of file DataFlowInterface.cpp.
References mports.
Referenced by RTT::TaskContext::connectPorts(), and createPortObject().
std::string RTT::DataFlowInterface::getPortDescription | ( | const std::string & | name | ) | const |
Get the description of an added Port.
name | The port name |
Definition at line 193 of file DataFlowInterface.cpp.
References mports.
Referenced by createPortObject().
Get all port names of this interface.
Definition at line 175 of file DataFlowInterface.cpp.
References mports.
Get all ports of this interface.
Definition at line 171 of file DataFlowInterface.cpp.
References mports.
Referenced by RTT::TaskContext::connectPorts(), and RTT::TaskContext::disconnect().
Service* RTT::DataFlowInterface::getService | ( | ) | const [inline] |
Returns the service this interface belongs to.
The returned service is a service living in the component returned by getOwner() or in one of its sub-services.
Definition at line 193 of file DataFlowInterface.hpp.
void RTT::DataFlowInterface::removePort | ( | const std::string & | name | ) |
Remove a Port from this interface.
This will remove all connections and callbacks assosiated with this port.
port | The port to remove. |
Definition at line 155 of file DataFlowInterface.cpp.
References RTT::Service::getOwner(), mports, mservice, and RTT::Service::removeService().
Referenced by addLocalPort().
bool RTT::DataFlowInterface::setPortDescription | ( | const std::string & | name, |
const std::string | description | ||
) |
Sets the description for the service of an added port.
It's prefered to use getPort(name)->doc(description) instead of this method, since this function only updates the documentation of the service representing this port, and not the documentation stored in the port.
name | The port name |
description | The new description for this port's service |
Definition at line 202 of file DataFlowInterface.cpp.
References RTT::Service::getService(), and mservice.
Referenced by RTT::base::PortInterface::doc().
Service* RTT::DataFlowInterface::mservice [protected] |
The parent Service.
May be null in exceptional cases.
Definition at line 262 of file DataFlowInterface.hpp.
Referenced by addEventPort(), addLocalEventPort(), addPort(), clear(), dataOnPort(), getOwner(), removePort(), RTT::Service::Service(), and setPortDescription().