RobWorkProject
24.8.23-
|
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< TaskBase > | Ptr |
smart pointer type to this class | |
typedef rw::core::Ptr< Action > | ActionPtr |
Public Types inherited from Entity | |
typedef rw::core::Ptr< Entity > | Ptr |
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::PropertyMap & | getPropertyMap () |
Returns reference to rw::core::PropertyMap associated with the Entity. More... | |
const rw::core::PropertyMap & | getPropertyMap () 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 > | |
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. | |
Base class for tasks.
typedef rw::core::Ptr<Action> ActionPtr |
Convenience definition of pointer to Action
Constructs a task with a given type.
type | [in] Type of task |
id | [in] optional identifier |
|
inline |
Adds action to the task.
action | [in] Action to add |
|
inline |
Add an augmentation of the task.
task | [in] Task representing the augmentation |
id | [in] Id associated to augmentation |
|
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.
entity | [in] Entity to add |
|
inline |
Returns list of actions.
|
inline |
Returns list of actions.
|
inline |
Returns augmentation associated to id.
If no augmentation exists the method throws a rw::core::Exception
id | [in] id of task |
|
inline |
Returns map with ids and augmentations.
|
inline |
Returns map with ids and augmentations.
|
inline |
Returns name of device associated to the task.
|
inline |
Returns list of entities.
The order of the entities corresponds to the expected order of execution.
|
inline |
Returns list of entities.
The order of the entities corresponds to the expected order of execution.
|
inline |
Returns whether the task has an augmentation with a given id.
id | [in] id of augmentation to look for |
|
inline |
Sets name of device associated to the task.
name | [in] Device name |