Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
RTT::TaskContext Class Reference

#include <TaskContext.hpp>

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

Public Types

typedef std::vector< std::string > PeerList
 
- Public Types inherited from RTT::base::TaskCore
enum  TaskState {
  Init, PreOperational, FatalError, Exception,
  Stopped, Running, RunTimeError
}
 

Public Member Functions

virtual void clear ()
 
base::ActivityInterfacegetActivity ()
 
template<typename T >
T * getActivity ()
 
virtual const std::string & getName () const
 
virtual bool ready ()
 
bool setActivity (base::ActivityInterface *new_act)
 
virtual bool start ()
 
virtual bool stop ()
 
 TaskContext (const std::string &name, TaskState initial_state=Stopped)
 
virtual ~TaskContext ()
 
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 void removePeer (const std::string &name)
 
virtual void removePeer (TaskContext *peer)
 
virtual bool connectPeers (TaskContext *peer)
 
virtual void disconnect ()
 
virtual void disconnectPeers (const std::string &name)
 
virtual PeerList getPeerList () const
 
virtual bool hasPeer (const std::string &peer_name) const
 
virtual TaskContextgetPeer (const std::string &peer_name) const
 
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.

Service::shared_ptr provides ()
 
Service::shared_ptr provides (const std::string &service_name)
 
ServiceRequester::shared_ptr requires ()
 
ServiceRequester::shared_ptr requires (const std::string &service_name)
 
virtual bool connectServices (TaskContext *peer)
 
template<class ServiceType >
boost::shared_ptr< ServiceType > getProvider (const std::string &name)
 
bool loadService (const std::string &service_name)
 
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 (Operation< Signature > &op)
 
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 (const std::string name, Signature *func, ExecutionThread et=ClientThread)
 
OperationInterfacePartgetOperation (std::string name)
 
OperationInterfaceoperations ()
 
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.

template<class T >
bool addAttribute (const std::string &name, T &attr)
 
template<class T >
bool addConstant (const std::string &name, const T &attr)
 
bool addAttribute (base::AttributeBase &a)
 
base::AttributeBasegetAttribute (const std::string &name) const
 
ConfigurationInterfaceattributes ()
 
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.

template<class T >
Property< T > & addProperty (const std::string &name, T &attr)
 
bool addProperty (base::PropertyBase &pb)
 
base::PropertyBasegetProperty (const std::string &name) const
 
PropertyBagproperties ()
 
- Public Member Functions inherited from RTT::base::TaskCore
const ExecutionEngineengine () const
 
ExecutionEngineengine ()
 
unsigned int getCycleCounter () const
 
unsigned int getIOCounter () const
 
virtual TaskState getTargetState () const
 
virtual TaskState getTaskState () const
 
unsigned int getTimeOutCounter () const
 
unsigned int getTriggerCounter () const
 
 TaskCore (TaskState initial_state=Stopped, const std::string &name=std::string())
 
virtual ~TaskCore ()
 
virtual bool configure ()
 
virtual bool activate ()
 
virtual bool cleanup ()
 
virtual bool isConfigured () const
 
virtual bool isActive () const
 
virtual bool isRunning () const
 
virtual Seconds getPeriod () const
 
virtual bool setPeriod (Seconds s)
 
virtual unsigned getCpuAffinity () const
 
virtual bool setCpuAffinity (unsigned cpu)
 
virtual bool inFatalError () const
 
virtual bool inException () const
 
virtual bool inRunTimeError () const
 
virtual bool update ()
 
virtual bool trigger ()
 
virtual void error ()
 
virtual bool recover ()
 

Protected Member Functions

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 bool configureHook ()
 
virtual void errorHook ()
 
virtual void exception ()
 
virtual void exceptionHook ()
 
virtual void fatal ()
 
virtual bool startHook ()
 
virtual void stopHook ()
 
virtual void updateHook ()
 

Private Types

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

Private Member Functions

void addUser (TaskContext *user)
 
void dataOnPort (base::PortInterface *port)
 
bool prepareProvide (const std::string &name)
 
void removeDataOnPortCallback (base::PortInterface *port)
 
void removeUser (TaskContext *user)
 
void setDataOnPortCallback (base::InputPortInterface *port, SlotFunction callback)
 
void setup ()
 
 TaskContext (TaskContext &)
 

Private Attributes

PeerMap _task_map
 map of the tasks we are using More...
 
LocalServices localservs
 
os::Mutex mportlock
 
Users musers
 map of the tasks that are using us. More...
 
base::ActivityInterface::shared_ptr our_act
 
ServiceRequester::shared_ptr tcrequests
 
Service::shared_ptr tcservice
 
UserCallbacks user_callbacks
 

Friends

class DataFlowInterface
 
class ExecutionEngine
 

Ports

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

typedef boost::function< void(base::PortInterface *)> SlotFunction
 
base::PortInterfaceaddPort (const std::string &name, base::PortInterface &port)
 
base::PortInterfaceaddPort (base::PortInterface &port)
 
base::InputPortInterfaceaddEventPort (const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 
base::InputPortInterfaceaddEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 
base::PortInterfacegetPort (const std::string &name) const
 
DataFlowInterfaceports ()
 
const DataFlowInterfaceports () const
 
virtual bool connectPorts (TaskContext *peer)
 

Additional Inherited Members

- 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
 

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 93 of file TaskContext.hpp.

Member Typedef Documentation

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

Definition at line 680 of file TaskContext.hpp.

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

A list of Peer TaskContext names.

Definition at line 100 of file TaskContext.hpp.

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

Definition at line 627 of file TaskContext.hpp.

typedef boost::function<void(base::PortInterface*)> RTT::TaskContext::SlotFunction

Definition at line 527 of file TaskContext.hpp.

Definition at line 652 of file TaskContext.hpp.

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

Definition at line 628 of file 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
nameThe name of this component.
initial_stateProvide 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 ( )
virtual

Definition at line 119 of file TaskContext.cpp.

RTT::TaskContext::TaskContext ( TaskContext )
private

Member Function Documentation

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
nameThe name of this attribute
attrThe variable that will be aliased.

Definition at line 401 of file 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
aremains owned by the user, and becomes served by the repository.

Definition at line 427 of file 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
nameThe name of this attribute
attrThe variable that will be aliased.

Definition at line 414 of file TaskContext.hpp.

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

Parameters
nameThe name to give to the port.
portThe 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 537 of file TaskContext.hpp.

base::InputPortInterface& RTT::TaskContext::addEventPort ( base::InputPortInterface port,
SlotFunction  callback = 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
portThe 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 550 of file 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
opThe operation object to add.
Returns
true if it could be added.

Definition at line 337 of file 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 348 of file 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 359 of file TaskContext.hpp.

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

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

Parameters
peerThe peer to add.
aliasAn optional alias (another name) for the peer. defaults to peer->getName()

Reimplemented in RTT::corba::TaskContextProxy.

Definition at line 249 of file TaskContext.cpp.

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
nameThe name to give to the port.
portThe port to add.

Definition at line 513 of file 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
portThe port to add.

Definition at line 523 of file 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
nameThe name of this property
attrThe variable that will be aliased.
Returns
the Property object by reference, which you can further query or document.

Definition at line 469 of file 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 477 of file TaskContext.hpp.

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

Inform this TaskContext that user is using our services.

Definition at line 236 of file TaskContext.cpp.

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

Returns the attributes of this TaskContext as an ConfigurationInterface.

Definition at line 448 of file TaskContext.hpp.

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 397 of file TaskContext.cpp.

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

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

Reimplemented in RTT::corba::TaskContextProxy.

Definition at line 279 of file TaskContext.cpp.

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.

Definition at line 151 of file TaskContext.cpp.

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.

Definition at line 188 of file TaskContext.cpp.

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

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

Definition at line 439 of file TaskContext.cpp.

void RTT::TaskContext::dataOnPortCallback ( base::PortInterface port)
protectedvirtual

This method implements port callbacks. It will be called once per sample received on the port and is executed in the component's thread.

The default implementation invokes the user callback if one was given in the addEventPort() call. It can be overwritten in a subclass to react on incoming data for all event ports. This is equivalent to adding this function as a user callback on each of the ports individually.

Definition at line 450 of file TaskContext.cpp.

bool RTT::TaskContext::dataOnPortHook ( base::PortInterface port)
protectedvirtual

Reimplement this method to influence how writing to event ports is handled by the component. This method will be executed in the writer's thread.

The default implementation returns true if and only if the component is running.

Return values
trueto indicate that the user callback should be invoked and trigger the component
falseto ignore the new data and not trigger the component or invoke a user callback

Definition at line 446 of file TaskContext.cpp.

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 289 of file TaskContext.cpp.

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.

Definition at line 310 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.

Definition at line 377 of file TaskContext.cpp.

ActivityInterface * RTT::TaskContext::getActivity ( )

Get a pointer to the activity running this component.

Returns
Our activity.

Definition at line 390 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 163 of file TaskContext.hpp.

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

Definition at line 440 of file TaskContext.hpp.

virtual const std::string& RTT::TaskContext::getName ( ) const
inlinevirtual

Returns the name of this TaskContext.

Definition at line 117 of file 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
nameThe name of the operation to retrieve.
Returns
true if it could be found, false otherwise.

Definition at line 373 of file TaskContext.hpp.

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.

Definition at line 333 of file TaskContext.cpp.

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.

Definition at line 319 of file TaskContext.cpp.

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

Get a port of this Component.

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

Definition at line 559 of file TaskContext.hpp.

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

Get a Property with name name.

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

Definition at line 488 of file 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
nameThe name of the service to get, must have been added with addService.
ServiceTypethe 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 299 of file TaskContext.hpp.

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.

Definition at line 328 of file TaskContext.cpp.

bool RTT::TaskContext::loadService ( const std::string &  service_name)

Use this method to load a service known to RTT into this component.

Parameters
service_nameThe name with which the service is registered by in the PluginLoader.
Returns
true if the service was present already or could be loaded.

Definition at line 230 of file TaskContext.cpp.

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

Returns the operations of this TaskContext as an OperationInterface.

Definition at line 381 of file TaskContext.hpp.

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

Get the Data flow ports of this task.

Definition at line 567 of file TaskContext.hpp.

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

Get the Data flow ports of this task.

Definition at line 574 of file 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.

Definition at line 226 of file TaskContext.cpp.

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

Returns the properties of this TaskContext as a PropertyBag.

Definition at line 496 of file TaskContext.hpp.

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

Returns this Service.

Returns
a shared pointer from this.

Definition at line 258 of file 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_nameThe name of the sub-service.

Definition at line 265 of file TaskContext.hpp.

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 OperationCallerComponent.

Definition at line 403 of file TaskContext.cpp.

void RTT::TaskContext::removeDataOnPortCallback ( base::PortInterface port)
private

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

Definition at line 462 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.

Definition at line 260 of file TaskContext.cpp.

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

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

Reimplemented in RTT::corba::TaskContextProxy.

Definition at line 269 of file TaskContext.cpp.

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

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

Definition at line 242 of file TaskContext.cpp.

ServiceRequester::shared_ptr RTT::TaskContext::requires ( )
inline

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

Definition at line 271 of file TaskContext.hpp.

ServiceRequester::shared_ptr 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 277 of file 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_actThe new activity for this TaskContext, which becomes owned by this TaskContext, in case this method returns true.
Returns
false if this->isRunning() or if called by the thread that currently executes this activity and that would need to be stopped. You cannot 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 340 of file TaskContext.cpp.

void RTT::TaskContext::setDataOnPortCallback ( base::InputPortInterface port,
TaskContext::SlotFunction  callback 
)
private

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

Definition at line 456 of file TaskContext.cpp.

void RTT::TaskContext::setup ( )
private

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

Definition at line 82 of file TaskContext.cpp.

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
trueif the Running state was entered.

Reimplemented from RTT::base::TaskCore.

Reimplemented in RTT::corba::TaskContextProxy.

Definition at line 416 of file TaskContext.cpp.

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.

Definition at line 426 of file TaskContext.cpp.

Friends And Related Function Documentation

friend class DataFlowInterface
friend

Definition at line 651 of file TaskContext.hpp.

friend class ExecutionEngine
friend

Definition at line 623 of file TaskContext.hpp.

Member Data Documentation

PeerMap RTT::TaskContext::_task_map
private

map of the tasks we are using

Definition at line 630 of file TaskContext.hpp.

LocalServices RTT::TaskContext::localservs
private

Definition at line 681 of file TaskContext.hpp.

os::Mutex RTT::TaskContext::mportlock
private

Definition at line 685 of file TaskContext.hpp.

Users RTT::TaskContext::musers
private

map of the tasks that are using us.

Definition at line 632 of file TaskContext.hpp.

base::ActivityInterface::shared_ptr RTT::TaskContext::our_act
private

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

Definition at line 694 of file TaskContext.hpp.

ServiceRequester::shared_ptr RTT::TaskContext::tcrequests
private

Definition at line 684 of file TaskContext.hpp.

Service::shared_ptr RTT::TaskContext::tcservice
private

Definition at line 683 of file TaskContext.hpp.

UserCallbacks RTT::TaskContext::user_callbacks
private

Definition at line 653 of file TaskContext.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:41