KIDS  ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
Loading...
Searching...
No Matches
RuleSet.h
Go to the documentation of this file.
1
29#ifndef KIDS_RULESET_H
30#define KIDS_RULESET_H
31
32#include <map>
33#include <string>
34
35#include "kids/Result.h"
36#include "kids/RuleEvaluator.h"
37#include "kids/concat.h"
38#include "kids/fmt.h"
39
40namespace PROJECT_NS {
41
48class RuleSet final {
49 public:
55 static std::vector<std::shared_ptr<RuleSet>>& getRuleSets();
56
65 static void registerRulesInRuleSet(std::shared_ptr<RuleEvaluator>& exprRule);
66
72 virtual ~RuleSet(){};
73
77 static void flush_all(const std::string& path, int level);
78
79 std::vector<std::shared_ptr<RuleEvaluator>>& getRules();
80
81 Result getResult(int level);
82
83 private:
84 friend class Kernel_Recorder;
85 std::string unique_name;
86 std::string header;
88 std::vector<std::shared_ptr<RuleEvaluator>> rules;
89 bool writeable = true;
90
91 RuleSet() : writeable{false} {}; // @not registered
92
93 void registerRules(std::shared_ptr<RuleEvaluator>& exprRule);
94
103 RuleSet(std::shared_ptr<RuleEvaluator>& expr_rule);
104
111 void flush(const std::string& path, int level);
112
118 void appendHeader(std::shared_ptr<RuleEvaluator>& expr_rule);
119};
120}; // namespace PROJECT_NS
121
122#endif // KIDS_RULESET_H
provide Result class
provide RuleEvaluator class
Represents a handler for input/output operations related to expressions.
Definition RuleSet.h:48
std::vector< std::shared_ptr< RuleEvaluator > > rules
List of RuleEvaluator.
Definition RuleSet.h:88
std::string header
The header of set.
Definition RuleSet.h:86
void appendHeader(std::shared_ptr< RuleEvaluator > &expr_rule)
Append header information to the output file.
Definition RuleSet.cpp:74
void flush(const std::string &path, int level)
Flush data to the output file.
Definition RuleSet.cpp:47
static void registerRulesInRuleSet(std::shared_ptr< RuleEvaluator > &exprRule)
Register rules in the RuleSet for a specific input/output file.
Definition RuleSet.cpp:17
void registerRules(std::shared_ptr< RuleEvaluator > &exprRule)
Definition RuleSet.cpp:29
std::string unique_name
Definition RuleSet.h:85
static std::vector< std::shared_ptr< RuleSet > > & getRuleSets()
Get the list of RuleSet instances.
Definition RuleSet.cpp:12
Result getResult(int level)
Definition RuleSet.cpp:106
std::vector< std::shared_ptr< RuleEvaluator > > & getRules()
Definition RuleSet.cpp:104
size_t totalFrameNumber
The number of frames.
Definition RuleSet.h:87
virtual ~RuleSet()
Destructor.
Definition RuleSet.h:72
static void flush_all(const std::string &path, int level)
Flush data to all output files.
Definition RuleSet.cpp:42
utils for formating
< http://warp.povusers.org/FunctionParser/fparser.html
Definition Context.h:39