9#include <unordered_set>
Validates incoming raw telemetry packets against a known set of sensors.
Definition Validator.hpp:28
int sensor_count
The total number of valid sensors loaded.
Definition Validator.hpp:58
simdjson::ondemand::parser parser
The simdjson parser instance used for fast JSON processing.
Definition Validator.hpp:56
Validator(const std::string &path)
Constructs a new Validator and loads the allowed sensors from a configuration file.
Definition Validator.hpp:34
ValidationResult evaluate(const std::string &json)
Validates a raw JSON telemetry packet.
Definition Validator.cpp:35
void load_sensors(const std::string &path)
Parses the configuration file and populates the internal set of allowed sensors.
Definition Validator.cpp:13
~Validator()=default
Default destructor.
int get_sensor_count()
Gets the total number of valid sensors loaded from the configuration file.
Definition Validator.cpp:126
std::unordered_set< std::string > sensors
The set of valid sensor IDs loaded from the configuration.
Definition Validator.hpp:57
Represents the outcome of a telemetry packet validation attempt.
Definition Validator.hpp:17
bool valid
True if the packet is valid and the sensor is recognised, false otherwise.
Definition Validator.hpp:18
std::string sensor_id
Set once both ID fields parse as strings, even if the packet is later rejected.
Definition Validator.hpp:19
std::string timestamp
Set once both ID fields parse as strings, even if the packet is later rejected.
Definition Validator.hpp:20