The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::app::FeatureConfiguration Class Reference

Collection of named feature values. More...

#include <FeatureConfiguration.hpp>

Classes

class  FeatureOptions
 

Public Member Functions

void setFeatureValue (const std::string &name, const unsigned int value)
 
unsigned int getFeatureValue (const std::string &feature_name) const
 
bool isFeatureValueSet (const std::string &feature_name) const
 
void setFeatureOptionsFromFile (const std::string &feature_name, const std::string &yaml_opts_fname)
 
const FeatureOptionsgetFeatureOptions (const std::string &feature_name) const
 

Detailed Description

Collection of named feature values.

Definition at line 27 of file FeatureConfiguration.hpp.

Member Function Documentation

◆ getFeatureOptions()

const FeatureOptions * sparta::app::FeatureConfiguration::getFeatureOptions ( const std::string &  feature_name) const
inline

Return the feature options data structure for the given feature name. If there are no options for this feature, this method still returns a non-null FeatureOptions pointer, though all of its option values will return the default value you pass in.

  auto feat_opts = feat_cfg->getFeatureOptions("nonexistent");
  sparta_assert(feat_opts != nullptr);

  // "pi equals 3.14" (despite having no option values)
  std::cout << feat_opts->getOptionValue<std::string>("nonexistent", "pi");
  std::cout << " equals ";
  std::cout << feat_opts->getOptionValue<double>("nonexistent", 3.14); 

Definition at line 230 of file FeatureConfiguration.hpp.

◆ getFeatureValue()

unsigned int sparta::app::FeatureConfiguration::getFeatureValue ( const std::string &  feature_name) const
inline

Definition at line 35 of file FeatureConfiguration.hpp.

◆ isFeatureValueSet()

bool sparta::app::FeatureConfiguration::isFeatureValueSet ( const std::string &  feature_name) const
inline

Definition at line 43 of file FeatureConfiguration.hpp.

◆ setFeatureOptionsFromFile()

void sparta::app::FeatureConfiguration::setFeatureOptionsFromFile ( const std::string &  feature_name,
const std::string &  yaml_opts_fname 
)
inline

Consume a feature options YAML file for a given feature name. This is typically done from CommandLineSimulator while parsing simulator options.

Definition at line 204 of file FeatureConfiguration.hpp.

◆ setFeatureValue()

void sparta::app::FeatureConfiguration::setFeatureValue ( const std::string &  name,
const unsigned int  value 
)
inline

Definition at line 30 of file FeatureConfiguration.hpp.


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