obmon  1.3.1
ObSensor Class Reference


Base Obmon sensor class More...

#include <ObSensor.h>

Inheritance diagram for ObSensor:
ObSensorGpu ObSensorSystem ObSensorTest

Public Types

enum  SensorType { NONE, VALUE, SPEED, IGNORE }
 Enums for sensor type.
 

Public Member Functions

 ObSensor (std::string name={"sensor"})
 
virtual ~ObSensor ()
 
virtual bool init ()
 
virtual void process ()
 Process function.
 
virtual void speed (ObSensor *, ObSensor *, unsigned int)
 Calculate time change (speed)
 
virtual std::string json (const std::string name={}) const
 
virtual void update (unsigned int timeout) final
 
std::string name () const
 Returns name of sensor.
 
void type (SensorType t)
 Sets sensor type.
 
SensorType type () const
 Returns sensor type.
 
void enabled (bool e)
 Sets flag if sensor is enabled.
 
bool enabled () const
 Returns flag if sensor is enabled.
 
std::vector< ObSensor * > & sensors ()
 Return list of sensors.
 

Protected Attributes

std::shared_ptr< spdlog::logger > _logger
 Pointer to spd logger.
 
std::string _name
 Sensor name.
 
SensorType _type = SensorType::NONE
 Sensor type.
 
bool _enabled
 Is enabled.
 
ObSensor_first {}
 Pointer to first sensor.
 
ObSensor_second {}
 Pointer to second sensor.
 
ObSensor_change {}
 Pointer to change sensor.
 
std::vector< ObSensor * > _sensors {}
 List of subsensors.
 

Detailed Description


Base Obmon sensor class

Author
Martin Vala mvala.nosp@m.@cer.nosp@m.n.ch

Definition at line 19 of file ObSensor.h.

Constructor & Destructor Documentation

◆ ObSensor()

ObSensor::ObSensor ( std::string  name = {"sensor"})


Constructor

Definition at line 3 of file ObSensor.cpp.

References name().

◆ ~ObSensor()

ObSensor::~ObSensor ( )
virtual


Destructor

Definition at line 10 of file ObSensor.cpp.

Member Function Documentation

◆ init()

bool ObSensor::init ( )
virtual


Init sensor function

Reimplemented in ObSensorSystem, ObSensorGpu, and ObSensorTest.

Definition at line 16 of file ObSensor.cpp.

References _sensors.

Referenced by ObSensorGpu::init().

◆ json()

std::string ObSensor::json ( const std::string  name = {}) const
virtual


Return json string from current sensor

Reimplemented in ObSensorSystem, ObSensorGpu, and ObSensorTest.

Definition at line 60 of file ObSensor.cpp.

References _name, _sensors, enabled(), and name().

◆ update()

void ObSensor::update ( unsigned int  timeout)
finalvirtual


Update sensor function

Definition at line 33 of file ObSensor.cpp.

References _first, _second, _sensors, enabled(), and type().


The documentation for this class was generated from the following files: