|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
Abstract base class for data parsers. More...
#include <IParser.h>

Public Member Functions | |
| virtual | ~IParser ()=default |
| Virtual destructor to allow proper cleanup via base pointer. | |
| virtual std::shared_ptr< DBNode > | parse (const std::string &input) const =0 |
| Parses an input string into a DBNode hierarchy. | |
| virtual void | writeToFile (const std::string &filename, const std::shared_ptr< DBNode > &root) const =0 |
| Serializes a DBNode hierarchy to a file. | |
| virtual std::shared_ptr< DBNode > | readFromFile (const std::string &filename) const =0 |
| Reads and parses a DBNode hierarchy from a file. | |
Abstract base class for data parsers.
This interface is format-agnostic. It exposes three core operations:
|
virtualdefault |
Virtual destructor to allow proper cleanup via base pointer.
|
pure virtual |
Parses an input string into a DBNode hierarchy.
The exact syntax and semantics of the input depend on the concrete implementation (YAML, JSON, LHA, ...).
| input | Text buffer to parse. |
| std::runtime_error | (or derived) on parsing errors. |
Implemented in JSONParser, YAMLParser, and LhaParser.
|
pure virtual |
Reads and parses a DBNode hierarchy from a file.
Typical implementations:
| filename | Path of the file to read. |
| std::runtime_error | if the file cannot be opened or if parsing fails. |
Implemented in JSONParser, YAMLParser, and LhaParser.
|
pure virtual |
Serializes a DBNode hierarchy to a file.
Implementations are free to choose their own textual encoding (YAML, JSON, etc.) but should be compatible with readFromFile() for round-trip usage.
| filename | Path of the target file. |
| root | Root DBNode to serialize. |
| std::runtime_error | if the file cannot be opened or a write error occurs. |
Implemented in LhaParser, JSONParser, and YAMLParser.