prototype_entity.h
Go to the documentation of this file.
1 
7 #ifndef PROTOTYPE_ENTITY_H
8 #define PROTOTYPE_ENTITY_H
9 
10 namespace argos {
11  class CEmbodiedEntity;
12  class CControllableEntity;
13  class CPrototypeLinkEquippedEntity;
14  class CPrototypeJointEquippedEntity;
15  class CTagEquippedEntity;
16  class CRadioEquippedEntity;
17  class CMagnetEquippedEntity;
18  class CCameraEquippedEntity;
19  class CProximitySensorEquippedEntity;
20  class CDirectionalLEDEquippedEntity;
21  class CLEDEquippedEntity;
22  class CPrototypeEntity;
23 }
24 
25 #include <argos3/core/simulator/entity/composable_entity.h>
26 
27 namespace argos {
28 
30 
31  public:
32 
33  ENABLE_VTABLE();
34 
35  public:
36 
38 
39  virtual ~CPrototypeEntity() {}
40 
41  virtual void Init(TConfigurationNode& t_tree);
42 
44  return *m_pcEmbodiedEntity;
45  }
46 
48  return *m_pcLinkEquippedEntity;
49  }
50 
52  return *m_pcJointEquippedEntity;
53  }
54 
55  inline bool HasControllableEntity() const {
56  return (m_pcControllableEntity != nullptr);
57  }
58 
60  ARGOS_ASSERT(m_pcControllableEntity != nullptr,
61  "CPrototypeEntity::GetControllableEntity(), id=\"" <<
62  GetId() + GetContext() <<
63  "\": was not initialized with a controllable entity");
64  return *m_pcControllableEntity;
65  }
66 
67  inline bool HasDirectionalLEDEquippedEntity() const {
68  return (m_pcDirectionalLEDEquippedEntity != nullptr);
69  }
70 
72  ARGOS_ASSERT(m_pcDirectionalLEDEquippedEntity != nullptr,
73  "CPrototypeEntity::GetDirectionalLEDEquippedEntity(), id=\"" <<
74  GetId() + GetContext() <<
75  "\": was not initialized with an directional LED equipped entity");
76  return *m_pcDirectionalLEDEquippedEntity;
77  }
78 
79  inline bool HasLEDEquippedEntity() const {
80  return (m_pcLEDEquippedEntity != nullptr);
81  }
82 
84  ARGOS_ASSERT(m_pcLEDEquippedEntity != nullptr,
85  "CPrototypeEntity::GetLEDEquippedEntity(), id=\"" <<
86  GetId() + GetContext() <<
87  "\": was not initialized with an LED equipped entity");
88  return *m_pcLEDEquippedEntity;
89  }
90 
91  inline bool HasTagEquippedEntity() const {
92  return (m_pcTagEquippedEntity != nullptr);
93  }
94 
96  ARGOS_ASSERT(m_pcTagEquippedEntity != nullptr,
97  "CPrototypeEntity::GetTagEquippedEntity(), id=\"" <<
98  GetId() + GetContext() <<
99  "\": was not initialized with a tag equipped entity");
100  return *m_pcTagEquippedEntity;
101  }
102 
103  inline bool HasRadioEquippedEntity() const {
104  return (m_pcRadioEquippedEntity != nullptr);
105  }
106 
108  ARGOS_ASSERT(m_pcRadioEquippedEntity != nullptr,
109  "CPrototypeEntity::GetRadioEquippedEntity(), id=\"" <<
110  GetId() + GetContext() <<
111  "\": was not initialized with a radio equipped entity");
112  return *m_pcRadioEquippedEntity;
113  }
114 
115  inline bool HasMagnetEquippedEntity() const {
116  return (m_pcMagnetEquippedEntity != nullptr);
117  }
118 
120  ARGOS_ASSERT(m_pcMagnetEquippedEntity != nullptr,
121  "CPrototypeEntity::GetMagnetEquippedEntity(), id=\"" <<
122  GetId() + GetContext() <<
123  "\": was not initialized with a magnet equipped entity");
124  return *m_pcMagnetEquippedEntity;
125  }
126 
127  inline bool HasProximitySensorEquippedEntity() const {
128  return (m_pcProximitySensorEquippedEntity != nullptr);
129  }
130 
132  ARGOS_ASSERT(m_pcProximitySensorEquippedEntity != nullptr,
133  "CPrototypeEntity::GetProximitySensorEquippedEntity(), id=\"" <<
134  GetId() + GetContext() <<
135  "\": was not initialized with a proximity sensor equipped entity");
136  return *m_pcProximitySensorEquippedEntity;
137  }
138 
139  virtual std::string GetTypeDescription() const {
140  return "prototype";
141  }
142 
143  private:
144 
145  CEmbodiedEntity* m_pcEmbodiedEntity;
146  CControllableEntity* m_pcControllableEntity;
147  CPrototypeLinkEquippedEntity* m_pcLinkEquippedEntity;
148  CPrototypeJointEquippedEntity* m_pcJointEquippedEntity;
149  CDirectionalLEDEquippedEntity* m_pcDirectionalLEDEquippedEntity;
150  CLEDEquippedEntity* m_pcLEDEquippedEntity;
151  CTagEquippedEntity* m_pcTagEquippedEntity;
152  CRadioEquippedEntity* m_pcRadioEquippedEntity;
153  CMagnetEquippedEntity* m_pcMagnetEquippedEntity;
154  CProximitySensorEquippedEntity* m_pcProximitySensorEquippedEntity;
155 
156  };
157 
158 }
159 
160 #endif
An entity that contains a pointer to the user-defined controller.
CEmbodiedEntity & GetEmbodiedEntity()
bool HasControllableEntity() const
bool HasDirectionalLEDEquippedEntity() const
CMagnetEquippedEntity & GetMagnetEquippedEntity()
bool HasLEDEquippedEntity() const
A container of CTagEntity.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
This entity is a link to a body in the physics engine.
virtual std::string GetTypeDescription() const
Returns a string label for this class.
bool HasProximitySensorEquippedEntity() const
CDirectionalLEDEquippedEntity & GetDirectionalLEDEquippedEntity()
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
A container of CLEDEntity.
CControllableEntity & GetControllableEntity()
Basic class for an entity that contains other entities.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
A container of CRadioEntity.
CPrototypeLinkEquippedEntity & GetLinkEquippedEntity()
bool HasMagnetEquippedEntity() const
bool HasTagEquippedEntity() const
CProximitySensorEquippedEntity & GetProximitySensorEquippedEntity()
A container of CMagnetEntity.
CRadioEquippedEntity & GetRadioEquippedEntity()
const std::string & GetId() const
Returns the id of this entity.
Definition: entity.h:157
A container of CDirectionalLEDEntity.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
std::string GetContext() const
Returns the context of this entity.
Definition: entity.cpp:79
CTagEquippedEntity & GetTagEquippedEntity()
CLEDEquippedEntity & GetLEDEquippedEntity()
bool HasRadioEquippedEntity() const
CPrototypeJointEquippedEntity & GetJointEquippedEntity()