RTT::TaskContext Class Reference

#include <TaskContext.hpp>

Inheritance diagram for RTT::TaskContext:
Inheritance graph
[legend]

List of all members.

Public Types

typedef std::vector< std::string > PeerList
typedef std::vector< std::string > PeerList

Public Member Functions

virtual void clear ()
virtual void clear ()
template<typename T >
T * getActivity ()
base::ActivityInterfacegetActivity ()
template<typename T >
T * getActivity ()
base::ActivityInterfacegetActivity ()
virtual const std::string & getName ()
virtual const std::string & getName ()
virtual bool ready ()
virtual bool ready ()
bool setActivity (base::ActivityInterface *new_act)
bool setActivity (base::ActivityInterface *new_act)
virtual bool start ()
virtual bool start ()
virtual bool stop ()
virtual bool stop ()
 TaskContext (const std::string &name, ExecutionEngine *parent, TaskState initial_state=Stopped)
 TaskContext (const std::string &name, TaskState initial_state=Stopped)
 TaskContext (const std::string &name, ExecutionEngine *parent, TaskState initial_state=Stopped)
 TaskContext (const std::string &name, TaskState initial_state=Stopped)
virtual ~TaskContext ()
virtual ~TaskContext ()
Attributes

Adding and getting attributes from the TaskContext interface. These functions all forward to the Service representing this TaskContext. Use attributes() to access the complete ConfigurationInterface interface of this TaskContext.

bool addAttribute (base::AttributeBase &a)
template<class T >
bool addAttribute (const std::string &name, T &attr)
bool addAttribute (base::AttributeBase &a)
template<class T >
bool addAttribute (const std::string &name, T &attr)
template<class T >
bool addConstant (const std::string &name, const T &attr)
template<class T >
bool addConstant (const std::string &name, const T &attr)
ConfigurationInterfaceattributes ()
ConfigurationInterfaceattributes ()
base::AttributeBasegetAttribute (const std::string &name) const
base::AttributeBasegetAttribute (const std::string &name) const
Ports

These functions serve to manage ports and data flow connections. Use ports() to access the complete DataFlowInterface functionality of this TaskContext.

base::InputPortInterfaceaddEventPort (base::InputPortInterface &port, base::InputPortInterface::NewDataOnPortEvent::SlotFunction callback=base::InputPortInterface::NewDataOnPortEvent::SlotFunction())
base::InputPortInterfaceaddEventPort (const std::string &name, base::InputPortInterface &port, base::InputPortInterface::NewDataOnPortEvent::SlotFunction callback=base::InputPortInterface::NewDataOnPortEvent::SlotFunction())
base::InputPortInterfaceaddEventPort (base::InputPortInterface &port, base::InputPortInterface::NewDataOnPortEvent::SlotFunction callback=base::InputPortInterface::NewDataOnPortEvent::SlotFunction())
base::InputPortInterfaceaddEventPort (const std::string &name, base::InputPortInterface &port, base::InputPortInterface::NewDataOnPortEvent::SlotFunction callback=base::InputPortInterface::NewDataOnPortEvent::SlotFunction())
base::PortInterfaceaddPort (base::PortInterface &port)
base::PortInterfaceaddPort (const std::string &name, base::PortInterface &port)
base::PortInterfaceaddPort (base::PortInterface &port)
base::PortInterfaceaddPort (const std::string &name, base::PortInterface &port)
virtual bool connectPorts (TaskContext *peer)
virtual bool connectPorts (TaskContext *peer)
base::PortInterfacegetPort (const std::string &name) const
base::PortInterfacegetPort (const std::string &name) const
const DataFlowInterfaceports () const
DataFlowInterfaceports ()
const DataFlowInterfaceports () const
DataFlowInterfaceports ()
Operations

Adding and getting operations from the TaskContext interface. These functions all forward to the Service representing this TaskContext. Use provides() to access the complete Service interface of this TaskContext.

template<class Signature >
Operation< Signature > & addOperation (const std::string name, Signature *func, ExecutionThread et=ClientThread)
template<class Func , class Service >
Operation< typename
internal::GetSignature< Func >
::Signature > & 
addOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread)
template<class Signature >
Operation< Signature > & addOperation (Operation< Signature > &op)
template<class Signature >
Operation< Signature > & addOperation (const std::string name, Signature *func, ExecutionThread et=ClientThread)
template<class Func , class Service >
Operation< typename
internal::GetSignature< Func >
::Signature > & 
addOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread)
template<class Signature >
Operation< Signature > & addOperation (Operation< Signature > &op)
OperationInterfacePartgetOperation (std::string name)
OperationInterfacePartgetOperation (std::string name)
OperationInterfaceoperations ()
OperationInterfaceoperations ()
Peer-to-Peer functions

These functions are used to setup and manage peer-to-peer networks of TaskContext objects.

virtual bool addPeer (TaskContext *peer, std::string alias="")
virtual bool addPeer (TaskContext *peer, std::string alias="")
virtual bool connectPeers (TaskContext *peer)
virtual bool connectPeers (TaskContext *peer)
virtual void disconnect ()
virtual void disconnect ()
virtual void disconnectPeers (const std::string &name)
virtual void disconnectPeers (const 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
virtual bool hasPeer (const std::string &peer_name) const
virtual bool hasPeer (const std::string &peer_name) const
virtual void removePeer (TaskContext *peer)
virtual void removePeer (const std::string &name)
virtual void removePeer (TaskContext *peer)
virtual void removePeer (const std::string &name)
Properties

Adding and getting properties from the TaskContext interface. These functions all forward to the Service representing this TaskContext. Use properties() to access the complete PropertyBag interface of this TaskContext.

bool addProperty (base::PropertyBase &pb)
template<class T >
Property< T > & addProperty (const std::string &name, T &attr)
bool addProperty (base::PropertyBase &pb)
template<class T >
Property< T > & addProperty (const std::string &name, T &attr)
base::PropertyBasegetProperty (const std::string &name) const
base::PropertyBasegetProperty (const std::string &name) const
PropertyBagproperties ()
PropertyBagproperties ()
Services

These functions are used to create and manage services. Use provides() or requires() to access the Service or ServiceRequester objects that contain all service related functions.

virtual bool connectServices (TaskContext *peer)
virtual bool connectServices (TaskContext *peer)
template<class ServiceType >
boost::shared_ptr< ServiceType > getProvider (const std::string &name)
template<class ServiceType >
boost::shared_ptr< ServiceType > getProvider (const std::string &name)
Service::shared_ptr provides (const std::string &service_name)
Service::shared_ptr provides ()
Service::shared_ptr provides (const std::string &service_name)
Service::shared_ptr provides ()
ServiceRequesterrequires (const std::string &service_name)
ServiceRequesterrequires ()
ServiceRequesterrequires (const std::string &service_name)
ServiceRequesterrequires ()

Protected Member Functions

void forceActivity (base::ActivityInterface *new_act)
void forceActivity (base::ActivityInterface *new_act)

Private Types

typedef std::map< std::string,
boost::shared_ptr
< ServiceRequester > > 
LocalServices
typedef std::map< std::string,
boost::shared_ptr
< ServiceRequester > > 
LocalServices
typedef std::map< std::string,
TaskContext * > 
PeerMap
typedef std::map< std::string,
TaskContext * > 
PeerMap
typedef std::map
< base::PortInterface
*, boost::shared_ptr
< base::InputPortInterface::NewDataOnPortEvent > > 
UserCallbacks
typedef std::map
< base::PortInterface
*, boost::shared_ptr
< base::InputPortInterface::NewDataOnPortEvent > > 
UserCallbacks
typedef std::vector
< TaskContext * > 
Users
typedef std::vector
< TaskContext * > 
Users

Private Member Functions

void addUser (TaskContext *user)
void addUser (TaskContext *user)
void dataOnPort (base::PortInterface *port)
void dataOnPort (base::PortInterface *port)
void dataOnPortCallback (base::InputPortInterface *port, base::InputPortInterface::SlotFunction callback)
void dataOnPortCallback (base::InputPortInterface *port, base::InputPortInterface::SlotFunction callback)
void dataOnPortRemoved (base::PortInterface *port)
void dataOnPortRemoved (base::PortInterface *port)
bool dataOnPortSize (unsigned int max)
bool dataOnPortSize (unsigned int max)
bool prepareProvide (const std::string &name)
bool prepareProvide (const std::string &name)
void prepareUpdateHook ()
void prepareUpdateHook ()
void removeUser (TaskContext *user)
void removeUser (TaskContext *user)
void setup ()
void setup ()
 TaskContext (TaskContext &)
 TaskContext (TaskContext &)

Private Attributes

PeerMap _task_map
 map of the tasks we are using
LocalServices localservs
os::Mutex mportlock
Users musers
 map of the tasks that are using us.
base::ActivityInterface::shared_ptr our_act
internal::MWSRQueue
< base::PortInterface * > * 
portqueue
ServiceRequestertcrequests
Service::shared_ptr tcservice
UserCallbacks user_callbacks

Friends

class DataFlowInterface

Detailed Description

The TaskContext is the C++ representation of an Orocos component. It defines which services it provides and requires and which ports are inputs and outputs. It can be configured through the means of properties.

TaskContext interface
You can define the interface of a TaskContext by adding interface primitives. These are (data flow) ports, (configuration) properties and operations (functions). Setting up the interface is explained at length in the Orocos Component Builder's Manual.
TaskContext state behaviour
When a TaskContext is created it defaults to the 'Stopped' state or the 'PreOperational' state. If it is 'Stopped', it can be start()'ed. If it is 'PreOperational', it must first be configure()'d before it can be started. You can choose between both using the constructor.
See also:
TaskState (in base::TaskCore) for a detailed explanation.
Executing a TaskContext
In order to run the ExecutionEngine, the ExecutionEngine must be run by an base::ActivityInterface implementation. As long as there is no activity or the activity is not started, this TaskContext will not accept any asynchronous invocations, nor execute programs or state machines.
Connecting TaskContexts
TaskContexts are connected using the unidirectional addPeer() or bidirectional RTT::connectPeers() methods. These methods only allow 'peer' TaskContexts to use each other's interface. Use RTT::connectPorts() to setup the data connections between data ports. In order to disconnect this task from its peers, use disconnect(), which will disconnect all the Data Flow Ports and remove this object from its Peers.

In day-to-day use, TaskContexts are connected using the OCL::DeploymentComponent and an XML file or script.

Definition at line 87 of file install/include/rtt/TaskContext.hpp.


Member Typedef Documentation

typedef std::map<std::string, boost::shared_ptr<ServiceRequester> > RTT::TaskContext::LocalServices [private]

Definition at line 661 of file rtt/TaskContext.hpp.

typedef std::map<std::string, boost::shared_ptr<ServiceRequester> > RTT::TaskContext::LocalServices [private]

Definition at line 615 of file install/include/rtt/TaskContext.hpp.

typedef std::vector< std::string > RTT::TaskContext::PeerList

A list of Peer TaskContext names.

Definition at line 100 of file rtt/TaskContext.hpp.

typedef std::vector< std::string > RTT::TaskContext::PeerList

A list of Peer TaskContext names.

Definition at line 54 of file install/include/rtt/TaskContext.hpp.

typedef std::map< std::string, TaskContext* > RTT::TaskContext::PeerMap [private]

Definition at line 597 of file rtt/TaskContext.hpp.

typedef std::map< std::string, TaskContext* > RTT::TaskContext::PeerMap [private]

Definition at line 551 of file install/include/rtt/TaskContext.hpp.

Definition at line 623 of file rtt/TaskContext.hpp.

Definition at line 577 of file install/include/rtt/TaskContext.hpp.

typedef std::vector< TaskContext* > RTT::TaskContext::Users [private]

Definition at line 598 of file rtt/TaskContext.hpp.

typedef std::vector< TaskContext* > RTT::TaskContext::Users [private]

Definition at line 552 of file install/include/rtt/TaskContext.hpp.


Constructor & Destructor Documentation

RTT::TaskContext::TaskContext ( const std::string &  name,
TaskState  initial_state = Stopped 
)

Create a TaskContext. It's ExecutionEngine will be newly constructed with private processing of commands, events, programs and state machines.

Parameters:
name The name of this component.
initial_state Provide the PreOperational parameter flag here to force users in calling configure(), before they call start().

Definition at line 70 of file TaskContext.cpp.

RTT::TaskContext::TaskContext ( const std::string &  name,
ExecutionEngine parent,
TaskState  initial_state = Stopped 
)

Create a TaskContext. Its commands programs and state machines are processed by parent. Use this constructor to share execution engines among task contexts, such that the execution of their functionality is serialised (executed in the same thread).

Parameters:
name The name of this component.
initial_state Provide the PreOperational parameter flag here to force users in calling configure(), before they call start().

Definition at line 83 of file TaskContext.cpp.

RTT::TaskContext::~TaskContext (  )  [virtual]

Definition at line 126 of file TaskContext.cpp.

RTT::TaskContext::TaskContext ( TaskContext  )  [private]
RTT::TaskContext::TaskContext ( const std::string &  name,
TaskState  initial_state = Stopped 
)

Create a TaskContext. It's ExecutionEngine will be newly constructed with private processing of commands, events, programs and state machines.

Parameters:
name The name of this component.
initial_state Provide the PreOperational parameter flag here to force users in calling configure(), before they call start().
RTT::TaskContext::TaskContext ( const std::string &  name,
ExecutionEngine parent,
TaskState  initial_state = Stopped 
)

Create a TaskContext. Its commands programs and state machines are processed by parent. Use this constructor to share execution engines among task contexts, such that the execution of their functionality is serialised (executed in the same thread).

Parameters:
name The name of this component.
initial_state Provide the PreOperational parameter flag here to force users in calling configure(), before they call start().
virtual RTT::TaskContext::~TaskContext (  )  [virtual]
RTT::TaskContext::TaskContext ( TaskContext  )  [private]

Member Function Documentation

bool RTT::TaskContext::addAttribute ( base::AttributeBase a  )  [inline]

Add an base::AttributeBase which remains owned by the user. This is a low-level function that can be used if you already created an Attribute object that does not belong yet to a service.

Parameters:
a remains owned by the user, and becomes served by the repository.

Definition at line 430 of file rtt/TaskContext.hpp.

template<class T >
bool RTT::TaskContext::addAttribute ( const std::string &  name,
T &  attr 
) [inline]

Adds a variable of any type as read/write attribute to the attribute interface. An Alias is created which causes contents of the attr variable always to be in sync with the contents of the attribute object in the interface.

Parameters:
name The name of this attribute
attr The variable that will be aliased.

Definition at line 404 of file rtt/TaskContext.hpp.

bool RTT::TaskContext::addAttribute ( base::AttributeBase a  )  [inline]

Add an base::AttributeBase which remains owned by the user. This is a low-level function that can be used if you already created an Attribute object that does not belong yet to a service.

Parameters:
a remains owned by the user, and becomes served by the repository.

Definition at line 384 of file install/include/rtt/TaskContext.hpp.

template<class T >
bool RTT::TaskContext::addAttribute ( const std::string &  name,
T &  attr 
) [inline]

Adds a variable of any type as read/write attribute to the attribute interface. An Alias is created which causes contents of the attr variable always to be in sync with the contents of the attribute object in the interface.

Parameters:
name The name of this attribute
attr The variable that will be aliased.

Definition at line 358 of file install/include/rtt/TaskContext.hpp.

template<class T >
bool RTT::TaskContext::addConstant ( const std::string &  name,
const T &  attr 
) [inline]

Adds a variable of any type as read-only attribute to the attribute interface. An Alias is created which causes contents of the attribute always to be in sync with the contents of attr, but it can only be read through the interface.

Parameters:
name The name of this attribute
attr The variable that will be aliased.

Definition at line 417 of file rtt/TaskContext.hpp.

template<class T >
bool RTT::TaskContext::addConstant ( const std::string &  name,
const T &  attr 
) [inline]

Adds a variable of any type as read-only attribute to the attribute interface. An Alias is created which causes contents of the attribute always to be in sync with the contents of attr, but it can only be read through the interface.

Parameters:
name The name of this attribute
attr The variable that will be aliased.

Definition at line 371 of file install/include/rtt/TaskContext.hpp.

base::InputPortInterface& RTT::TaskContext::addEventPort ( base::InputPortInterface port,
base::InputPortInterface::NewDataOnPortEvent::SlotFunction  callback = base::InputPortInterface::NewDataOnPortEvent::SlotFunction() 
) [inline]

Add an Event triggering Port to the interface of this task and add a Service with the same name of the port.

Parameters:
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 552 of file rtt/TaskContext.hpp.

base::InputPortInterface& RTT::TaskContext::addEventPort ( const std::string &  name,
base::InputPortInterface port,
base::InputPortInterface::NewDataOnPortEvent::SlotFunction  callback = base::InputPortInterface::NewDataOnPortEvent::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.

Parameters:
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 539 of file rtt/TaskContext.hpp.

base::InputPortInterface& RTT::TaskContext::addEventPort ( base::InputPortInterface port,
base::InputPortInterface::NewDataOnPortEvent::SlotFunction  callback = base::InputPortInterface::NewDataOnPortEvent::SlotFunction() 
) [inline]

Add an Event triggering Port to the interface of this task and add a Service with the same name of the port.

Parameters:
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 506 of file install/include/rtt/TaskContext.hpp.

base::InputPortInterface& RTT::TaskContext::addEventPort ( const std::string &  name,
base::InputPortInterface port,
base::InputPortInterface::NewDataOnPortEvent::SlotFunction  callback = base::InputPortInterface::NewDataOnPortEvent::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.

Parameters:
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 493 of file install/include/rtt/TaskContext.hpp.

template<class Signature >
Operation< Signature >& RTT::TaskContext::addOperation ( const std::string  name,
Signature *  func,
ExecutionThread  et = ClientThread 
) [inline]

Adds a C function as an operation.

See also:
Service::addOperation

Definition at line 362 of file rtt/TaskContext.hpp.

template<class Func , class Service >
Operation< typename internal::GetSignature<Func>::Signature >& RTT::TaskContext::addOperation ( const std::string  name,
Func  func,
Service serv,
ExecutionThread  et = ClientThread 
) [inline]

Adds a C++ function as an operation.

See also:
Service::addOperation

Definition at line 351 of file rtt/TaskContext.hpp.

template<class Signature >
Operation<Signature>& RTT::TaskContext::addOperation ( Operation< Signature > &  op  )  [inline]

Add an operation object to the interface. This version of addOperation exports an Operation object to the public interface of this component.

Parameters:
op The operation object to add.
Returns:
true if it could be added.

Definition at line 340 of file rtt/TaskContext.hpp.

template<class Signature >
Operation< Signature >& RTT::TaskContext::addOperation ( const std::string  name,
Signature *  func,
ExecutionThread  et = ClientThread 
) [inline]

Adds a C function as an operation.

See also:
Service::addOperation

Definition at line 316 of file install/include/rtt/TaskContext.hpp.

template<class Func , class Service >
Operation< typename internal::GetSignature<Func>::Signature >& RTT::TaskContext::addOperation ( const std::string  name,
Func  func,
Service serv,
ExecutionThread  et = ClientThread 
) [inline]

Adds a C++ function as an operation.

See also:
Service::addOperation

Definition at line 305 of file install/include/rtt/TaskContext.hpp.

template<class Signature >
Operation<Signature>& RTT::TaskContext::addOperation ( Operation< Signature > &  op  )  [inline]

Add an operation object to the interface. This version of addOperation exports an Operation object to the public interface of this component.

Parameters:
op The operation object to add.
Returns:
true if it could be added.

Definition at line 294 of file install/include/rtt/TaskContext.hpp.

virtual bool RTT::TaskContext::addPeer ( TaskContext peer,
std::string  alias = "" 
) [virtual]

Add a one-way connection from this task to a peer task.

Parameters:
peer The peer to add.
alias An optional alias (another name) for the peer. defaults to peer->getName()

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskContext::addPeer ( TaskContext peer,
std::string  alias = "" 
) [virtual]

Add a one-way connection from this task to a peer task.

Parameters:
peer The peer to add.
alias An optional alias (another name) for the peer. defaults to peer->getName()

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 246 of file TaskContext.cpp.

base::PortInterface& RTT::TaskContext::addPort ( base::PortInterface port  )  [inline]

Add a Port to the interface of this task and add a Service with the same name of the port.

Parameters:
port The port to add.

Definition at line 526 of file rtt/TaskContext.hpp.

base::PortInterface& RTT::TaskContext::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.

Parameters:
name The name to give to the port.
port The port to add.

Definition at line 516 of file rtt/TaskContext.hpp.

base::PortInterface& RTT::TaskContext::addPort ( base::PortInterface port  )  [inline]

Add a Port to the interface of this task and add a Service with the same name of the port.

Parameters:
port The port to add.

Definition at line 480 of file install/include/rtt/TaskContext.hpp.

base::PortInterface& RTT::TaskContext::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.

Parameters:
name The name to give to the port.
port The port to add.

Definition at line 470 of file install/include/rtt/TaskContext.hpp.

bool RTT::TaskContext::addProperty ( base::PropertyBase pb  )  [inline]

Add an base::PropertyBase as a property.

Returns:
false if a property with the same name already exists.

Definition at line 480 of file rtt/TaskContext.hpp.

template<class T >
Property<T>& RTT::TaskContext::addProperty ( const std::string &  name,
T &  attr 
) [inline]

Adds a variable of any type as a property to the attribute interface. A Property is created which causes contents of the property always to be in sync with the contents of attr.

Parameters:
name The name of this property
attr The variable that will be aliased.
Returns:
the Property object by reference, which you can further query or document.

Definition at line 472 of file rtt/TaskContext.hpp.

bool RTT::TaskContext::addProperty ( base::PropertyBase pb  )  [inline]

Add an base::PropertyBase as a property.

Returns:
false if a property with the same name already exists.

Definition at line 434 of file install/include/rtt/TaskContext.hpp.

template<class T >
Property<T>& RTT::TaskContext::addProperty ( const std::string &  name,
T &  attr 
) [inline]

Adds a variable of any type as a property to the attribute interface. A Property is created which causes contents of the property always to be in sync with the contents of attr.

Parameters:
name The name of this property
attr The variable that will be aliased.
Returns:
the Property object by reference, which you can further query or document.

Definition at line 426 of file install/include/rtt/TaskContext.hpp.

void RTT::TaskContext::addUser ( TaskContext user  )  [private]

Inform this TaskContext that user is using our services.

void RTT::TaskContext::addUser ( TaskContext user  )  [private]

Inform this TaskContext that user is using our services.

Definition at line 233 of file TaskContext.cpp.

ConfigurationInterface* RTT::TaskContext::attributes (  )  [inline]

Returns the attributes of this TaskContext as an ConfigurationInterface.

Definition at line 451 of file rtt/TaskContext.hpp.

ConfigurationInterface* RTT::TaskContext::attributes (  )  [inline]

Returns the attributes of this TaskContext as an ConfigurationInterface.

Definition at line 405 of file install/include/rtt/TaskContext.hpp.

virtual void RTT::TaskContext::clear (  )  [virtual]

Clear the complete interface of this Component. This method removes all objects and all methods, commands, events, properties and ports from the interface of this TaskContext.

void RTT::TaskContext::clear (  )  [virtual]

Clear the complete interface of this Component. This method removes all objects and all methods, commands, events, properties and ports from the interface of this TaskContext.

Definition at line 374 of file TaskContext.cpp.

virtual bool RTT::TaskContext::connectPeers ( TaskContext peer  )  [virtual]

Add a two-way connection from this task to a peer task.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskContext::connectPeers ( TaskContext peer  )  [virtual]

Add a two-way connection from this task to a peer task.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 276 of file TaskContext.cpp.

virtual bool RTT::TaskContext::connectPorts ( TaskContext peer  )  [virtual]

Add a data flow connection from this task's ports to a peer's ports.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskContext::connectPorts ( TaskContext peer  )  [virtual]

Add a data flow connection from this task's ports to a peer's ports.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 154 of file TaskContext.cpp.

virtual bool RTT::TaskContext::connectServices ( TaskContext peer  )  [virtual]

Connects all requires/provides services of this component to these of a peer.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskContext::connectServices ( TaskContext peer  )  [virtual]

Connects all requires/provides services of this component to these of a peer.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 191 of file TaskContext.cpp.

void RTT::TaskContext::dataOnPort ( base::PortInterface port  )  [private]

This callback is called each time data arrived on an event port.

void RTT::TaskContext::dataOnPort ( base::PortInterface port  )  [private]

This callback is called each time data arrived on an event port.

Definition at line 411 of file TaskContext.cpp.

void RTT::TaskContext::dataOnPortCallback ( base::InputPortInterface port,
base::InputPortInterface::SlotFunction  callback 
) [private]

Function to call in the thread of this component if data on the given port arrives.

void RTT::TaskContext::dataOnPortCallback ( base::InputPortInterface port,
base::InputPortInterface::SlotFunction  callback 
) [private]

Function to call in the thread of this component if data on the given port arrives.

void RTT::TaskContext::dataOnPortRemoved ( base::PortInterface port  )  [private]

Inform that a given port will no longer raise dataOnPort() events.

void RTT::TaskContext::dataOnPortRemoved ( base::PortInterface port  )  [private]

Inform that a given port will no longer raise dataOnPort() events.

Definition at line 429 of file TaskContext.cpp.

bool RTT::TaskContext::dataOnPortSize ( unsigned int  max  )  [private]

Called to inform us of the number of possible ports that will trigger a dataOnPort event.

Returns:
false if this->isRunning().
bool RTT::TaskContext::dataOnPortSize ( unsigned int  max  )  [private]

Called to inform us of the number of possible ports that will trigger a dataOnPort event.

Returns:
false if this->isRunning().
virtual void RTT::TaskContext::disconnect (  )  [virtual]

Disconnect this TaskContext from it's peers and ports. All its Data Flow Ports are disconnected as well. This method invokes removePeer() as well on the peers listed in this->getPeerList().

void RTT::TaskContext::disconnect (  )  [virtual]

Disconnect this TaskContext from it's peers and ports. All its Data Flow Ports are disconnected as well. This method invokes removePeer() as well on the peers listed in this->getPeerList().

Definition at line 286 of file TaskContext.cpp.

virtual void RTT::TaskContext::disconnectPeers ( const std::string &  name  )  [virtual]

Remove a two-way connection from this task to a peer task.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

void RTT::TaskContext::disconnectPeers ( const std::string &  name  )  [virtual]

Remove a two-way connection from this task to a peer task.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 307 of file TaskContext.cpp.

void RTT::TaskContext::forceActivity ( base::ActivityInterface new_act  )  [protected]

Forces the current activity to become new_act, even if this TaskContext is still running.

This can be used to bypass the isRunning() check regular setActivity() does.

void RTT::TaskContext::forceActivity ( base::ActivityInterface new_act  )  [protected]

Forces the current activity to become new_act, even if this TaskContext is still running.

This can be used to bypass the isRunning() check regular setActivity() does.

Definition at line 356 of file TaskContext.cpp.

template<typename T >
T* RTT::TaskContext::getActivity (  )  [inline]

Get a pointer to the activity running this component.

Unlike the non-template version, it converts it to the activity type provided.

Example usage in a startHook(): RTT::extras::FileDescriptorActivity* fd_activity = getActivity<RTT::extras::FileDescriptorActivity>(); if (fd_activity) { // do specific setup for FDActivity }

Returns:
Our activity if it is of type T, NULL otherwise.

Definition at line 173 of file rtt/TaskContext.hpp.

base::ActivityInterface* RTT::TaskContext::getActivity (  ) 

Get a pointer to the activity running this component.

Returns:
Our activity.
template<typename T >
T* RTT::TaskContext::getActivity (  )  [inline]

Get a pointer to the activity running this component.

Unlike the non-template version, it converts it to the activity type provided.

Example usage in a startHook(): RTT::extras::FileDescriptorActivity* fd_activity = getActivity<RTT::extras::FileDescriptorActivity>(); if (fd_activity) { // do specific setup for FDActivity }

Returns:
Our activity if it is of type T, NULL otherwise.

Definition at line 127 of file install/include/rtt/TaskContext.hpp.

ActivityInterface * RTT::TaskContext::getActivity (  ) 

Get a pointer to the activity running this component.

Returns:
Our activity.

Definition at line 367 of file TaskContext.cpp.

base::AttributeBase* RTT::TaskContext::getAttribute ( const std::string &  name  )  const [inline]

Definition at line 443 of file rtt/TaskContext.hpp.

base::AttributeBase* RTT::TaskContext::getAttribute ( const std::string &  name  )  const [inline]

Definition at line 397 of file install/include/rtt/TaskContext.hpp.

virtual const std::string& RTT::TaskContext::getName ( void   )  [inline, virtual]

Returns the name of this TaskContext.

Definition at line 128 of file rtt/TaskContext.hpp.

virtual const std::string& RTT::TaskContext::getName (  )  [inline, virtual]

Returns the name of this TaskContext.

Definition at line 82 of file install/include/rtt/TaskContext.hpp.

OperationInterfacePart* RTT::TaskContext::getOperation ( std::string  name  )  [inline]

Get a previously added operation for use in a C++ OperationCaller object. Store the result of this function in a OperationCaller<Signature> object.

Parameters:
name The name of the operation to retrieve.
Returns:
true if it could be found, false otherwise.

Definition at line 376 of file rtt/TaskContext.hpp.

OperationInterfacePart* RTT::TaskContext::getOperation ( std::string  name  )  [inline]

Get a previously added operation for use in a C++ OperationCaller object. Store the result of this function in a OperationCaller<Signature> object.

Parameters:
name The name of the operation to retrieve.
Returns:
true if it could be found, false otherwise.

Definition at line 330 of file install/include/rtt/TaskContext.hpp.

virtual TaskContext* RTT::TaskContext::getPeer ( const std::string &  peer_name  )  const [virtual]

Get a pointer to a peer of this task.

Returns:
null if no such peer.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

TaskContext * RTT::TaskContext::getPeer ( const std::string &  peer_name  )  const [virtual]

Get a pointer to a peer of this task.

Returns:
null if no such peer.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 330 of file TaskContext.cpp.

virtual PeerList RTT::TaskContext::getPeerList (  )  const [virtual]

Return a standard container which contains all the Peer names of this TaskContext.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

std::vector< std::string > RTT::TaskContext::getPeerList (  )  const [virtual]

Return a standard container which contains all the Peer names of this TaskContext.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 316 of file TaskContext.cpp.

base::PortInterface* RTT::TaskContext::getPort ( const std::string &  name  )  const [inline]

Get a port of this Component.

Parameters:
name The port name
Returns:
a pointer to a port or null if it does not exist.

Definition at line 561 of file rtt/TaskContext.hpp.

base::PortInterface* RTT::TaskContext::getPort ( const std::string &  name  )  const [inline]

Get a port of this Component.

Parameters:
name The port name
Returns:
a pointer to a port or null if it does not exist.

Definition at line 515 of file install/include/rtt/TaskContext.hpp.

base::PropertyBase* RTT::TaskContext::getProperty ( const std::string &  name  )  const [inline]

Get a Property with name name.

Parameters:
name The name of the property to search for.
Returns:
The Property with this name, zero if it does not exist

Definition at line 491 of file rtt/TaskContext.hpp.

base::PropertyBase* RTT::TaskContext::getProperty ( const std::string &  name  )  const [inline]

Get a Property with name name.

Parameters:
name The name of the property to search for.
Returns:
The Property with this name, zero if it does not exist

Definition at line 445 of file install/include/rtt/TaskContext.hpp.

template<class ServiceType >
boost::shared_ptr<ServiceType> RTT::TaskContext::getProvider ( const std::string &  name  )  [inline]

Use this method to be able to make OperationCaller calls to services provided by this component. In case the service does not exist in this component, it tries to load the service using the plugin::PluginLoader class. If all fails, a null pointer is returned.

For example: getProvider<Scripting>("scripting")->loadPrograms("file.ops");

Parameters:
name The name of the service to get, must have been added with addService.
ServiceType the ServiceRequester type to use. Must have a constructor that takes TaskContext* as argument.
Returns:
a shared ServiceRequester object which allows to call the operations provided by service name.

Definition at line 309 of file rtt/TaskContext.hpp.

template<class ServiceType >
boost::shared_ptr<ServiceType> RTT::TaskContext::getProvider ( const std::string &  name  )  [inline]

Use this method to be able to make OperationCaller calls to services provided by this component. In case the service does not exist in this component, it tries to load the service using the plugin::PluginLoader class. If all fails, a null pointer is returned.

For example: getProvider<Scripting>("scripting")->loadPrograms("file.ops");

Parameters:
name The name of the service to get, must have been added with addService.
ServiceType the ServiceRequester type to use. Must have a constructor that takes TaskContext* as argument.
Returns:
a shared ServiceRequester object which allows to call the operations provided by service name.

Definition at line 263 of file install/include/rtt/TaskContext.hpp.

virtual bool RTT::TaskContext::hasPeer ( const std::string &  peer_name  )  const [virtual]

Return true if it knows a peer by that name.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskContext::hasPeer ( const std::string &  peer_name  )  const [virtual]

Return true if it knows a peer by that name.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 325 of file TaskContext.cpp.

OperationInterface* RTT::TaskContext::operations (  )  [inline]

Returns the operations of this TaskContext as an OperationInterface.

Definition at line 384 of file rtt/TaskContext.hpp.

OperationInterface* RTT::TaskContext::operations (  )  [inline]

Returns the operations of this TaskContext as an OperationInterface.

Definition at line 338 of file install/include/rtt/TaskContext.hpp.

const DataFlowInterface* RTT::TaskContext::ports ( void   )  const [inline]

Get the Data flow ports of this task.

Definition at line 576 of file rtt/TaskContext.hpp.

DataFlowInterface* RTT::TaskContext::ports ( void   )  [inline]

Get the Data flow ports of this task.

Definition at line 569 of file rtt/TaskContext.hpp.

const DataFlowInterface* RTT::TaskContext::ports (  )  const [inline]

Get the Data flow ports of this task.

Definition at line 530 of file install/include/rtt/TaskContext.hpp.

DataFlowInterface* RTT::TaskContext::ports (  )  [inline]

Get the Data flow ports of this task.

Definition at line 523 of file install/include/rtt/TaskContext.hpp.

bool RTT::TaskContext::prepareProvide ( const std::string &  name  )  [private]

Check if this component could provide a given service, either by already providing it (hasService(name)==true), or by loading its service. If this function returns true, getProvider() will return a non-null object given the correct ServiceType.

bool RTT::TaskContext::prepareProvide ( const std::string &  name  )  [private]

Check if this component could provide a given service, either by already providing it (hasService(name)==true), or by loading its service. If this function returns true, getProvider() will return a non-null object given the correct ServiceType.

Definition at line 229 of file TaskContext.cpp.

void RTT::TaskContext::prepareUpdateHook (  )  [private, virtual]

Function that is called before updateHook, where the TC implementation can do bookkeeping with regard to event ports.

Reimplemented from RTT::base::TaskCore.

void RTT::TaskContext::prepareUpdateHook (  )  [private, virtual]

Function that is called before updateHook, where the TC implementation can do bookkeeping with regard to event ports.

Reimplemented from RTT::base::TaskCore.

Definition at line 438 of file TaskContext.cpp.

PropertyBag* RTT::TaskContext::properties (  )  [inline]

Returns the properties of this TaskContext as a PropertyBag.

Definition at line 499 of file rtt/TaskContext.hpp.

PropertyBag* RTT::TaskContext::properties (  )  [inline]

Returns the properties of this TaskContext as a PropertyBag.

Definition at line 453 of file install/include/rtt/TaskContext.hpp.

Service::shared_ptr RTT::TaskContext::provides ( const std::string &  service_name  )  [inline]

Returns a sub-Service which resorts under this Service.

Parameters:
service_name The name of the sub-service.

Definition at line 275 of file rtt/TaskContext.hpp.

Service::shared_ptr RTT::TaskContext::provides (  )  [inline]

Returns this Service.

Returns:
a shared pointer from this.

Definition at line 268 of file rtt/TaskContext.hpp.

Service::shared_ptr RTT::TaskContext::provides ( const std::string &  service_name  )  [inline]

Returns a sub-Service which resorts under this Service.

Parameters:
service_name The name of the sub-service.

Definition at line 229 of file install/include/rtt/TaskContext.hpp.

Service::shared_ptr RTT::TaskContext::provides (  )  [inline]

Returns this Service.

Returns:
a shared pointer from this.

Definition at line 222 of file install/include/rtt/TaskContext.hpp.

virtual bool RTT::TaskContext::ready (  )  [virtual]

Checks the validity of this TaskContext. When this method returns false, the TaskContext should not be used and various methods may throw exceptions. Use this in case the TaskContext could be a remote object. Will always return true when this TaskContext is local.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskContext::ready (  )  [virtual]

Checks the validity of this TaskContext. When this method returns false, the TaskContext should not be used and various methods may throw exceptions. Use this in case the TaskContext could be a remote object. Will always return true when this TaskContext is local.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 379 of file TaskContext.cpp.

virtual void RTT::TaskContext::removePeer ( TaskContext peer  )  [virtual]

Remove a one-way connection from this task to a peer task.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

virtual void RTT::TaskContext::removePeer ( const std::string &  name  )  [virtual]

Remove a one-way connection from this task to a peer task.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

void RTT::TaskContext::removePeer ( TaskContext peer  )  [virtual]

Remove a one-way connection from this task to a peer task.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 266 of file TaskContext.cpp.

void RTT::TaskContext::removePeer ( const std::string &  name  )  [virtual]

Remove a one-way connection from this task to a peer task.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 257 of file TaskContext.cpp.

void RTT::TaskContext::removeUser ( TaskContext user  )  [private]

Inform this TaskContext that user is no longer using our services.

void RTT::TaskContext::removeUser ( TaskContext user  )  [private]

Inform this TaskContext that user is no longer using our services.

Definition at line 239 of file TaskContext.cpp.

ServiceRequester* RTT::TaskContext::requires ( const std::string &  service_name  )  [inline]

Returns the object that manages which methods this Task requires to be implemented by another service.

Definition at line 287 of file rtt/TaskContext.hpp.

ServiceRequester* RTT::TaskContext::requires (  )  [inline]

Returns the object that manages which methods this Task requires to be implemented by another task.

Definition at line 281 of file rtt/TaskContext.hpp.

ServiceRequester* RTT::TaskContext::requires ( const std::string &  service_name  )  [inline]

Returns the object that manages which methods this Task requires to be implemented by another service.

Definition at line 241 of file install/include/rtt/TaskContext.hpp.

ServiceRequester* RTT::TaskContext::requires (  )  [inline]

Returns the object that manages which methods this Task requires to be implemented by another task.

Definition at line 235 of file install/include/rtt/TaskContext.hpp.

bool RTT::TaskContext::setActivity ( base::ActivityInterface new_act  ) 

Sets the activity of this TaskContext. The activity is owned by the TaskContext and you should not hold a pointer to it after this call. Use getActivity() lateron to retrieve a safe pointer to it.

Parameters:
new_act The new activity for this TaskContext, which becomes owned by this TaskContext, in case this method returns true.
Returns:
false if this->isRunning(). You can not change the activity of a TaskContext once it is running. In that case, new_act is not destroyed.
Note:
This function may not be called from the current ExecutionEngine thread (OwnThread), another thread (ClientThread) must call this function.
bool RTT::TaskContext::setActivity ( base::ActivityInterface new_act  ) 

Sets the activity of this TaskContext. The activity is owned by the TaskContext and you should not hold a pointer to it after this call. Use getActivity() lateron to retrieve a safe pointer to it.

Parameters:
new_act The new activity for this TaskContext, which becomes owned by this TaskContext, in case this method returns true.
Returns:
false if this->isRunning(). You can not change the activity of a TaskContext once it is running. In that case, new_act is not destroyed.
Note:
This function may not be called from the current ExecutionEngine thread (OwnThread), another thread (ClientThread) must call this function.

Definition at line 337 of file TaskContext.cpp.

void RTT::TaskContext::setup (  )  [private]

Internal function to setup the 'this' service and activity.

void RTT::TaskContext::setup (  )  [private]

Internal function to setup the 'this' service and activity.

Definition at line 96 of file TaskContext.cpp.

virtual bool RTT::TaskContext::start ( void   )  [virtual]

This method starts the execution of the updateHook() with each trigger or period. This function calls the user function startHook(), which must return true in order to allow this component to run.

Return values:
false 
  • if startHook() returned false
  • if the component was not Stopped
true if the Running state was entered.

Reimplemented from RTT::base::TaskCore.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskContext::start (  )  [virtual]

This method starts the execution of the updateHook() with each trigger or period. This function calls the user function startHook(), which must return true in order to allow this component to run.

Return values:
false 
  • if startHook() returned false
  • if the component was not Stopped
true if the Running state was entered.

Reimplemented from RTT::base::TaskCore.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 392 of file TaskContext.cpp.

virtual bool RTT::TaskContext::stop ( void   )  [virtual]

This method stops the execution of updateHook() of this component. You can override this method to do something else or in addition. This function calls stopHook() as well.

Returns:
false if the component was not Running or not Active.

Reimplemented from RTT::base::TaskCore.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

bool RTT::TaskContext::stop (  )  [virtual]

This method stops the execution of updateHook() of this component. You can override this method to do something else or in addition. This function calls stopHook() as well.

Returns:
false if the component was not Running or not Active.

Reimplemented from RTT::base::TaskCore.

Reimplemented in RTT::corba::TaskContextProxy, and RTT::corba::TaskContextProxy.

Definition at line 400 of file TaskContext.cpp.


Friends And Related Function Documentation

Definition at line 575 of file install/include/rtt/TaskContext.hpp.


Member Data Documentation

map of the tasks we are using

Definition at line 554 of file install/include/rtt/TaskContext.hpp.

Definition at line 616 of file install/include/rtt/TaskContext.hpp.

Definition at line 620 of file install/include/rtt/TaskContext.hpp.

map of the tasks that are using us.

Definition at line 556 of file install/include/rtt/TaskContext.hpp.

This pointer tracks our activity which is set by setActivity. By default, a extras::SequentialActivity is assigned.

Definition at line 629 of file install/include/rtt/TaskContext.hpp.

Definition at line 576 of file install/include/rtt/TaskContext.hpp.

Definition at line 619 of file install/include/rtt/TaskContext.hpp.

Definition at line 618 of file install/include/rtt/TaskContext.hpp.

Definition at line 578 of file install/include/rtt/TaskContext.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


rtt
Author(s): RTT Developers
autogenerated on Fri Jan 11 09:49:49 2013