RobWorkProject  23.9.11-
Public Types | Public Member Functions | Protected Member Functions | List of all members
Task< T > Class Template Reference

Template based implementation of Task. More...

#include <Task.hpp>

Inherits GenericTask< Task< T >, Target< T >, Motion< T > >.

Public Types

typedef rw::core::Ptr< Task< T > > Ptr
 smart pointer type to this class
 
typedef int INT
 
- Public Types inherited from GenericTask< Task< T >, Target< T >, Motion< T > >
typedef rw::core::Ptr< Task< T > > TaskPtr
 
typedef rw::core::Ptr< Target< T > > TargetPtr
 
typedef rw::core::Ptr< Motion< T > > 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

 Task (const std::string &id="")
 Constructs Task. More...
 
virtual ~Task ()
 Destructor.
 
Target< T >::Ptr addTargetByValue (const T &value)
 Adds target to task based on value. More...
 
Target< T >::Ptr addTargetByValueToFront (const T &value)
 
void addToPath (typename Task< T >::Ptr task, std::vector< T > &result)
 Adds values of targets in the task to result. More...
 
void addToTargetPath (typename Task< T >::Ptr task, std::vector< typename Target< T >::Ptr > &result)
 
std::vector< T > getPath ()
 Returns a vector with template type T, describing the target values visited when executing the task. More...
 
std::vector< typename Target< T >::PtrgetTargetPath ()
 
virtual Task< T >::Ptr clone ()
 
- Public Member Functions inherited from GenericTask< Task< T >, Target< T >, Motion< T > >
 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 Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from GenericTask< Task< T >, Target< T >, Motion< T > >
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.
 

Detailed Description

template<class T>
class rwlibs::task::Task< T >

Template based implementation of Task.

Constructor & Destructor Documentation

◆ Task()

Task ( const std::string &  id = "")
inline

Constructs Task.

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

Member Function Documentation

◆ addTargetByValue()

Target<T>::Ptr addTargetByValue ( const T &  value)
inline

Adds target to task based on value.

Parameters
value[in] Value of the target.
Returns
Pointer to the target object constructed and added.

◆ addToPath()

void addToPath ( typename Task< T >::Ptr  task,
std::vector< T > &  result 
)
inline

Adds values of targets in the task to result.

Utility function which can be used to construct a list of via points from a task.

See also Task::getPath() below.

Parameters
task[in] Task to run through
result[in] Vector into which targets pointer should be placed

◆ getPath()

std::vector<T> getPath ( )
inline

Returns a vector with template type T, describing the target values visited when executing the task.

This function can be used to make a simple path from a task.

Returns
Vector with target values visited.

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