rab_equipped_entity.h
Go to the documentation of this file.
1 
7 #ifndef RAB_EQUIPPED_ENTITY_H
8 #define RAB_EQUIPPED_ENTITY_H
9 
10 namespace argos {
11  class CRABEquippedEntity;
12  class CRABMedium;
13  class CEmbodiedEntity;
14  struct SAnchor;
15 }
16 
17 #include <argos3/core/utility/datatypes/byte_array.h>
18 #include <argos3/core/utility/datatypes/set.h>
19 #include <argos3/core/simulator/entity/positional_entity.h>
20 #include <argos3/core/utility/math/vector3.h>
21 #include <argos3/core/simulator/space/positional_indices/space_hash.h>
22 #include <argos3/core/simulator/space/positional_indices/grid.h>
23 
24 namespace argos {
25 
27 
28  public:
29 
31 
32  typedef std::vector<CRABEquippedEntity*> TVector;
34 
35  public:
36 
38 
40  const std::string& str_id,
41  size_t un_msg_size,
42  Real f_range,
43  SAnchor& s_anchor,
44  CEmbodiedEntity& c_entity_body,
45  const CVector3& c_position = CVector3(),
46  const CQuaternion& c_orientation = CQuaternion());
47 
48  virtual void Init(TConfigurationNode& t_tree);
49 
50  virtual ~CRABEquippedEntity() {}
51 
52  virtual void Reset();
53 
54  virtual void Update();
55 
56  virtual void SetEnabled(bool b_enabled);
57 
59  return *m_pcEntityBody;
60  }
61 
62  inline size_t GetMsgSize() const {
63  return m_cData.Size();
64  }
65 
66  inline CByteArray& GetData() {
67  return m_cData;
68  }
69 
70  void SetData(const CByteArray& c_data);
71 
72  void ClearData();
73 
74  inline Real GetRange() const {
75  return m_fRange;
76  }
77 
78  inline void SetRange(Real f_range) {
79  m_fRange = f_range;
80  }
81 
82  inline const SAnchor& GetAnchor() const {
83  return *m_psAnchor;
84  }
85 
86  virtual std::string GetTypeDescription() const {
87  return "rab";
88  }
89 
90  inline CRABMedium& GetMedium() {
91  return *m_pcMedium;
92  }
93 
94  inline void SetMedium(CRABMedium& c_medium) {
95  m_pcMedium = &c_medium;
96  }
97 
98  protected:
99 
107 
108  };
109 
110  /****************************************/
111  /****************************************/
112 
113  class CRABEquippedEntitySpaceHashUpdater : public CSpaceHashUpdater<CRABEquippedEntity> {
114 
115  public:
116 
117  virtual void operator()(CAbstractSpaceHash<CRABEquippedEntity>& c_space_hash,
118  CRABEquippedEntity& c_element);
119 
120  private:
121 
122  SInt32 m_nCenterI, m_nCenterJ, m_nCenterK;
123 
124  };
125 
126  /****************************************/
127  /****************************************/
128 
129  class CRABEquippedEntityGridCellUpdater : public CGrid<CRABEquippedEntity>::CCellOperation {
130 
131  public:
132 
134 
135  virtual bool operator()(SInt32 n_i,
136  SInt32 n_j,
137  SInt32 n_k,
139 
140  void SetEntity(CRABEquippedEntity& c_entity);
141 
142  private:
143 
144  CGrid<CRABEquippedEntity>& m_cGrid;
145  CRABEquippedEntity* m_pcEntity;
146  };
147 
148  class CRABEquippedEntityGridEntityUpdater : public CGrid<CRABEquippedEntity>::COperation {
149 
150  public:
151 
153  virtual bool operator()(CRABEquippedEntity& c_entity);
154 
155  private:
156 
157  CGrid<CRABEquippedEntity>& m_cGrid;
158  CRABEquippedEntityGridCellUpdater m_cCellUpdater;
159  };
160 
161  /****************************************/
162  /****************************************/
163 
164 }
165 
166 #endif
signed int SInt32
32-bit signed integer.
Definition: datatypes.h:93
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
Basic class for an entity that contains other entities.
This entity is a link to a body in the physics engine.
An anchor related to the body of an entity.
Definition: physics_model.h:38
The abstract definition of a space hash.
Definition: space_hash.h:34
Defines the basic cell updater of the space hash.
Definition: space_hash.h:269
Byte array utility class.
Definition: byte_array.h:28
size_t Size() const
Returns the current size of the byte array.
Definition: byte_array.h:66
Defines a very simple double-linked list that stores unique elements.
Definition: set.h:101
A 3D vector class.
Definition: vector3.h:31
void SetMedium(CRABMedium &c_medium)
const SAnchor & GetAnchor() const
void SetData(const CByteArray &c_data)
virtual void Update()
Updates the state of this entity.
CRABEquippedEntity(CComposableEntity *pc_parent)
virtual void SetEnabled(bool b_enabled)
Enables or disables an entity.
virtual std::string GetTypeDescription() const
Returns a string label for this class.
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
CEmbodiedEntity * m_pcEntityBody
CSet< CRABEquippedEntity * > TSet
CEmbodiedEntity & GetEntityBody()
std::vector< CRABEquippedEntity * > TVector
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
virtual void operator()(CAbstractSpaceHash< CRABEquippedEntity > &c_space_hash, CRABEquippedEntity &c_element)
Updates the necessary cells of a space hash.
void SetEntity(CRABEquippedEntity &c_entity)
virtual bool operator()(SInt32 n_i, SInt32 n_j, SInt32 n_k, CGrid< CRABEquippedEntity >::SCell &s_cell)
CRABEquippedEntityGridCellUpdater(CGrid< CRABEquippedEntity > &c_grid)
CRABEquippedEntityGridEntityUpdater(CGrid< CRABEquippedEntity > &c_grid)
virtual bool operator()(CRABEquippedEntity &c_entity)