RobWorkProject  24.8.23-
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TaskBase Class Referenceabstract

Base class for tasks. More...

#include <Task.hpp>

Inherits Entity.

Inherited by GenericTask< Task< T >, Target< T >, Motion< T > >, and GenericTask< TASK, TARGET, MOTION >.

Public Types

typedef rw::core::Ptr< TaskBasePtr
 smart pointer type to this class
 
typedef rw::core::Ptr< ActionActionPtr
 
- Public Types inherited from Entity
typedef rw::core::Ptr< EntityPtr
 smart pointer type to this class
 

Public Member Functions

 TaskBase (Type type, const std::string &id="")
 Constructs a task with a given type. More...
 
virtual ~TaskBase ()
 Destructor.
 
Type type () const
 Returns the type of the task.
 
void addAugmentation (TaskBase::Ptr task, const std::string &id)
 Add an augmentation of the task. More...
 
bool hasAugmentation (const std::string &id)
 Returns whether the task has an augmentation with a given id. More...
 
TaskBase::Ptr getAugmentation (const std::string &id)
 Returns augmentation associated to id. More...
 
std::map< std::string, TaskBase::Ptr > & getAugmentations ()
 Returns map with ids and augmentations. More...
 
const std::map< std::string, TaskBase::Ptr > & getAugmentations () const
 Returns map with ids and augmentations. More...
 
void addEntity (rw::core::Ptr< Entity > entity)
 Adds entity to the task. More...
 
void addEntityToFront (rw::core::Ptr< Entity > entity)
 
std::vector< rw::core::Ptr< Entity > > & getEntities ()
 Returns list of entities. More...
 
const std::vector< rw::core::Ptr< Entity > > & getEntities () const
 Returns list of entities. More...
 
void addAction (ActionPtr action)
 Adds action to the task. More...
 
void addActionToFront (ActionPtr action)
 
std::vector< ActionPtr > & getActions ()
 Returns list of actions. More...
 
const std::vector< ActionPtr > & getActions () const
 Returns list of actions. More...
 
void setDeviceName (const std::string &name)
 Sets name of device associated to the task. More...
 
const std::string & getDeviceName () const
 Returns name of device associated to the task. More...
 
bool removeAction (Action::Ptr action)
 Removes a specific action.
 
virtual void reverse ()=0
 Reverse the order of the task.
 
- Public Member Functions inherited from Entity
 Entity (EntityType type, const std::string &id="")
 Constructs an Entity with a given type,. More...
 
virtual ~Entity ()
 Destructor.
 
rw::core::PropertyMapgetPropertyMap ()
 Returns reference to rw::core::PropertyMap associated with the Entity. More...
 
const rw::core::PropertyMapgetPropertyMap () const
 Returns reference to rw::core::PropertyMap associated with the Entity. More...
 
void setPropertyMap (const rw::core::PropertyMap &propertymap)
 Sets the content of the propertymap. More...
 
int getIndex () const
 Returns index specifying the position of the Entity in a Task. More...
 
void setIndex (int index)
 Sets the order index of the Entity. More...
 
virtual EntityType entityType () const
 Returns the type of Entity. More...
 
void setId (const std::string &id)
 Set the id for the entity. More...
 
const std::string & getId () const
 Get the id of the entity. More...
 
template<class T >
cast ()
 Method which can be used to explicitly and safely casting an Entity. More...
 

Protected Member Functions

void doReverseBase ()
 
void copyBase (TaskBase::Ptr target)
 
virtual TaskBase::Ptr doClone ()
 
bool removeEntity (Entity::Ptr entity)
 

Protected Attributes

Type _type
 
std::map< std::string, TaskBase::Ptr_augmentations
 
std::vector< ActionPtr_actions
 
std::vector< rw::core::Ptr< Entity > > _entities
 
std::string _deviceName
 
- Protected Attributes inherited from Entity
rw::core::PropertyMap _properties
 Properties of entity.
 
EntityType _entityType
 The type of entity.
 
int _index
 The index of the entity.
 
std::string _id
 The id of the entity.
 

Detailed Description

Base class for tasks.

Member Typedef Documentation

◆ ActionPtr

Convenience definition of pointer to Action

Constructor & Destructor Documentation

◆ TaskBase()

TaskBase ( Type  type,
const std::string &  id = "" 
)
inline

Constructs a task with a given type.

Parameters
type[in] Type of task
id[in] optional identifier

Member Function Documentation

◆ addAction()

void addAction ( ActionPtr  action)
inline

Adds action to the task.

Parameters
action[in] Action to add

◆ addAugmentation()

void addAugmentation ( TaskBase::Ptr  task,
const std::string &  id 
)
inline

Add an augmentation of the task.

Parameters
task[in] Task representing the augmentation
id[in] Id associated to augmentation

◆ addEntity()

void addEntity ( rw::core::Ptr< Entity entity)
inline

Adds entity to the task.

When adding an entity is is assigned an orderIndex specifying when it is added. This index can later be used to find the relative order between motions, actions and subtasks.

Parameters
entity[in] Entity to add

◆ getActions() [1/2]

std::vector<ActionPtr>& getActions ( )
inline

Returns list of actions.

Returns
Reference to list of actions

◆ getActions() [2/2]

const std::vector<ActionPtr>& getActions ( ) const
inline

Returns list of actions.

Returns
Reference to list of actions

◆ getAugmentation()

TaskBase::Ptr getAugmentation ( const std::string &  id)
inline

Returns augmentation associated to id.

If no augmentation exists the method throws a rw::core::Exception

Parameters
id[in] id of task
Returns
Pointer to the augmenting task

◆ getAugmentations() [1/2]

std::map<std::string, TaskBase::Ptr>& getAugmentations ( )
inline

Returns map with ids and augmentations.

Returns
Reference to map with ids and augmentations

◆ getAugmentations() [2/2]

const std::map<std::string, TaskBase::Ptr>& getAugmentations ( ) const
inline

Returns map with ids and augmentations.

Returns
Reference to map with ids and augmentations

◆ getDeviceName()

const std::string& getDeviceName ( ) const
inline

Returns name of device associated to the task.

Returns
Name of the device

◆ getEntities() [1/2]

std::vector<rw::core::Ptr<Entity> >& getEntities ( )
inline

Returns list of entities.

The order of the entities corresponds to the expected order of execution.

Returns
Reference to list of entities

◆ getEntities() [2/2]

const std::vector<rw::core::Ptr<Entity> >& getEntities ( ) const
inline

Returns list of entities.

The order of the entities corresponds to the expected order of execution.

Returns
Reference to list of entities

◆ hasAugmentation()

bool hasAugmentation ( const std::string &  id)
inline

Returns whether the task has an augmentation with a given id.

Parameters
id[in] id of augmentation to look for
Returns
True if augmentation exists. False otherwise

◆ setDeviceName()

void setDeviceName ( const std::string &  name)
inline

Sets name of device associated to the task.

Parameters
name[in] Device name

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