The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::app::ConfigApplicator Class Referenceabstract

Base class for applying parameters or configuration files to the simulator device tree. Contains a parameter or configuration file "action" to be applied to a tree. More...

#include <ConfigApplicators.hpp>

Inheritance diagram for sparta::app::ConfigApplicator:

Classes

struct  ApplyFilter
 Represents a filter for applying parameters based on tree location. More...
 

Public Types

enum class  ApplySuccessCondition { ASC_DEFER = 0 , ASC_MUST_ASSIGN = 1 , ASC_IGNORE = 2 , MAX_ASC }
 Type for dictating how tryApply should behave. More...
 
enum class  LocationFilter { ALL = 0 , AT_OR_BELOW_NODE , MAX_AF }
 Type for dictating how to filter the parameter application. (i.e. only apply to certain parts of the tree) More...
 

Public Member Functions

virtual ~ConfigApplicator ()
 Virtual destructor.
 
virtual void applyUnbound (sparta::ParameterTree &ptree, bool verbose=false) const =0
 Apply the parameter contained in this object to the unbound (virtual) parameter tree ptree.
 
void apply (sparta::TreeNode *root, ApplyFilter filter=ApplyFilter(), bool verbose=false)
 Apply the parameter contained in this object to the tree starting at root.
 
virtual void tryApply (sparta::TreeNode *root, ApplySuccessCondition required, ApplyFilter filter=ApplyFilter(), bool verbose=false) const =0
 Apply the parameter contained in this object to the tree starting at root.
 
virtual std::string stringize () const =0
 Render this parameter action as a string.
 

Detailed Description

Base class for applying parameters or configuration files to the simulator device tree. Contains a parameter or configuration file "action" to be applied to a tree.

This base class exists for app types of simulator configuration so that they can be ordered in a single vector.

Note
Subclasses must be copy-constructable and copy-assignable..

Definition at line 35 of file ConfigApplicators.hpp.

Member Enumeration Documentation

◆ ApplySuccessCondition

Type for dictating how tryApply should behave.

Enumerator
ASC_DEFER 

Defer to another layer in the parameter-application process to make the decision (i.e. do not override)

ASC_MUST_ASSIGN 

Must assign the parameter to success.

ASC_IGNORE 

Ignore failures to assign the parameter.

Definition at line 46 of file ConfigApplicators.hpp.

◆ LocationFilter

Type for dictating how to filter the parameter application. (i.e. only apply to certain parts of the tree)

Enumerator
ALL 

Apply configuration to any nodes that match pattern and type (typical)

AT_OR_BELOW_NODE 

Apply configuration to any nodes that are or are below a given filter node. Typically, this is used with ApplySuccessCondition::ASC_IGNORE to re-apply parameters to a part of the tree.

MAX_AF 

Apply configuration only to a given filter node if applicable. (unimplemented)

Apply configuration to any nodes that are below a given filter node, excluding the filter node itself. (unimplemneted)

Enum maximum (invalid)

Definition at line 57 of file ConfigApplicators.hpp.

Constructor & Destructor Documentation

◆ ~ConfigApplicator()

virtual sparta::app::ConfigApplicator::~ConfigApplicator ( )
inlinevirtual

Virtual destructor.

Definition at line 41 of file ConfigApplicators.hpp.

Member Function Documentation

◆ apply()

void sparta::app::ConfigApplicator::apply ( sparta::TreeNode root,
ApplyFilter  filter = ApplyFilter(),
bool  verbose = false 
)
inline

Apply the parameter contained in this object to the tree starting at root.

Parameters
rootRoot of tree to apply parameter(s) too
Exceptions
Ifparameter can not be set

Definition at line 202 of file ConfigApplicators.hpp.

Here is the call graph for this function:

◆ applyUnbound()

virtual void sparta::app::ConfigApplicator::applyUnbound ( sparta::ParameterTree ptree,
bool  verbose = false 
) const
pure virtual

Apply the parameter contained in this object to the unbound (virtual) parameter tree ptree.

Note
This is done before device-tree-building so that parameters can be used for defining topology

Implemented in sparta::app::ParameterApplicator, sparta::app::ParameterDefaultApplicator, sparta::app::NodeConfigFileApplicator, and sparta::app::ArchNodeConfigFileApplicator.

◆ stringize()

virtual std::string sparta::app::ConfigApplicator::stringize ( ) const
pure virtual

◆ tryApply()

virtual void sparta::app::ConfigApplicator::tryApply ( sparta::TreeNode root,
ApplySuccessCondition  required,
ApplyFilter  filter = ApplyFilter(),
bool  verbose = false 
) const
pure virtual

Apply the parameter contained in this object to the tree starting at root.

Parameters
rootRoot of tree to apply parameter(s) too

Implemented in sparta::app::NodeConfigFileApplicator, sparta::app::ArchNodeConfigFileApplicator, sparta::app::ParameterApplicator, and sparta::app::ParameterDefaultApplicator.


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