medium.h
Go to the documentation of this file.
1 
7 #ifndef MEDIUM_H
8 #define MEDIUM_H
9 
10 namespace argos {
11  class CMedium;
12  class CSpace;
13 }
14 
15 #include <argos3/core/utility/configuration/base_configurable_resource.h>
16 #include <argos3/core/utility/configuration/argos_configuration.h>
17 #include <argos3/core/utility/datatypes/datatypes.h>
18 #include <argos3/core/utility/plugins/factory.h>
19 
20 namespace argos {
21 
23 
24  public:
25 
26  typedef std::vector<CMedium*> TVector;
27  typedef std::map<std::string, CMedium*> TMap;
28 
29  public:
30 
31  CMedium() {}
32  virtual ~CMedium() {}
33 
48  virtual void Init(TConfigurationNode& t_tree);
49  virtual void Reset() {}
50  virtual void Destroy() {}
51 
65  virtual void PostSpaceInit() {}
66 
70  virtual void Update() = 0;
71 
76  inline const std::string& GetId() const {
77  return m_strId;
78  }
79 
84  void SetId(const std::string& str_id) {
85  m_strId = str_id;
86  }
87 
93  return *m_pcSpace;
94  }
95 
96  private:
97 
99  std::string m_strId;
100 
102  CSpace* m_pcSpace;
103 
104  };
105 
106 }
107 
108 #define REGISTER_MEDIUM(CLASSNAME, \
109  LABEL, \
110  AUTHOR, \
111  VERSION, \
112  BRIEF_DESCRIPTION, \
113  LONG_DESCRIPTION, \
114  STATUS) \
115  REGISTER_SYMBOL(CMedium, \
116  CLASSNAME, \
117  LABEL, \
118  AUTHOR, \
119  VERSION, \
120  BRIEF_DESCRIPTION, \
121  LONG_DESCRIPTION, \
122  STATUS)
123 
124 #endif
std::vector< CMedium * > TVector
Definition: medium.h:26
void SetId(const std::string &str_id)
Sets the id of this medium.
Definition: medium.h:84
virtual void Destroy()
Undoes whatever was done by Init().
Definition: medium.h:50
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
virtual void Init(TConfigurationNode &t_tree)
Initialized the medium.
Definition: medium.cpp:16
CSpace & GetSpace()
Returns a reference to the ARGoS space.
Definition: medium.h:92
const std::string & GetId() const
Returns the id of this medium.
Definition: medium.h:76
virtual void PostSpaceInit()
Executes extra initialization activities after the space has been initialized.
Definition: medium.h:65
virtual ~CMedium()
Definition: medium.h:32
std::map< std::string, CMedium * > TMap
Definition: medium.h:27
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
This class is the base of all XML-configurable ARGoS interface.
virtual void Reset()
Resets the resource.
Definition: medium.h:49
virtual void Update()=0
Updates the state of this medium.