RobWorkProject  24.5.15-
Public Types | Public Member Functions | Protected Attributes | List of all members
GenericTask< TASK, TARGET, MOTION > Class Template Reference

Implements a template based and generic version of a task. More...

#include <Task.hpp>

Inherits TaskBase.

Public Types

typedef rw::core::Ptr< TASK > TaskPtr
 
typedef rw::core::Ptr< TARGET > TargetPtr
 
typedef rw::core::Ptr< MOTION > MotionPtr
 
- Public Types inherited from TaskBase
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

 GenericTask (Type type=-1, const std::string &id="")
 Constrcts Task. More...
 
virtual ~GenericTask ()
 Destructor.
 
void addTarget (TargetPtr target)
 Adds target to the task. More...
 
void addTargetToFront (TargetPtr target)
 
bool removeTarget (TargetPtr target)
 Removes a specific target.
 
std::vector< TargetPtr > & getTargets ()
 Returns list of targets. More...
 
const std::vector< TargetPtr > & getTargets () const
 Returns list of targets. More...
 
void addMotion (MotionPtr motion)
 Adds motion to the task. More...
 
void addMotionToFront (MotionPtr motion)
 Adds motion to the front of the task. More...
 
bool removeMotion (MotionPtr motion)
 Removes a specific motion.
 
std::vector< MotionPtr > & getMotions ()
 Returns list of motions. More...
 
const std::vector< MotionPtr > & getMotions () const
 Returns list of motions. More...
 
void addTask (TaskPtr task)
 Adds task as a subtask. More...
 
void addTaskToFront (TaskPtr task)
 
std::vector< TaskPtr > & getTasks ()
 Returns list of tasks. More...
 
const std::vector< TaskPtr > & getTasks () const
 Returns list of tasks. More...
 
void reverse ()
 Reverse the order of the task.
 
- Public Member Functions inherited from TaskBase
 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.
 
- 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 Attributes

std::vector< TargetPtr_targets
 
std::vector< MotionPtr_motions
 
std::vector< TaskPtr_tasks
 
- Protected Attributes inherited from TaskBase
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.
 

Additional Inherited Members

- Protected Member Functions inherited from TaskBase
void doReverseBase ()
 
void copyBase (TaskBase::Ptr target)
 
virtual TaskBase::Ptr doClone ()
 
bool removeEntity (Entity::Ptr entity)
 

Detailed Description

template<class TASK, class TARGET, class MOTION>
class rwlibs::task::GenericTask< TASK, TARGET, MOTION >

Implements a template based and generic version of a task.

The template arguments TASK, TARGET and MOTION represents specifies which kind of task, target and motion to use.

Member Typedef Documentation

◆ MotionPtr

typedef rw::core::Ptr<MOTION> MotionPtr

Convenience definition of pointer to motion

◆ TargetPtr

typedef rw::core::Ptr<TARGET> TargetPtr

Convenience definition of pointer to target

◆ TaskPtr

typedef rw::core::Ptr<TASK> TaskPtr

Convenience definition of pointer to task

Constructor & Destructor Documentation

◆ GenericTask()

GenericTask ( Type  type = -1,
const std::string &  id = "" 
)
inline

Constrcts Task.

When constructing a task the type T is automatically added to the TypeRepository and the the associated value is set as the type.

Member Function Documentation

◆ addMotion()

void addMotion ( MotionPtr  motion)
inline

Adds motion to the task.

Parameters
motion[in] Motion to add

◆ addMotionToFront()

void addMotionToFront ( MotionPtr  motion)
inline

Adds motion to the front of the task.

Parameters
motion[in] Motion to add

◆ addTarget()

void addTarget ( TargetPtr  target)
inline

Adds target to the task.

Parameters
target[in] Target to add

◆ addTask()

void addTask ( TaskPtr  task)
inline

Adds task as a subtask.

Parameters
task[in] Task to add

◆ getMotions() [1/2]

std::vector<MotionPtr>& getMotions ( )
inline

Returns list of motions.

Returns
Reference to list of motions

◆ getMotions() [2/2]

const std::vector<MotionPtr>& getMotions ( ) const
inline

Returns list of motions.

Returns
Reference to list of motions

◆ getTargets() [1/2]

std::vector<TargetPtr>& getTargets ( )
inline

Returns list of targets.

Returns
Reference to list of targets

◆ getTargets() [2/2]

const std::vector<TargetPtr>& getTargets ( ) const
inline

Returns list of targets.

Returns
Reference to list of targets

◆ getTasks() [1/2]

std::vector<TaskPtr>& getTasks ( )
inline

Returns list of tasks.

Returns
Reference to list of tasks

◆ getTasks() [2/2]

const std::vector<TaskPtr>& getTasks ( ) const
inline

Returns list of tasks.

Returns
Reference to list of tasks

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