magnet_equipped_entity.h
Go to the documentation of this file.
1 
7 #ifndef MAGNET_EQUIPPED_ENTITY_H
8 #define MAGNET_EQUIPPED_ENTITY_H
9 
10 namespace argos {
11  class CMagnetEquippedEntity;
12  class CMagnetEntity;
13 }
14 
15 #include <argos3/core/simulator/entity/composable_entity.h>
16 #include <argos3/plugins/simulator/entities/magnet_entity.h>
17 #include <vector>
18 
19 namespace argos {
20 
31 
32  public:
33 
35 
36  public:
37 
38  struct SInstance {
42  SInstance(CMagnetEntity& c_magnet,
43  SAnchor& s_anchor,
44  const CVector3& c_position_offset);
45  using TVector = std::vector<SInstance>;
46  };
47 
48  public:
49 
55 
62  const std::string& str_id);
63 
65 
66  virtual void Init(TConfigurationNode& t_tree);
67 
68  virtual void Enable();
69 
70  virtual void Disable();
71 
78  CMagnetEntity& GetMagnet(UInt32 un_index);
79 
80  CMagnetEntity& AddMagnet(const std::string& str_id,
81  SAnchor& s_anchor,
82  const CVector3& c_position_offset,
83  const CVector3& c_passive_field,
84  const CVector3& c_active_field = CVector3());
85 
87  return m_vecInstances;
88  }
89 
90  virtual std::string GetTypeDescription() const {
91  return "magnets";
92  }
93 
94  protected:
95 
96  virtual void UpdateComponents() {}
97 
98  protected:
99 
102  };
103 
104 }
105 
106 #endif
unsigned int UInt32
32-bit unsigned integer.
Definition: datatypes.h:97
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.
An anchor related to the body of an entity.
Definition: physics_model.h:38
A 3D vector class.
Definition: vector3.h:31
A container of CMagnetEntity.
SInstance::TVector & GetInstances()
CMagnetEntity & GetMagnet(UInt32 un_index)
Returns an magnet by numeric index.
virtual std::string GetTypeDescription() const
Returns a string label for this class.
CMagnetEntity & AddMagnet(const std::string &str_id, SAnchor &s_anchor, const CVector3 &c_position_offset, const CVector3 &c_passive_field, const CVector3 &c_active_field=CVector3())
SInstance::TVector m_vecInstances
A list of the magnets managed by this entity.
virtual void UpdateComponents()
Calls the Update() method on all the components.
CMagnetEquippedEntity(CComposableEntity *pc_parent)
Class constructor.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
SInstance(CMagnetEntity &c_magnet, SAnchor &s_anchor, const CVector3 &c_position_offset)