Validates incoming raw telemetry packets against a known set of sensors.
More...
#include <Validator.hpp>
|
| | Validator (const std::string &path) |
| | Constructs a new Validator and loads the allowed sensors from a configuration file.
|
| |
| | ~Validator ()=default |
| | Default destructor.
|
| |
| ValidationResult | evaluate (const std::string &json) |
| | Validates a raw JSON telemetry packet.
|
| |
| int | get_sensor_count () |
| | Gets the total number of valid sensors loaded from the configuration file.
|
| |
|
| void | load_sensors (const std::string &path) |
| | Parses the configuration file and populates the internal set of allowed sensors.
|
| |
|
| simdjson::ondemand::parser | parser |
| | The simdjson parser instance used for fast JSON processing.
|
| |
| std::unordered_set< std::string > | sensors |
| | The set of valid sensor IDs loaded from the configuration.
|
| |
| int | sensor_count = 0 |
| | The total number of valid sensors loaded.
|
| |
Validates incoming raw telemetry packets against a known set of sensors.
- Note
- This class uses the simdjson library for high-performance JSON parsing.
◆ Validator()
| Validator::Validator |
( |
const std::string & |
path | ) |
|
|
inline |
Constructs a new Validator and loads the allowed sensors from a configuration file.
- Parameters
-
| path | The file path to the sensors configuration file (e.g., YAML format). |
◆ ~Validator()
| Validator::~Validator |
( |
| ) |
|
|
default |
◆ evaluate()
Validates a raw JSON telemetry packet.
- Parameters
-
| json | Raw JSON string received from the MQTT broker. |
- Returns
- A ValidationResult describing the outcome. sensor_id and timestamp are populated once both parse as strings, even if the packet is later rejected.
◆ get_sensor_count()
| int Validator::get_sensor_count |
( |
| ) |
|
Gets the total number of valid sensors loaded from the configuration file.
- Returns
- The number of loaded sensors.
◆ load_sensors()
| void Validator::load_sensors |
( |
const std::string & |
path | ) |
|
|
private |
Parses the configuration file and populates the internal set of allowed sensors.
- Parameters
-
| path | The file path to the sensors configuration file. |
◆ parser
| simdjson::ondemand::parser Validator::parser |
|
private |
The simdjson parser instance used for fast JSON processing.
◆ sensor_count
| int Validator::sensor_count = 0 |
|
private |
The total number of valid sensors loaded.
◆ sensors
| std::unordered_set<std::string> Validator::sensors |
|
private |
The set of valid sensor IDs loaded from the configuration.
The documentation for this class was generated from the following files: