RobWorkProject  23.9.11-
Public Types | Public Member Functions | Protected Attributes | List of all members
Entity Class Reference

Base class of object inserted into a Task. More...

#include <Entity.hpp>

Inherited by Action, MotionBase, TargetBase, and TaskBase.

Public Types

typedef rw::core::Ptr< EntityPtr
 smart pointer type to this class
 

Public Member Functions

 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

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 of object inserted into a Task.

Constructor & Destructor Documentation

◆ Entity()

Entity ( EntityType  type,
const std::string &  id = "" 
)
inline

Constructs an Entity with a given type,.

Parameters
type[in] Type of entity
id[in] Optional id of entity

Member Function Documentation

◆ cast()

T cast ( )
inline

Method which can be used to explicitly and safely casting an Entity.

If the cast in impossible the method may throws a rw::core::Exception or return NULL if casting to a pointer.

Example:

Action* action = myEntity->cast<Action*>();

◆ entityType()

virtual EntityType entityType ( ) const
inlinevirtual

Returns the type of Entity.

Returns
Type of the Entity

◆ getId()

const std::string& getId ( ) const
inline

Get the id of the entity.

Returns
the id.

◆ getIndex()

int getIndex ( ) const
inline

Returns index specifying the position of the Entity in a Task.

The index may be used to determine when the order of Actions and Motions in a Task. It is the responsibility of the task to generate indices. This index does not necessarily refer to an index in a list of entities.

Returns
The index specifying the relative position of the Entity

◆ getPropertyMap() [1/2]

rw::core::PropertyMap& getPropertyMap ( )
inline

Returns reference to rw::core::PropertyMap associated with the Entity.

Returns
Reference to PropertyMap

◆ getPropertyMap() [2/2]

const rw::core::PropertyMap& getPropertyMap ( ) const
inline

Returns reference to rw::core::PropertyMap associated with the Entity.

Returns
Reference to PropertyMap

◆ setId()

void setId ( const std::string &  id)
inline

Set the id for the entity.

Parameters
id[in] the id.

◆ setIndex()

void setIndex ( int  index)
inline

Sets the order index of the Entity.

This method is primarily used by Task to specify the position of an Entity. Modifying the index does not influence where in a task it is located.

Parameters
index[in] The index specifying the order

◆ setPropertyMap()

void setPropertyMap ( const rw::core::PropertyMap propertymap)
inline

Sets the content of the propertymap.

Overrides the current propertymap with propertymap

Parameters
propertymap[in] The propertymap to use

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