Manages the writing of results to files, separating valid data from alarms.
More...
#include <OutputManager.hpp>
|
| | OutputManager (const std::string &valid_data_path, const std::string &alarms_path, std::string stateful_path, std::string step_diff_path) |
| | Constructs a new OutputManager and opens the target output files.
|
| |
| | ~OutputManager () |
| | Destructor of the class.
|
| |
| void | writeNominal (const Batch &data_for_timestamp) |
| | Writes a single aggregated line for a timestamp without anomalies.
|
| |
| void | writeAlarms (const std::vector< std::string > &alarms) |
| | Writes the alarm lines for non-nominal timestamps.
|
| |
| void | writeStatefulString (const std::string &state) |
| | Writes the state of stateful rules to a file for use in the next batch.
|
| |
| void | writeStepDiffString (const std::string &state) |
| | Writes the state of step difference rules to a file for use in the next batch.
|
| |
| void | writeStateful (const EvaluationPipeline &pipeline) |
| | Writes stateful-rule state by introspecting the pipeline (single-process path / unit tests).
|
| |
| void | writeStepDifference (const EvaluationPipeline &pipeline) |
| | Writes step-difference-rule state by introspecting the pipeline (single-process path / unit tests).
|
| |
| void | readStateful (EvaluationPipeline &pipeline) |
| | Reads the state of stateful rules from a file to update the evaluation pipeline for the current batch.
|
| |
| void | readStepDifference (EvaluationPipeline &pipeline) |
| | Reads the state of step difference rules from a file to update the evaluation pipeline for the current batch.
|
| |
|
| std::ofstream | valid_file |
| | output file stream for valid (nominal) data
|
| |
| std::ofstream | alarms_file |
| | output file stream for alarms
|
| |
| std::string | stateful_path |
| | path to the stateful rules state file
|
| |
| std::string | step_diff_path |
| | path to the step difference rules state file
|
| |
Manages the writing of results to files, separating valid data from alarms.
- Note
- This class handles the file streams, keeping them open during execution and safely closing them upon destruction.
◆ OutputManager()
| OutputManager::OutputManager |
( |
const std::string & |
valid_data_path, |
|
|
const std::string & |
alarms_path, |
|
|
std::string |
stateful_path, |
|
|
std::string |
step_diff_path |
|
) |
| |
Constructs a new OutputManager and opens the target output files.
- Parameters
-
| valid_data_path | The file path where valid (nominal) data should be written. |
| alarms_path | The file path where alarms should be written. |
| stateful_path | The file path where the state of stateful rules should be written for the next batch. |
| step_diff_path | The file path where the state of step difference rules should be written for the next batch. |
◆ ~OutputManager()
| OutputManager::~OutputManager |
( |
| ) |
|
Destructor of the class.
- Note
- Ensures that the output files are closed properly to prevent data loss.
◆ readStateful()
Reads the state of stateful rules from a file to update the evaluation pipeline for the current batch.
- Parameters
-
| pipeline | The evaluation pipeline to be updated with the read stateful rules' states. |
◆ readStepDifference()
Reads the state of step difference rules from a file to update the evaluation pipeline for the current batch.
- Parameters
-
| pipeline | The evaluation pipeline to be updated with the read step difference rules' states. |
◆ writeAlarms()
| void OutputManager::writeAlarms |
( |
const std::vector< std::string > & |
alarms | ) |
|
Writes the alarm lines for non-nominal timestamps.
- Note
- The provided strings are expected to be already pre-formatted by the Evaluate component.
- Parameters
-
| alarms | A vector of strings, each representing a single alarm message to be written. |
◆ writeNominal()
| void OutputManager::writeNominal |
( |
const Batch & |
data_for_timestamp | ) |
|
Writes a single aggregated line for a timestamp without anomalies.
- Parameters
-
| data_for_timestamp | The batch of valid data collected for the given timestamp. |
◆ writeStateful()
Writes stateful-rule state by introspecting the pipeline (single-process path / unit tests).
- Parameters
-
| pipeline | The evaluation pipeline whose stateful rules' counters are persisted. |
◆ writeStatefulString()
| void OutputManager::writeStatefulString |
( |
const std::string & |
state | ) |
|
Writes the state of stateful rules to a file for use in the next batch.
- Parameters
-
| state | The string representation of the stateful rules' states to be written to the file. |
◆ writeStepDifference()
Writes step-difference-rule state by introspecting the pipeline (single-process path / unit tests).
- Parameters
-
| pipeline | The evaluation pipeline whose step-difference rules' last values are persisted. |
◆ writeStepDiffString()
| void OutputManager::writeStepDiffString |
( |
const std::string & |
state | ) |
|
Writes the state of step difference rules to a file for use in the next batch.
- Parameters
-
| state | The string representation of the step difference rules' states to be written to the file. |
◆ alarms_file
| std::ofstream OutputManager::alarms_file |
|
private |
output file stream for alarms
◆ stateful_path
| std::string OutputManager::stateful_path |
|
private |
path to the stateful rules state file
◆ step_diff_path
| std::string OutputManager::step_diff_path |
|
private |
path to the step difference rules state file
◆ valid_file
| std::ofstream OutputManager::valid_file |
|
private |
output file stream for valid (nominal) data
The documentation for this class was generated from the following files: