ci_sensor.h
Go to the documentation of this file.
1 
9 #ifndef CI_SENSOR_H
10 #define CI_SENSOR_H
11 
12 namespace argos {
13  class CCI_Sensor;
14 }
15 
16 #include <argos3/core/config.h>
17 #include <argos3/core/utility/datatypes/datatypes.h>
18 #include <argos3/core/utility/configuration/base_configurable_resource.h>
19 #include <map>
20 
21 #ifdef ARGOS_WITH_LUA
22 extern "C" {
23 #include <lua.h>
24 #include <lualib.h>
25 #include <lauxlib.h>
26 }
27 #endif
28 
29 namespace argos {
30 
35 
36  public:
37 
38  typedef std::map<std::string, CCI_Sensor*, std::less<std::string> > TMap;
39 
40  public:
41 
45  virtual ~CCI_Sensor() {}
46 
54  virtual void Init(TConfigurationNode& t_node) {}
55 
62  virtual void Reset() {}
63 
71  virtual void Destroy() {}
72 
78  virtual void Enable() { m_bEnabled = true; }
79 
83  virtual void Disable() { m_bEnabled = false; }
84 
85  bool IsEnabled() const { return m_bEnabled; }
86  bool IsDisabled() const { return !m_bEnabled; }
87 
88 
89 #ifdef ARGOS_WITH_LUA
96  virtual void CreateLuaState(lua_State* pt_lua_state) = 0;
97 
103  virtual void ReadingsToLuaState(lua_State* pt_lua_state) = 0;
104 #endif
105 
106  private:
107 
109  bool m_bEnabled{false};
110  };
111 
112 }
113 
114 #endif
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
The basic interface for all sensors.
Definition: ci_sensor.h:34
std::map< std::string, CCI_Sensor *, std::less< std::string > > TMap
Definition: ci_sensor.h:38
virtual void Reset()
Resets the sensor to the state it had just after Init().
Definition: ci_sensor.h:62
virtual void Destroy()
Destroys the sensor.
Definition: ci_sensor.h:71
virtual void Enable()
Enables updating of sensor information in the event loop.
Definition: ci_sensor.h:78
virtual void Init(TConfigurationNode &t_node)
Initializes the sensor from the XML configuration tree.
Definition: ci_sensor.h:54
bool IsDisabled() const
Definition: ci_sensor.h:86
virtual void Disable()
Disables updating of sensor information in the event loop.
Definition: ci_sensor.h:83
bool IsEnabled() const
Definition: ci_sensor.h:85
virtual ~CCI_Sensor()
Class destructor.
Definition: ci_sensor.h:45
This class is the base of all XML-configurable ARGoS interface.