Orocos Real-Time Toolkit  2.9.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
RTT::corba::TaskContextProxy Class Reference

This class manages the access of remote TaskContext Corba Servers and a Corba Object Request Broker (Orb) which connects to these servers. More...

#include <rtt/transports/corba/TaskContextProxy.hpp>

Inheritance diagram for RTT::corba::TaskContextProxy:
RTT::TaskContext RTT::corba::ApplicationServer RTT::base::TaskCore

Public Types

typedef std::map< TaskContextProxy *, corba::CTaskContext_ptr > PMap
 
typedef std::vector< std::string > PeerList
 A list of Peer TaskContext names. More...
 
enum  TaskState {
  Init, PreOperational, FatalError, Exception,
  Stopped, Running, RunTimeError
}
 Describes the different states a component can have. More...
 

Public Member Functions

 ~TaskContextProxy ()
 
corba::CTaskContext_ptr server () const
 Get the Corba Object of the CTaskContext. More...
 
virtual bool activate ()
 This method starts the ExecutionEngine of this component in case it was not running. More...
 
virtual bool start ()
 This method starts the execution of the updateHook() with each trigger or period. More...
 
virtual bool stop ()
 This method stops the execution of updateHook() of this component. More...
 
virtual bool isRunning () const
 Inspect if the component is in the Running or RunTimeError state. More...
 
virtual bool configure ()
 This method instructs the component to (re-)read configuration data and try to enter the Stopped state. More...
 
virtual bool cleanup ()
 This method instructs a stopped component to enter the pre-operational state again. More...
 
virtual bool recover ()
 Call this method in a RunTimeError or Exception state to indicate that the run-time error conditions are gone and nominal operation is resumed. More...
 
virtual bool isActive () const
 Inspect if the component's ExecutionEngine is processing requests. More...
 
virtual bool isConfigured () const
 Inspect if the component is configured, i.e. More...
 
virtual bool inFatalError () const
 Inspect if the component is in the FatalError state. More...
 
virtual bool inRunTimeError () const
 Inspect if the component is in the RunTimeError state. More...
 
virtual bool inException () const
 Inspect if the component is in the Exception state. More...
 
virtual TaskState getTaskState () const
 Returns the current state of the TaskCore. More...
 
virtual void setName (const std::string &n)
 
virtual bool addPeer (TaskContext *peer, std::string alias="")
 Add a one-way connection from this task to a peer task. More...
 
virtual void removePeer (const std::string &name)
 Remove a one-way connection from this task to a peer task. More...
 
virtual void removePeer (TaskContext *peer)
 Remove a one-way connection from this task to a peer task. More...
 
virtual bool connectPeers (TaskContext *peer)
 Add a two-way connection from this task to a peer task. More...
 
virtual void disconnectPeers (const std::string &name)
 Remove a two-way connection from this task to a peer task. More...
 
virtual PeerList getPeerList () const
 Return a standard container which contains all the Peer names of this TaskContext. More...
 
virtual bool hasPeer (const std::string &peer_name) const
 Return true if it knows a peer by that name. More...
 
virtual TaskContextgetPeer (const std::string &peer_name) const
 Get a pointer to a peer of this task. More...
 
virtual bool connectPorts (TaskContext *peer)
 Add a data flow connection from this task's ports to a peer's ports. More...
 
virtual bool connectServices (TaskContext *peer)
 Connects all requires/provides services of this component to these of a peer. More...
 
virtual bool ready ()
 Checks the validity of this TaskContext. More...
 
virtual const std::string & getName () const
 Returns the name of this TaskContext. More...
 
bool setActivity (base::ActivityInterface *new_act)
 Sets the activity of this TaskContext. More...
 
base::ActivityInterfacegetActivity ()
 Get a pointer to the activity running this component. More...
 
template<typename T >
T * getActivity ()
 Get a pointer to the activity running this component. More...
 
virtual void clear ()
 Clear the complete interface of this Component. More...
 
virtual TaskState getTargetState () const
 Returns the state this TaskCore is going to, or in case no transition is taking place, returns getTaskState(). More...
 
const ExecutionEngineengine () const
 Get a const pointer to the ExecutionEngine of this Task. More...
 
ExecutionEngineengine ()
 Get a pointer to the ExecutionEngine of this Task. More...
 
unsigned int getCycleCounter () const
 For each update cycle, this counter increments by one. More...
 
unsigned int getTriggerCounter () const
 Number of cycles that were caused by Trigger triggers. More...
 
unsigned int getIOCounter () const
 Number of cycles that were caused by IOReady triggers. More...
 
unsigned int getTimeOutCounter () const
 Number of cycles that were caused by TimeOut triggers. More...
 
Peer-to-Peer functions

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

virtual void disconnect ()
 Disconnect this TaskContext from it's peers and ports. More...
 
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 ()
 Returns this Service. More...
 
Service::shared_ptr provides (const std::string &service_name)
 Returns a sub-Service which resorts under this Service. More...
 
ServiceRequester::shared_ptr requires ()
 Returns the object that manages which methods this Task requires to be implemented by another task. More...
 
ServiceRequester::shared_ptr requires (const std::string &service_name)
 Returns the object that manages which methods this Task requires to be implemented by another service. More...
 
template<class ServiceType >
boost::shared_ptr< ServiceType > getProvider (const std::string &name)
 Use this method to be able to make OperationCaller calls to services provided by this component. More...
 
bool loadService (const std::string &service_name)
 Use this method to load a service known to RTT into this component. More...
 
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)
 Add an operation object to the interface. More...
 
template<class Func , class Service >
Operation< typename internal::GetSignature< Func >::Signature > & addOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread)
 Adds a C++ function as an operation. More...
 
template<class Signature >
Operation< Signature > & addOperation (const std::string name, Signature *func, ExecutionThread et=ClientThread)
 Adds a C function as an operation. More...
 
OperationInterfacePartgetOperation (std::string name)
 Get a previously added operation for use in a C++ OperationCaller object. More...
 
OperationInterfaceoperations ()
 Returns the operations of this TaskContext as an OperationInterface. More...
 
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)
 Adds a variable of any type as read/write attribute to the attribute interface. More...
 
bool addAttribute (base::AttributeBase &a)
 Add an base::AttributeBase which remains owned by the user. More...
 
template<class T >
bool addConstant (const std::string &name, const T &attr)
 Adds a variable of any type as read-only attribute to the attribute interface. More...
 
base::AttributeBasegetAttribute (const std::string &name) const
 Adds a variable of any type as read/write attribute to the attribute interface. More...
 
ConfigurationInterfaceattributes ()
 Returns the attributes of this TaskContext as an ConfigurationInterface. More...
 
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)
 Adds a variable of any type as a property to the attribute interface. More...
 
bool addProperty (base::PropertyBase &pb)
 Add an base::PropertyBase as a property. More...
 
base::PropertyBasegetProperty (const std::string &name) const
 Get a Property with name name. More...
 
PropertyBagproperties ()
 Returns the properties of this TaskContext as a PropertyBag. More...
 
Operations

These TaskCore functions are exported in a TaskContext as script methods and are for configuration, starting and stopping its ExecutionEngine.

virtual Seconds getPeriod () const
 Get the configured execution period of this component. More...
 
virtual bool setPeriod (Seconds s)
 Sets the period of this component. More...
 
virtual unsigned getCpuAffinity () const
 Get the configured cpu affinity of this component. More...
 
virtual bool setCpuAffinity (unsigned cpu)
 Sets the cpu affinity of this component. More...
 
virtual bool update ()
 Invoke this method to execute the ExecutionEngine and the update() method. More...
 
virtual bool trigger ()
 Invoke this method to trigger the thread of this TaskContext to execute its ExecutionEngine and the update() method. More...
 
virtual void error ()
 Call this method in a Running state to indicate a run-time error condition. More...
 

Static Public Member Functions

static void DestroyOrb ()
 Invoke this method once to cleanup the orb. More...
 
static TaskContextProxyCreate (std::string name, bool is_ior=false)
 Factory method: create a CORBA Proxy for an existing TaskContextServer. More...
 
static TaskContextProxyCreateFromFile (std::string filename)
 Factory method: create a CORBA Proxy for an existing TaskContextServer. More...
 
static TaskContextCreate (::RTT::corba::CTaskContext_ptr task, bool force_remote=false)
 Factory method: create a CORBA Proxy for an existing TaskContextServer. More...
 
static PortableServer::POA_ptr ProxyPOA ()
 Returns the default POA for all proxies. More...
 
static RTT_CORBA_API bool InitOrb (int argc, char *argv[], Seconds orb_timeout=0)
 Invoke this method once to initialise the Orb which will run the task servers. More...
 

Static Public Attributes

static PMap proxies
 
static CORBA::ORB_var orb
 The orb of this process. More...
 
static PortableServer::POA_var rootPOA
 The root POA of this process. More...
 

Protected Member Functions

 TaskContextProxy (std::string location, bool is_ior)
 Private constructor which creates a new connection to a stringified ior or taskname in NameServer. More...
 
 TaskContextProxy ()
 A Private constructor which does nothing. More...
 
 TaskContextProxy (::RTT::corba::CTaskContext_ptr t)
 Private constructor which creates a new connection to a corba object. More...
 
void initFromURIOrTaskname (std::string location, bool is_ior)
 initializes the class from a stringified ior or taskname in NameServer. More...
 
void synchronize ()
 
void synchronizeRequesters (ServiceRequester::shared_ptr parent, CServiceRequester_ptr csrq, const CServiceRequesterDescription &cdescription)
 
void synchronizeServices (Service::shared_ptr parent, CService_ptr serv, const CServiceDescription &cdescription)
 
void synchronizePorts (Service::shared_ptr parent, CDataFlowInterface_ptr dfact, const CServiceDescription &cdescription)
 
void forceActivity (base::ActivityInterface *new_act)
 Forces the current activity to become new_act, even if this TaskContext is still running. More...
 
virtual bool dataOnPortHook (base::PortInterface *port)
 Reimplement this method to influence how writing to event ports is handled by the component. More...
 
virtual void dataOnPortCallback (base::PortInterface *port)
 This method implements port callbacks. More...
 
virtual bool configureHook ()
 Implement this method such that it contains the code which will be executed when configure() is called. More...
 
virtual void cleanupHook ()
 Implement this method such that it contains the code which will be executed when cleanup() is called. More...
 
virtual bool startHook ()
 Implement this method such that it contains the code which will be executed when start() is called. More...
 
virtual void updateHook ()
 Function where the user must insert his 'application' code. More...
 
virtual bool breakUpdateHook ()
 Implement this function if your code might block for long times inside the updateHook() function. More...
 
virtual void errorHook ()
 Implement this method to contain code that must be executed in the RunTimeError state, instead of updateHook(). More...
 
virtual void exceptionHook ()
 Implement this method to contain code that must be executed when transitioning to the Exception state. More...
 
virtual void stopHook ()
 Implement this method such that it contains the code which will be executed when stop() is called. More...
 
virtual void fatal ()
 Call this method from any place to indicate that this component encountered a fatal error. More...
 
virtual void exception ()
 Call this method to indicate a run-time exception happend. More...
 

Protected Attributes

std::list< base::PortInterface * > port_proxies
 CDataFlowInterface does not delete ports automatically, because they can then be defined as members of the TaskContext classes. More...
 
corba::CTaskContext_var mtask
 
ExecutionEngineee
 The execution engine which calls update() and processes our commands, events etc. More...
 
TaskState mTaskState
 
bool mTriggerOnStart
 Set to false in order to not trigger() when calling start(). More...
 
unsigned int mCycleCounter
 For each update cycle, this counter increments by one. More...
 
unsigned int mIOCounter
 Number of cycles that were caused by IOReady triggers. More...
 
unsigned int mTimeOutCounter
 Number of cycles that were caused by TimeOut triggers. More...
 
unsigned int mTriggerCounter
 Number of cycles that were caused by Trigger triggers. More...
 

Static Protected Attributes

static PortableServer::POA_var proxy_poa
 For now one POA handles all proxies. More...
 

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
 Name and add a Port to the interface of this task and add a Service with the same name of the port. More...
 
base::PortInterfaceaddPort (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. More...
 
base::PortInterfaceaddPort (base::PortInterface &port)
 Add a Port to the interface of this task and add a Service with the same name of the port. More...
 
base::InputPortInterfaceaddEventPort (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. More...
 
base::InputPortInterfaceaddEventPort (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. More...
 
base::PortInterfacegetPort (const std::string &name) const
 Get a port of this Component. More...
 
DataFlowInterfaceports ()
 Get the Data flow ports of this task. More...
 
const DataFlowInterfaceports () const
 Get the Data flow ports of this task. More...
 

Detailed Description

This class manages the access of remote TaskContext Corba Servers and a Corba Object Request Broker (Orb) which connects to these servers.

Definition at line 82 of file TaskContextProxy.hpp.

Member Typedef Documentation

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

A list of Peer TaskContext names.

Definition at line 100 of file TaskContext.hpp.

typedef std::map<TaskContextProxy*, corba::CTaskContext_ptr> RTT::corba::TaskContextProxy::PMap

Definition at line 87 of file TaskContextProxy.hpp.

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

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

Member Enumeration Documentation

Describes the different states a component can have.

When a TaskContext is being constructed, it is in the Init state. After the construction ends, the component arrives in the PreOperational (additional configuration required) or the Stopped (ready to run) state. Invoking start() will make a transition to the Running state and stop() back to the Stopped state. The Running state executes updateHook(). Finally, there is an FatalError state, in which the component can enter by calling the protected method fatal(). In this state, the ExecutionEngine is stopped and updateHook() is no longer called. The object should then be disposed by a supervision system.

Next to the fatal error, one run-time error level is available in the Running state as well. This level allows 'automatic' recovery by the component in case the problem is temporal. In case of problems, one may call the protected method error() when the component is Running. The component will enter the RunTimeError state and will cause the errorHook() to be called instead of updateHook(). When recover() is called, this run-time error state is left and the nominal Running state is entered again.

In order to check if these transitions are allowed, hook functions are executed, which can be filled in by the component builder.

  • A transition from PreOperational to Stopped is checked by calling the configureHook() method. If this method returns true, the transition is made, otherwise, the state remains PreOperational.
  • A transition from Stopped to Running is checked by calling the startHook() method. If this method returns true, the transition is made, otherwise, the state remains Stopped.
  • A transition from Running to Stopped is always allowed and the stopHook() method is called to inform the component of this transtion.
  • A transition from Stopped to PreOperational is always allowed and the cleanupHook() method is called to inform the component of this transtion.
Enumerator
Init 

The state during component construction.

PreOperational 

The state indicating additional configuration is required.

FatalError 

The state indicating the component encountered a fatal error and is unable to execute.

Exception 

The state indicating the component encountered a C++ exception.

Stopped 

The state indicating the component is ready to run.

Running 

The state indicating the component is running [green].

RunTimeError 

The state indicating that a run-time error has occured [red] and needs attention.

Definition at line 99 of file TaskCore.hpp.

Constructor & Destructor Documentation

RTT::corba::TaskContextProxy::TaskContextProxy ( std::string  location,
bool  is_ior 
)
protected

Private constructor which creates a new connection to a stringified ior or taskname in NameServer.

Definition at line 94 of file TaskContextProxy.cpp.

References initFromURIOrTaskname().

RTT::corba::TaskContextProxy::TaskContextProxy ( )
protected

A Private constructor which does nothing.

Definition at line 100 of file TaskContextProxy.cpp.

Referenced by Create().

RTT::corba::TaskContextProxy::TaskContextProxy ( ::RTT::corba::CTaskContext_ptr  t)
protected

Private constructor which creates a new connection to a corba object.

Definition at line 172 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), CORBA_EXCEPTION_INFO, RTT::Error, RTT::TaskContext::forceActivity(), RTT::Logger::log(), mtask, RTT::Logger::nl(), RTT::TaskContext::provides(), proxies, and synchronize().

RTT::corba::TaskContextProxy::~TaskContextProxy ( )

Definition at line 82 of file TaskContextProxy.cpp.

References RTT::deletePropertyBag(), and RTT::Info.

Member Function Documentation

bool RTT::corba::TaskContextProxy::activate ( void  )
virtual

This method starts the ExecutionEngine of this component in case it was not running.

Normally, it is always running. There is no way to deactivate it from the public interface.

Returns
true if the ExecutionEngine is running (again) and false if it could not be started.

Reimplemented from RTT::base::TaskCore.

Definition at line 653 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), mtask, and setName().

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

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

Referenced by RTT::TaskContext::TaskContext().

bool RTT::TaskContext::addAttribute ( base::AttributeBase a)
inlineinherited

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

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

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

base::InputPortInterface& RTT::TaskContext::addEventPort ( const std::string &  name,
base::InputPortInterface port,
SlotFunction  callback = SlotFunction() 
)
inlineinherited

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

References RTT::base::PortInterface::setName().

base::InputPortInterface& RTT::TaskContext::addEventPort ( base::InputPortInterface port,
SlotFunction  callback = SlotFunction() 
)
inlineinherited

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

template<class Signature >
Operation<Signature>& RTT::TaskContext::addOperation ( Operation< Signature > &  op)
inlineinherited

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

Referenced by RTT_corba_CTaskContext_i::RTT_corba_CTaskContext_i(), and RTT::TaskContext::TaskContext().

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 
)
inlineinherited

Adds a C++ function as an operation.

See also
Service::addOperation

Definition at line 347 of file TaskContext.hpp.

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

Adds a C function as an operation.

See also
Service::addOperation

Definition at line 358 of file TaskContext.hpp.

bool RTT::corba::TaskContextProxy::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 from RTT::TaskContext.

Definition at line 766 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), RTT::corba::TaskContextServer::Create(), mtask, server(), RTT::corba::TaskContextServer::server(), setName(), and synchronize().

base::PortInterface& RTT::TaskContext::addPort ( const std::string &  name,
base::PortInterface port 
)
inlineinherited

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

References RTT::base::PortInterface::setName().

base::PortInterface& RTT::TaskContext::addPort ( base::PortInterface port)
inlineinherited

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

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

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

bool RTT::TaskContext::addProperty ( base::PropertyBase pb)
inlineinherited

Add an base::PropertyBase as a property.

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

Definition at line 476 of file TaskContext.hpp.

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

Returns the attributes of this TaskContext as an ConfigurationInterface.

Definition at line 447 of file TaskContext.hpp.

Referenced by RTT::scripting::ExpressionParser::getHandle().

bool RTT::TaskCore::breakUpdateHook ( )
protectedvirtualinherited

Implement this function if your code might block for long times inside the updateHook() function.

Insert in this hook the code to wake up that code or signal it otherwise that updateHook() is requested to return (for example by setting a flag). The method returns false by default.

Returns
true if well received and updateHook() will soon return. False otherwise.

Definition at line 297 of file TaskCore.cpp.

Referenced by RTT::ExecutionEngine::breakLoop().

bool RTT::corba::TaskContextProxy::cleanup ( void  )
virtual

This method instructs a stopped component to enter the pre-operational state again.

It calls cleanupHook().

Returns
true if the component was in the Stopped state.

Reimplemented from RTT::base::TaskCore.

Definition at line 697 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), mtask, and setName().

void RTT::TaskCore::cleanupHook ( )
protectedvirtualinherited

Implement this method such that it contains the code which will be executed when cleanup() is called.

The default implementation is an empty function.

Definition at line 233 of file TaskCore.cpp.

Referenced by RTT::base::TaskCore::cleanup(), and RTT::base::TaskCore::exception().

void RTT::TaskContext::clear ( )
virtualinherited

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

Referenced by activate(), addPeer(), cleanup(), configure(), connectPeers(), connectPorts(), connectServices(), disconnectPeers(), initFromURIOrTaskname(), ready(), recover(), removePeer(), start(), stop(), TaskContextProxy(), and RTT::TaskContext::~TaskContext().

bool RTT::corba::TaskContextProxy::configure ( void  )
virtual

This method instructs the component to (re-)read configuration data and try to enter the Stopped state.

This can only succeed if the component is not running and configureHook() returns true.

Reimplemented from RTT::base::TaskCore.

Definition at line 685 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), mtask, and setName().

bool RTT::TaskCore::configureHook ( )
protectedvirtualinherited

Implement this method such that it contains the code which will be executed when configure() is called.

The default implementation is an empty function which returns true.

Return values
trueto indicate that configuration succeeded and the Stopped state may be entered.
falseto indicate that configuration failed and the Preoperational state is entered.

Definition at line 281 of file TaskCore.cpp.

Referenced by RTT::base::TaskCore::configure().

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

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

Reimplemented from RTT::TaskContext.

Definition at line 821 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), RTT::corba::TaskContextServer::Create(), mtask, RTT::corba::TaskContextServer::server(), and setName().

bool RTT::corba::TaskContextProxy::connectPorts ( TaskContext peer)
virtual

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

Reimplemented from RTT::TaskContext.

Definition at line 890 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), RTT::corba::TaskContextServer::Create(), mtask, RTT::corba::TaskContextServer::server(), and setName().

bool RTT::corba::TaskContextProxy::connectServices ( TaskContext peer)
virtual

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

Reimplemented from RTT::TaskContext.

Definition at line 905 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), RTT::corba::TaskContextServer::Create(), mtask, RTT::corba::TaskContextServer::server(), and setName().

TaskContextProxy * RTT::corba::TaskContextProxy::Create ( std::string  name,
bool  is_ior = false 
)
static

Factory method: create a CORBA Proxy for an existing TaskContextServer.

Parameters
nameThe name of the TaskContextServer to connect to or the Object Reference of the object to connect to
is_iorset to true if name is an IOR. Defaults to false.
Return values
0if the ORB is not initialised
Returns
A new or previously created CORBA proxy for name.

Definition at line 530 of file TaskContextProxy.cpp.

References CORBA_EXCEPTION_INFO, RTT::Error, RTT::Logger::nl(), RTT::corba::ApplicationServer::orb, TaskContextProxy(), and RTT::corba::IllegalServer::what().

Referenced by RTT::corba::TaskContextFactory::Create(), CreateFromFile(), getPeer(), and RTT::corba::AnyConversion< RTT::TaskContext * >::update().

TaskContext * RTT::corba::TaskContextProxy::Create ( ::RTT::corba::CTaskContext_ptr  task,
bool  force_remote = false 
)
static

Factory method: create a CORBA Proxy for an existing TaskContextServer.

This method may in fact return the real TaskContext in case the servant of task is in the same process.

Parameters
taskThe Object to create a proxy for.
Return values
0if the ORB is not initialised
Returns
A new or previously created CORBA proxy for task, or the TaskContext itself.

Definition at line 570 of file TaskContextProxy.cpp.

References CORBA_EXCEPTION_INFO, RTT::Debug, RTT::Error, RTT::Logger::nl(), RTT::corba::ApplicationServer::orb, proxies, RTT::corba::TaskContextServer::servers, TaskContextProxy(), and RTT::corba::IllegalServer::what().

TaskContextProxy * RTT::corba::TaskContextProxy::CreateFromFile ( std::string  filename)
static

Factory method: create a CORBA Proxy for an existing TaskContextServer.

Parameters
filenameA file containing an IOR which refers to the existing TaskContextServer.
Return values
0if the ORB is not initialised
Returns
A new or previously created CORBA proxy for filename.

Definition at line 553 of file TaskContextProxy.cpp.

References Create(), RTT::Error, and RTT::corba::ApplicationServer::orb.

Referenced by RTT::corba::TaskContextFactory::CreateFromFile().

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

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

Referenced by RTT::ExecutionEngine::processPortCallbacks().

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

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

References RTT::base::TaskCore::isRunning().

Referenced by RTT::TaskContext::stop().

void RTT::corba::TaskContextProxy::DestroyOrb ( )
static
void RTT::TaskContext::disconnect ( )
virtualinherited

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.

References RTT::TaskContext::getName(), RTT::DataFlowInterface::getPorts(), and RTT::TaskContext::ports().

void RTT::corba::TaskContextProxy::disconnectPeers ( const std::string &  name)
virtual

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

Reimplemented from RTT::TaskContext.

Definition at line 836 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), mtask, and setName().

const ExecutionEngine* RTT::base::TaskCore::engine ( ) const
inlineinherited
ExecutionEngine* RTT::base::TaskCore::engine ( )
inlineinherited

Get a pointer to the ExecutionEngine of this Task.

Definition at line 314 of file TaskCore.hpp.

void RTT::TaskCore::error ( )
virtualinherited

Call this method in a Running state to indicate a run-time error condition.

errorHook() will be called instead of updateHook(). If the error condition is solved, call recover().

Definition at line 140 of file TaskCore.cpp.

References RTT::base::TaskCore::mTaskState, RTT::base::TaskCore::Running, and RTT::base::TaskCore::RunTimeError.

Referenced by RTT::TaskContext::TaskContext().

void RTT::TaskCore::errorHook ( )
protectedvirtualinherited

Implement this method to contain code that must be executed in the RunTimeError state, instead of updateHook().

This allows you to specify the behaviour in an erroneous component. errorHook() is called as long as the component is not recover()'ed. After recover()'ed, the updateHook() is called again.

Definition at line 290 of file TaskCore.cpp.

Referenced by RTT::ExecutionEngine::processHooks().

void RTT::TaskCore::exception ( )
protectedvirtualinherited
void RTT::TaskCore::exceptionHook ( )
protectedvirtualinherited

Implement this method to contain code that must be executed when transitioning to the Exception state.

This allows you to specify the last actions in an erroneous component, after stopHook() and cleanupHook() were called.

See also
recover() to leave the Exception state.

Definition at line 302 of file TaskCore.cpp.

Referenced by RTT::base::TaskCore::exception().

void RTT::TaskCore::fatal ( )
protectedvirtualinherited

Call this method from any place to indicate that this component encountered a fatal error.

It calls no hooks, the ExecutionEngine is stopped and the component waits destruction.

Definition at line 135 of file TaskCore.cpp.

References RTT::base::TaskCore::engine(), RTT::base::TaskCore::FatalError, RTT::base::RunnableInterface::getActivity(), RTT::base::TaskCore::mTaskState, and RTT::base::ActivityInterface::stop().

Referenced by RTT::base::TaskCore::exception().

void RTT::TaskContext::forceActivity ( base::ActivityInterface new_act)
protectedinherited

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

References RTT::base::TaskCore::engine(), and RTT::base::ActivityInterface::stop().

Referenced by TaskContextProxy().

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

Get a pointer to the activity running this component.

Returns
Our activity.

Definition at line 375 of file TaskContext.cpp.

References RTT::base::TaskCore::engine(), and RTT::base::RunnableInterface::getActivity().

template<typename T >
T* RTT::TaskContext::getActivity ( )
inlineinherited

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

References RTT::connectPeers(), and RTT::TaskContext::getActivity().

Referenced by RTT::TaskContext::getActivity().

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

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

unsigned RTT::TaskCore::getCpuAffinity ( ) const
virtualinherited
unsigned int RTT::base::TaskCore::getCycleCounter ( ) const
inlineinherited

For each update cycle, this counter increments by one.

You can use this to check across (callback) functions if we're still in the same cycle or in a new one.

Definition at line 324 of file TaskCore.hpp.

unsigned int RTT::base::TaskCore::getIOCounter ( ) const
inlineinherited

Number of cycles that were caused by IOReady triggers.

Definition at line 332 of file TaskCore.hpp.

virtual const std::string& RTT::TaskContext::getName ( ) const
inlinevirtualinherited
OperationInterfacePart* RTT::TaskContext::getOperation ( std::string  name)
inlineinherited

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

TaskContext * RTT::corba::TaskContextProxy::getPeer ( const std::string &  peer_name) const
virtual

Get a pointer to a peer of this task.

Returns
null if no such peer.

Reimplemented from RTT::TaskContext.

Definition at line 875 of file TaskContextProxy.cpp.

References Create(), and mtask.

TaskContext::PeerList RTT::corba::TaskContextProxy::getPeerList ( void  ) const
virtual

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

Reimplemented from RTT::TaskContext.

Definition at line 848 of file TaskContextProxy.cpp.

References mtask.

Seconds RTT::TaskCore::getPeriod ( ) const
virtualinherited

Get the configured execution period of this component.

Note that this value only is used when the component isActive() or isRunning().

Return values
0.0if the component is non-periodic (event based).
anegative number when the component is not executable.
apositive value when the component is periodic. The period is expressed in seconds.
Todo:
: add a bool setPeriod(double) function to allow changing the period at run-time.

Definition at line 261 of file TaskCore.cpp.

References RTT::base::TaskCore::engine(), RTT::base::RunnableInterface::getActivity(), and RTT::base::ActivityInterface::getPeriod().

Referenced by RTT::TaskContext::TaskContext().

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

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

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

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

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

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

TaskCore::TaskState RTT::TaskCore::getTargetState ( ) const
virtualinherited

Returns the state this TaskCore is going to, or in case no transition is taking place, returns getTaskState().

For example, before start(), this function returns Stopped. During startHook(), it returns Running and after start() it also returns Running.

If getTaskState() != getTargetState, a transition is taking place.

See also
getTaskState()

Definition at line 79 of file TaskCore.cpp.

TaskContext::TaskState RTT::corba::TaskContextProxy::getTaskState ( void  ) const
virtual

Returns the current state of the TaskCore.

For example, before start(), this function returns Stopped. During startHook() it returns Stopped, and after start() it returns Running.

See also
getTargetState()

Reimplemented from RTT::base::TaskCore.

Definition at line 751 of file TaskContextProxy.cpp.

References RTT::base::TaskCore::Init, and mtask.

unsigned int RTT::base::TaskCore::getTimeOutCounter ( ) const
inlineinherited

Number of cycles that were caused by TimeOut triggers.

Definition at line 336 of file TaskCore.hpp.

unsigned int RTT::base::TaskCore::getTriggerCounter ( ) const
inlineinherited

Number of cycles that were caused by Trigger triggers.

Definition at line 328 of file TaskCore.hpp.

bool RTT::corba::TaskContextProxy::hasPeer ( const std::string &  peer_name) const
virtual

Return true if it knows a peer by that name.

Reimplemented from RTT::TaskContext.

Definition at line 864 of file TaskContextProxy.cpp.

References mtask.

bool RTT::corba::TaskContextProxy::inException ( void  ) const
virtual

Inspect if the component is in the Exception state.

Reimplemented from RTT::base::TaskCore.

Definition at line 739 of file TaskContextProxy.cpp.

References mtask.

bool RTT::corba::TaskContextProxy::inFatalError ( void  ) const
virtual

Inspect if the component is in the FatalError state.

There is no possibility to recover from this state. You need to destroy and recreate your component.

Reimplemented from RTT::base::TaskCore.

Definition at line 719 of file TaskContextProxy.cpp.

References mtask.

void RTT::corba::TaskContextProxy::initFromURIOrTaskname ( std::string  location,
bool  is_ior 
)
protected
RTT_CORBA_API bool RTT::corba::ApplicationServer::InitOrb ( int  argc,
char *  argv[],
Seconds  orb_timeout = 0 
)
staticinherited

Invoke this method once to initialise the Orb which will run the task servers.

Parameters
orb_timeouttimeout value for each remote call, expressed in seconds. The resolution is up to 100 nano seconds. Anything smaller will be interpreted as a zero.

Definition at line 55 of file ApplicationServer.cpp.

References CORBA_EXCEPTION_INFO, RTT::Error, RTT::Logger::log(), RTT::Logger::nl(), RTT::corba::ApplicationServer::orb, and RTT::corba::ApplicationServer::rootPOA.

Referenced by RTT::corba::TaskContextFactory::InitOrb().

bool RTT::corba::TaskContextProxy::inRunTimeError ( void  ) const
virtual

Inspect if the component is in the RunTimeError state.

Reimplemented from RTT::base::TaskCore.

Definition at line 729 of file TaskContextProxy.cpp.

References mtask.

bool RTT::corba::TaskContextProxy::isActive ( void  ) const
virtual

Inspect if the component's ExecutionEngine is processing requests.

Normally this is always the case, but user code could stop the ExecutionEngine manually.

Reimplemented from RTT::base::TaskCore.

Definition at line 665 of file TaskContextProxy.cpp.

References mtask.

bool RTT::corba::TaskContextProxy::isConfigured ( void  ) const
virtual

Inspect if the component is configured, i.e.

in the Stopped, Active or Running state.

Reimplemented from RTT::base::TaskCore.

Definition at line 709 of file TaskContextProxy.cpp.

References mtask.

bool RTT::corba::TaskContextProxy::isRunning ( void  ) const
virtual

Inspect if the component is in the Running or RunTimeError state.

As RunTimeError is a substate of Running, this method also returns true when the component is in one of these states. See inRunTimeError() or testing the run-time error state.

Reimplemented from RTT::base::TaskCore.

Definition at line 675 of file TaskContextProxy.cpp.

References mtask.

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

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.

References RTT::plugin::PluginLoader::Instance(), and RTT::TaskContext::provides().

Referenced by RTT::TaskContext::TaskContext().

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

Returns the operations of this TaskContext as an OperationInterface.

Definition at line 380 of file TaskContext.hpp.

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

Get the Data flow ports of this task.

Definition at line 566 of file TaskContext.hpp.

Referenced by RTT::TaskContext::connectPorts(), RTT::TaskContext::disconnect(), RTT::TaskContext::start(), and RTT::TaskContext::stop().

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

Get the Data flow ports of this task.

Definition at line 573 of file TaskContext.hpp.

References RTT::connectPorts().

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

Returns the properties of this TaskContext as a PropertyBag.

Definition at line 495 of file TaskContext.hpp.

Service::shared_ptr RTT::TaskContext::provides ( )
inlineinherited
Service::shared_ptr RTT::TaskContext::provides ( const std::string &  service_name)
inlineinherited

Returns a sub-Service which resorts under this Service.

Parameters
service_nameThe name of the sub-service.

Definition at line 264 of file TaskContext.hpp.

PortableServer::POA_ptr RTT::corba::TaskContextProxy::ProxyPOA ( )
static

Returns the default POA for all proxies.

Definition at line 943 of file TaskContextProxy.cpp.

References RTT::corba::ApplicationServer::orb, and proxy_poa.

Referenced by synchronizePorts(), and synchronizeServices().

bool RTT::corba::TaskContextProxy::ready ( void  )
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 from RTT::TaskContext.

Definition at line 920 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), and mtask.

bool RTT::corba::TaskContextProxy::recover ( void  )
virtual

Call this method in a RunTimeError or Exception state to indicate that the run-time error conditions are gone and nominal operation is resumed.

Makes transition to Running or PreOperational, depending on the state it was in.

Returns
false if not applicable in the current state.

Reimplemented from RTT::base::TaskCore.

Definition at line 639 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), mtask, and setName().

void RTT::corba::TaskContextProxy::removePeer ( const std::string &  name)
virtual

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

Reimplemented from RTT::TaskContext.

Definition at line 795 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), mtask, and setName().

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

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

Reimplemented from RTT::TaskContext.

Definition at line 808 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), RTT::TaskContext::getName(), mtask, and setName().

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

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

Definition at line 270 of file TaskContext.hpp.

Referenced by RTT::TaskContext::connectServices(), RTT_corba_CTaskContext_i::getRequester(), synchronize(), and synchronizeRequesters().

ServiceRequester::shared_ptr RTT::TaskContext::requires ( const std::string &  service_name)
inlineinherited

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

Definition at line 276 of file TaskContext.hpp.

corba::CTaskContext_ptr RTT::corba::TaskContextProxy::server ( ) const

Get the Corba Object of the CTaskContext.

You need to duplicate this object reference in case you wish to keep a reference to it. This object universally identifies the remote TaskContextServer and can be used to tell other (remote) objects where to find it.

Definition at line 937 of file TaskContextProxy.cpp.

References mtask.

Referenced by addPeer().

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

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(). 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 340 of file TaskContext.cpp.

References RTT::base::TaskCore::engine(), RTT::base::TaskCore::isRunning(), RTT::base::ActivityInterface::run(), and RTT::base::ActivityInterface::stop().

Referenced by initFromURIOrTaskname().

bool RTT::TaskCore::setCpuAffinity ( unsigned  cpu)
virtualinherited

Sets the cpu affinity of this component.

Returns
false if not allowed by the component's activity.
See also
ActivityInterface::setCpuAffinity()

Definition at line 276 of file TaskCore.cpp.

References RTT::base::TaskCore::engine(), RTT::base::RunnableInterface::getActivity(), and RTT::base::ActivityInterface::setCpuAffinity().

Referenced by RTT::TaskContext::TaskContext().

void RTT::corba::TaskContextProxy::setName ( const std::string &  n)
virtual
bool RTT::TaskCore::setPeriod ( Seconds  s)
virtualinherited

Sets the period of this component.

You may call this at any time, it is simply forwarded to the component's activity object.

Returns
false if not allowed by the component's activity.
See also
ActivityInterface::setPeriod()

Definition at line 266 of file TaskCore.cpp.

References RTT::base::TaskCore::engine(), RTT::base::RunnableInterface::getActivity(), and RTT::base::ActivityInterface::setPeriod().

Referenced by RTT::TaskContext::TaskContext().

bool RTT::corba::TaskContextProxy::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
trueif the Running state was entered.

Reimplemented from RTT::TaskContext.

Definition at line 615 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), mtask, and setName().

bool RTT::TaskCore::startHook ( )
protectedvirtualinherited

Implement this method such that it contains the code which will be executed when start() is called.

The default implementation is an empty function which returns true.

Return values
trueto indicate that the component may run and the Running state may be entered.
falseto indicate that the component may not run and the Stopped state is entered.

Definition at line 285 of file TaskCore.cpp.

Referenced by RTT::base::TaskCore::start().

bool RTT::corba::TaskContextProxy::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::TaskContext.

Definition at line 627 of file TaskContextProxy.cpp.

References RTT::TaskContext::clear(), mtask, and setName().

void RTT::TaskCore::stopHook ( )
protectedvirtualinherited

Implement this method such that it contains the code which will be executed when stop() is called.

The default implementation is an empty function.

Definition at line 305 of file TaskCore.cpp.

Referenced by RTT::base::TaskCore::exception(), and RTT::base::TaskCore::stop().

void RTT::corba::TaskContextProxy::synchronize ( )
protected
void RTT::corba::TaskContextProxy::synchronizePorts ( Service::shared_ptr  parent,
CDataFlowInterface_ptr  dfact,
const CServiceDescription cdescription 
)
protected
void RTT::corba::TaskContextProxy::synchronizeRequesters ( ServiceRequester::shared_ptr  parent,
CServiceRequester_ptr  csrq,
const CServiceRequesterDescription cdescription 
)
protected
void RTT::corba::TaskContextProxy::synchronizeServices ( Service::shared_ptr  parent,
CService_ptr  serv,
const CServiceDescription cdescription 
)
protected
bool RTT::TaskCore::trigger ( )
virtualinherited

Invoke this method to trigger the thread of this TaskContext to execute its ExecutionEngine and the update() method.

Return values
falseif this->engine()->getActivity()->trigger() == false
trueotherwise.

Definition at line 88 of file TaskCore.cpp.

References RTT::base::TaskCore::engine(), RTT::base::RunnableInterface::getActivity(), and RTT::base::ActivityInterface::timeout().

Referenced by RTT::DataFlowInterface::addLocalEventPort(), RTT::base::TaskCore::start(), and RTT::TaskContext::TaskContext().

bool RTT::TaskCore::update ( )
virtualinherited

Invoke this method to execute the ExecutionEngine and the update() method.

Return values
falseif this->engine()->getActivity()->execute() == false
trueotherwise.

Definition at line 83 of file TaskCore.cpp.

References RTT::base::TaskCore::engine(), RTT::base::ActivityInterface::execute(), and RTT::base::RunnableInterface::getActivity().

Referenced by RTT::TaskContext::TaskContext().

void RTT::TaskCore::updateHook ( )
protectedvirtualinherited

Function where the user must insert his 'application' code.

When the ExecutionEngine's Activity is a periodic, this function is called by the ExecutionEngine in each periodic step after all messages are processed. When it is executed by a non periodic activity, this function is called after a message is received and executed. It should not loop forever, since no commands or events are processed when this function executes. The default implementation is an empty function.

Definition at line 293 of file TaskCore.cpp.

Referenced by RTT::ExecutionEngine::processHooks().

Member Data Documentation

ExecutionEngine* RTT::base::TaskCore::ee
protectedinherited

The execution engine which calls update() and processes our commands, events etc.

Definition at line 444 of file TaskCore.hpp.

Referenced by RTT::base::TaskCore::~TaskCore().

unsigned int RTT::base::TaskCore::mCycleCounter
protectedinherited

For each update cycle, this counter increments by one.

You can use this to check across (callback) functions if we're still in the same cycle or in a new one.

Definition at line 476 of file TaskCore.hpp.

Referenced by RTT::TaskContext::TaskContext(), and RTT::ExecutionEngine::work().

unsigned int RTT::base::TaskCore::mIOCounter
protectedinherited

Number of cycles that were caused by IOReady triggers.

Definition at line 480 of file TaskCore.hpp.

Referenced by RTT::TaskContext::TaskContext(), and RTT::ExecutionEngine::work().

corba::CTaskContext_var RTT::corba::TaskContextProxy::mtask
mutableprotected
TaskState RTT::base::TaskCore::mTaskState
protectedinherited
unsigned int RTT::base::TaskCore::mTimeOutCounter
protectedinherited

Number of cycles that were caused by TimeOut triggers.

Definition at line 484 of file TaskCore.hpp.

Referenced by RTT::TaskContext::TaskContext(), and RTT::ExecutionEngine::work().

unsigned int RTT::base::TaskCore::mTriggerCounter
protectedinherited

Number of cycles that were caused by Trigger triggers.

Definition at line 488 of file TaskCore.hpp.

Referenced by RTT::TaskContext::TaskContext(), and RTT::ExecutionEngine::work().

bool RTT::base::TaskCore::mTriggerOnStart
protectedinherited

Set to false in order to not trigger() when calling start().

Definition at line 469 of file TaskCore.hpp.

Referenced by RTT::base::TaskCore::start(), and RTT::TaskContext::TaskContext().

CORBA::ORB_var RTT_API RTT::corba::ApplicationServer::orb
staticinherited
std::list<base::PortInterface*> RTT::corba::TaskContextProxy::port_proxies
protected

CDataFlowInterface does not delete ports automatically, because they can then be defined as members of the TaskContext classes.

We must therefore delete in the proxy destructor the ones we are adding through synchronization

Definition at line 114 of file TaskContextProxy.hpp.

Referenced by synchronizePorts().

std::map< TaskContextProxy *, corba::CTaskContext_ptr > RTT::corba::TaskContextProxy::proxies
static
PortableServer::POA_var RTT::corba::TaskContextProxy::proxy_poa
staticprotected

For now one POA handles all proxies.

Definition at line 128 of file TaskContextProxy.hpp.

Referenced by ProxyPOA(), and RTT::corba::IllegalServer::what().

PortableServer::POA_var RTT::corba::ApplicationServer::rootPOA
staticinherited

The root POA of this process.

Definition at line 67 of file ApplicationServer.hpp.

Referenced by DestroyOrb(), RTT::corba::TaskContextServer::DestroyOrb(), and RTT::corba::ApplicationServer::InitOrb().


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