AstraLog-HPC
Loading...
Searching...
No Matches
Types.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <optional>
9#include <variant>
10#include <string>
11#include <vector>
12#include <simdjson.h>
13#include <RulesFactory/Strategy.hpp> // for ResultMap
14
19struct DataPoint {
20 std::string timestamp;
21 std::string sensor_id;
22 std::variant<double, std::string> value;
23 std::string priority;
24};
25
29using Batch = std::vector<DataPoint>;
30
37std::optional<DataPoint> parseStringToDataPoint(const std::string& line, simdjson::dom::parser& parser);
38
44 std::vector<std::string> alarms;
46};
Abstract class for the strategy pattern, defining the interface for different rule strategies.
std::unordered_map< std::string, bool > ResultMap
Alias for a map containing the boolean evaluation results of rules, keyed by rule ID.
Definition Strategy.hpp:18
std::optional< DataPoint > parseStringToDataPoint(const std::string &line, simdjson::dom::parser &parser)
Parses a line of the input file into a DataPoint structure.
Definition Types.cpp:5
std::vector< DataPoint > Batch
Batch groups all the data points for a single timestamp.
Definition Types.hpp:29
DataPoint contains the information of a single data point, which is a line of the input file.
Definition Types.hpp:19
std::variant< double, std::string > value
Double for a valid reading, or a string error marker (e.g. "E").
Definition Types.hpp:22
std::string timestamp
Timestamp of the reading.
Definition Types.hpp:20
std::string priority
Priority level carried by the packet.
Definition Types.hpp:23
std::string sensor_id
ID of the sensor that produced the reading.
Definition Types.hpp:21
Intermediate result for each timestamp: alarms + map of rule outcomes.
Definition Types.hpp:43
std::vector< std::string > alarms
list of alarm messages for the timestamp
Definition Types.hpp:44
ResultMap rule_outcomes
Map of rule ID to outcome (true if triggered); ResultMap is the alias defined in Strategy....
Definition Types.hpp:45