TaskObject Class Reference

#include <rtt/TaskObject.hpp>

Inheritance diagram for TaskObject:

OperationInterface ProgramTask StateMachineTask

List of all members.


Detailed Description

A task object groups a set of commands and methods (operations) which may be invoked.

Definition at line 51 of file TaskObject.hpp.


Public Types

typedef std::vector
< std::string > 
ObjectList
 A list of all child objects of this interface.

Public Member Functions

 TaskObject (std::string name, std::string description="A Task Object.")
 Create a TaskObject with a given name and description.
 TaskObject (OperationInterface *parent, std::string name, std::string description="A Task Object.")
 Create a TaskObject with a given name and description and tie it to a parent.
 ~TaskObject ()
virtual
OperationInterface
getParent ()
 Returns the parent OperationInterface in which this TaskObject lives.
virtual void setParent (OperationInterface *newparent)
 Set a new parent for this interface.
virtual void setEngine (ExecutionEngine *newengine)
 Set the execution engine of the parent TaskContext.
const std::string & getName () const
 Returns the name of this interface.
const std::string & getDescription () const
 Returns the description of this interface.
void setDescription (const std::string &d)
void setName (const std::string &n)
CommandRepositorycommands ()
 Returns the commands of this interface.
const CommandRepositorycommands () const
MethodRepositorymethods ()
 Returns the methods of this interface.
const MethodRepositorymethods () const
EventServiceevents ()
 The task-local events ( 'signals' ) of this TaskContext.
const EventServiceevents () const
 The task-local events ( 'signals' ) of this TaskContext.
AttributeRepositoryattributes ()
 Returns the attributes of this interface.
const
AttributeRepository
attributes () const
virtual void clear ()
virtual bool addObject (OperationInterface *obj)
 Add a new child interface to this interface.
virtual
OperationInterface
getObject (const std::string &obj_name)
 Get a pointer to a previously added TaskObject.
virtual ObjectList getObjectList () const
 Get a list of all the object names of this interface.
virtual bool removeObject (const std::string &obj_name)
 Remove and delete a previously added TaskObject.

Protected Types

typedef std::vector
< OperationInterface * > 
Objects

Protected Attributes

std::string mname
std::string mdescription
OperationInterfacemparent
CommandRepository mcommands
MethodRepository mmethods
AttributeRepository mattributes
Objects mobjects
 the Child TaskObjects.

Constructor & Destructor Documentation

TaskObject ( OperationInterface parent,
std::string  name,
std::string  description = "A Task Object." 
)

Create a TaskObject with a given name and description and tie it to a parent.

Parameters:
parent The OperationInterface to tie the new TaskObject to. In case a TaskObject with the same name is already present in parent, the TaskObject will not be tied and new->getParent() == 0.

Definition at line 12 of file TaskObject.cpp.

References OperationInterface::addObject(), OperationInterface::events(), EventService::getEventProcessor(), and TaskObject::mparent.


Member Function Documentation

virtual OperationInterface* getParent (  )  [inline, virtual]

Returns the parent OperationInterface in which this TaskObject lives.

A TaskObject can have only one parent.

Returns:
null in case no parent is set, the parent otherwise.

Implements OperationInterface.

Definition at line 76 of file TaskObject.hpp.

References TaskObject::mparent.

Referenced by ParsedStateMachine::handleUnload(), and FunctionGraph::handleUnload().

virtual void setParent ( OperationInterface newparent  )  [inline, virtual]

Set a new parent for this interface.

Do not call this method directly. This function is automatically called when a TaskObject is added to another TaskObject.

Implements OperationInterface.

Definition at line 78 of file TaskObject.hpp.

References TaskObject::mparent.

Referenced by ParsedStateMachine::setName().

void setEngine ( ExecutionEngine newengine  )  [virtual]

Set the execution engine of the parent TaskContext.

Do not call this method directly. This function is automatically called when a TaskObject is added to a TaskContext.

Implements OperationInterface.

Definition at line 26 of file TaskObject.cpp.

References ExecutionEngine::events(), and OperationInterface::mobjects.

Referenced by ProgramTask::ProgramTask(), and StateMachineTask::StateMachineTask().

bool addObject ( OperationInterface obj  )  [virtual, inherited]

Add a new child interface to this interface.

Parameters:
obj This object becomes owned by this interface.
Returns:
true if it cuold be added, false if such object already exists.

Reimplemented in TaskContext.

Definition at line 32 of file OperationInterface.cpp.

References RTT::Error, OperationInterface::getName(), OperationInterface::getObject(), OperationInterface::getParent(), OperationInterface::mobjects, and OperationInterface::setParent().

Referenced by TaskContext::addObject(), ControlTaskProxy::fetchObjects(), ParsedStateMachine::setName(), and TaskObject::TaskObject().

OperationInterface * getObject ( const std::string &  obj_name  )  [virtual, inherited]

Get a pointer to a previously added TaskObject.

Parameters:
obj_name The name of the TaskObject
Returns:
the pointer

Definition at line 48 of file OperationInterface.cpp.

References OperationInterface::mobjects.

Referenced by OperationInterface::addObject(), RTT::detail::DumpObject(), ControlTaskProxy::fetchObjects(), ParsedStateMachine::handleUnload(), MarshallingAccess::MarshallingAccess(), ParserExecutionAccess::ParserExecutionAccess(), ParserScriptingAccess::ParserScriptingAccess(), and OperationInterface::removeObject().

std::vector< std::string > getObjectList (  )  const [virtual, inherited]

Get a list of all the object names of this interface.

Returns:
a list of string names.

Definition at line 61 of file OperationInterface.cpp.

References OperationInterface::getName(), and OperationInterface::mobjects.

Referenced by RTT::detail::DumpObject().

bool removeObject ( const std::string &  obj_name  )  [virtual, inherited]

Remove and delete a previously added TaskObject.

Deletion will only occur if obj_name's parent is this. You can avoid deletion by first calling

 this->getObject( obj_name )->setParent(0); 

Parameters:
obj_name The name of the TaskObject to remove
Returns:
true if found and removed, false otherwise.

Definition at line 70 of file OperationInterface.cpp.

References OperationInterface::attributes(), AttributeRepository::clear(), EventService::clear(), CommandRepository::clear(), MethodRepository::clear(), OperationInterface::commands(), OperationInterface::events(), OperationInterface::getObject(), OperationInterface::getParent(), OperationInterface::methods(), and OperationInterface::mobjects.

Referenced by TaskContext::clear(), and FunctionGraph::handleUnload().


The documentation for this class was generated from the following files:
Generated on Tue Mar 25 17:41:58 2008 for OrocosReal-TimeToolkit by  doxygen 1.5.3