SensorBase.h
Go to the documentation of this file.
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014 Jose Luis Blanco Claraco (University of Almeria) |
5  | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6  | Distributed under GNU General Public License version 3 |
7  | See <http://www.gnu.org/licenses/> |
8  +-------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mvsim/VisualObject.h>
13 #include <mvsim/Simulable.h>
14 #include <mvsim/ClassFactory.h>
15 
16 namespace mvsim
17 {
18 class VehicleBase;
19 
20 class SensorBase : public VisualObject, public Simulable
21 {
22  public:
23  using Ptr = std::shared_ptr<SensorBase>;
24 
25  SensorBase(VehicleBase& vehicle);
26  virtual ~SensorBase();
28 
31  static SensorBase* factory(
32  VehicleBase& parent, const rapidxml::xml_node<char>* xml_node);
33 
34  virtual void loadConfigFrom(const rapidxml::xml_node<char>* root) = 0;
35 
36  double m_sensor_period;
37 
39  protected:
41 
43 };
45 
46 // Class factory:
50 
51 #define DECLARES_REGISTER_SENSOR(CLASS_NAME) \
52  DECLARES_REGISTER_CLASS2( \
53  CLASS_NAME, SensorBase, VehicleBase&, const rapidxml::xml_node<char>*)
54 
55 #define REGISTER_SENSOR(TEXTUAL_NAME, CLASS_NAME) \
56  REGISTER_CLASS2( \
57  TClassFactory_sensors, classFactory_sensors, TEXTUAL_NAME, CLASS_NAME)
58 }
SensorBase(VehicleBase &vehicle)
Definition: SensorBase.cpp:43
VehicleBase & m_vehicle
(in seconds) (Default = 0.1)
Definition: SensorBase.h:40
std::shared_ptr< SensorBase > Ptr
Definition: SensorBase.h:23
virtual ~SensorBase()
which the sensor is attached.
Definition: SensorBase.cpp:51
virtual void loadConfigFrom(const rapidxml::xml_node< char > *root)=0
TClassFactory_sensors classFactory_sensors
Definition: SensorBase.cpp:28
double m_sensor_period
Definition: SensorBase.h:36
ClassFactory< SensorBase, VehicleBase &, const rapidxml::xml_node< char > * > TClassFactory_sensors
Definition: SensorBase.h:48
static SensorBase * factory(VehicleBase &parent, const rapidxml::xml_node< char > *xml_node)
Definition: SensorBase.cpp:52
double m_sensor_last_timestamp
Definition: SensorBase.h:42


mvsim
Author(s):
autogenerated on Thu Jun 6 2019 19:36:40