KIDS  ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
Loading...
Searching...
No Matches
PROJECT_NS::RuleSet Class Referencefinal

Represents a handler for input/output operations related to expressions. More...

#include <RuleSet.h>

Collaboration diagram for PROJECT_NS::RuleSet:
Collaboration graph

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
 

Detailed Description

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.

Definition at line 48 of file RuleSet.h.

Constructor & Destructor Documentation

◆ ~RuleSet()

virtual PROJECT_NS::RuleSet::~RuleSet ( )
inlinevirtual

Destructor.

Closes the output file stream.

Definition at line 72 of file RuleSet.h.

◆ RuleSet() [1/2]

PROJECT_NS::RuleSet::RuleSet ( )
inlineprivate

Definition at line 91 of file RuleSet.h.

Referenced by registerRulesInRuleSet().

Here is the caller graph for this function:

◆ RuleSet() [2/2]

PROJECT_NS::RuleSet::RuleSet ( std::shared_ptr< RuleEvaluator > & expr_rule)
private

Constructor.

Initializes the RuleSet instance with the given RuleEvaluator and file name. Opens the output file stream.

Parameters
expr_rulePointer to the RuleEvaluator.

Definition at line 34 of file RuleSet.cpp.

References appendHeader(), header, rules, totalFrameNumber, and unique_name.

Here is the call graph for this function:

Member Function Documentation

◆ appendHeader()

void PROJECT_NS::RuleSet::appendHeader ( std::shared_ptr< RuleEvaluator > & expr_rule)
private

Append header information to the output file.

Parameters
expr_rulePointer 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

void PROJECT_NS::RuleSet::flush ( const std::string & path,
int level )
private

Flush data to the output file.

Parameters
pathPath 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.

Here is the call graph for this function:

◆ flush_all()

void PROJECT_NS::RuleSet::flush_all ( const std::string & path,
int level )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getResult()

Result PROJECT_NS::RuleSet::getResult ( int level)

Definition at line 106 of file RuleSet.cpp.

References utils::concat(), rules, and totalFrameNumber.

Here is the call graph for this function:

◆ getRules()

std::vector< std::shared_ptr< RuleEvaluator > > & PROJECT_NS::RuleSet::getRules ( )

Definition at line 104 of file RuleSet.cpp.

References rules.

◆ getRuleSets()

std::vector< std::shared_ptr< RuleSet > > & PROJECT_NS::RuleSet::getRuleSets ( )
static

Get the list of RuleSet instances.

Returns
A reference to the list of RuleSet instances.

Definition at line 12 of file RuleSet.cpp.

Referenced by flush_all(), and registerRulesInRuleSet().

Here is the caller graph for this function:

◆ registerRules()

void PROJECT_NS::RuleSet::registerRules ( std::shared_ptr< RuleEvaluator > & exprRule)
private

Definition at line 29 of file RuleSet.cpp.

References registerRulesInRuleSet(), and rules.

Here is the call graph for this function:

◆ registerRulesInRuleSet()

void PROJECT_NS::RuleSet::registerRulesInRuleSet ( std::shared_ptr< RuleEvaluator > & exprRule)
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.

Parameters
expr_rulePointer to the RuleEvaluator to be registered.

Definition at line 17 of file RuleSet.cpp.

References getRuleSets(), and RuleSet().

Referenced by registerRules().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ Kernel_Recorder

friend class Kernel_Recorder
friend

Definition at line 84 of file RuleSet.h.

Member Data Documentation

◆ header

std::string PROJECT_NS::RuleSet::header
private

The header of set.

Definition at line 86 of file RuleSet.h.

Referenced by appendHeader(), flush(), and RuleSet().

◆ rules

std::vector<std::shared_ptr<RuleEvaluator> > PROJECT_NS::RuleSet::rules
private

List of RuleEvaluator.

Definition at line 88 of file RuleSet.h.

Referenced by flush(), getResult(), getRules(), registerRules(), and RuleSet().

◆ totalFrameNumber

size_t PROJECT_NS::RuleSet::totalFrameNumber
private

The number of frames.

Definition at line 87 of file RuleSet.h.

Referenced by flush(), getResult(), and RuleSet().

◆ unique_name

std::string PROJECT_NS::RuleSet::unique_name
private

Definition at line 85 of file RuleSet.h.

Referenced by flush(), and RuleSet().

◆ writeable

bool PROJECT_NS::RuleSet::writeable = true
private

Definition at line 89 of file RuleSet.h.


The documentation for this class was generated from the following files: