Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #pragma once
00011
00012 #include <mvsim/VisualObject.h>
00013 #include <mvsim/Simulable.h>
00014 #include <mvsim/ClassFactory.h>
00015
00016 namespace mvsim
00017 {
00018 class VehicleBase;
00019
00020 class SensorBase : public VisualObject, public Simulable
00021 {
00022 public:
00023 using Ptr = std::shared_ptr<SensorBase>;
00024
00025 SensorBase(VehicleBase& vehicle);
00026
00027 virtual ~SensorBase();
00028
00031 static SensorBase* factory(
00032 VehicleBase& parent, const rapidxml::xml_node<char>* xml_node);
00033
00034 virtual void loadConfigFrom(const rapidxml::xml_node<char>* root) = 0;
00035
00036 double m_sensor_period;
00037
00038
00039 protected:
00040 VehicleBase& m_vehicle;
00041
00042 double m_sensor_last_timestamp;
00043
00044 };
00045
00046
00047 typedef ClassFactory<SensorBase, VehicleBase&, const rapidxml::xml_node<char>*>
00048 TClassFactory_sensors;
00049 extern TClassFactory_sensors classFactory_sensors;
00050
00051 #define DECLARES_REGISTER_SENSOR(CLASS_NAME) \
00052 DECLARES_REGISTER_CLASS2( \
00053 CLASS_NAME, SensorBase, VehicleBase&, const rapidxml::xml_node<char>*)
00054
00055 #define REGISTER_SENSOR(TEXTUAL_NAME, CLASS_NAME) \
00056 REGISTER_CLASS2( \
00057 TClassFactory_sensors, classFactory_sensors, TEXTUAL_NAME, CLASS_NAME)
00058 }