![]() |
KIDS
ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
|
Represents a handler for input/output operations related to expressions. More...
#include <RuleSet.h>
Public Member Functions | |
virtual | ~RuleSet () |
Destructor. | |
std::vector< std::shared_ptr< RuleEvaluator > > & | getRules () |
Result | getResult (int level) |
Static Public Member Functions | |
static std::vector< std::shared_ptr< RuleSet > > & | getRuleSets () |
Get the list of RuleSet instances. | |
static void | registerRulesInRuleSet (std::shared_ptr< RuleEvaluator > &exprRule) |
Register rules in the RuleSet for a specific input/output file. | |
static void | flush_all (const std::string &path, int level) |
Flush data to all output files. | |
Private Member Functions | |
RuleSet () | |
void | registerRules (std::shared_ptr< RuleEvaluator > &exprRule) |
RuleSet (std::shared_ptr< RuleEvaluator > &expr_rule) | |
Constructor. | |
void | flush (const std::string &path, int level) |
Flush data to the output file. | |
void | appendHeader (std::shared_ptr< RuleEvaluator > &expr_rule) |
Append header information to the output file. | |
Private Attributes | |
std::string | unique_name |
std::string | header |
The header of set. | |
size_t | totalFrameNumber |
The number of frames. | |
std::vector< std::shared_ptr< RuleEvaluator > > | rules |
List of RuleEvaluator. | |
bool | writeable = true |
Friends | |
class | Kernel_Recorder |
Represents a handler for input/output operations related to expressions.
This class manages the input/output operations for expressions. It allows registration of rules and flushing the data to files. Each rule is associated with specific input/output file names.
|
inlinevirtual |
|
inlineprivate |
Definition at line 91 of file RuleSet.h.
Referenced by registerRulesInRuleSet().
|
private |
Constructor.
Initializes the RuleSet instance with the given RuleEvaluator and file name. Opens the output file stream.
expr_rule | Pointer to the RuleEvaluator. |
Definition at line 34 of file RuleSet.cpp.
References appendHeader(), header, rules, totalFrameNumber, and unique_name.
|
private |
Append header information to the output file.
expr_rule | Pointer to the RuleEvaluator. |
Definition at line 74 of file RuleSet.cpp.
References utils::concat(), FMT, header, PROJECT_NS::kids_complex_type, and PROJECT_NS::kids_real_type.
Referenced by RuleSet().
|
private |
Flush data to the output file.
path | Path for writing the file Writes the file header followed by data for each frame according to registered rules. |
Definition at line 47 of file RuleSet.cpp.
References utils::concat(), header, rules, totalFrameNumber, and unique_name.
|
static |
Flush data to all output files.
Definition at line 42 of file RuleSet.cpp.
References getRuleSets().
Referenced by PROJECT_NS::Context::execute(), and PROJECT_NS::Handler::run_parallel().
Result PROJECT_NS::RuleSet::getResult | ( | int | level | ) |
Definition at line 106 of file RuleSet.cpp.
References utils::concat(), rules, and totalFrameNumber.
std::vector< std::shared_ptr< RuleEvaluator > > & PROJECT_NS::RuleSet::getRules | ( | ) |
Definition at line 104 of file RuleSet.cpp.
References rules.
|
static |
Get the list of RuleSet instances.
Definition at line 12 of file RuleSet.cpp.
Referenced by flush_all(), and registerRulesInRuleSet().
|
private |
Definition at line 29 of file RuleSet.cpp.
References registerRulesInRuleSet(), and rules.
|
static |
Register rules in the RuleSet for a specific input/output file.
If the RuleSet instance for the given file name already exists, the rule is added to it. Otherwise, a new RuleSet instance is created.
expr_rule | Pointer to the RuleEvaluator to be registered. |
Definition at line 17 of file RuleSet.cpp.
References getRuleSets(), and RuleSet().
Referenced by registerRules().
|
friend |
|
private |
The header of set.
Definition at line 86 of file RuleSet.h.
Referenced by appendHeader(), flush(), and RuleSet().
|
private |
List of RuleEvaluator.
Definition at line 88 of file RuleSet.h.
Referenced by flush(), getResult(), getRules(), registerRules(), and RuleSet().
|
private |
The number of frames.
Definition at line 87 of file RuleSet.h.
Referenced by flush(), getResult(), and RuleSet().
|
private |