TDMS
Time Domain Maxwell Solver
All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
InputFlags Class Reference
Collaboration diagram for InputFlags:
[legend]

Public Member Functions

 InputFlags (const std::string &_input_filename, bool fail_on_not_found=false)
 Construct a new InputFlags object by reading flags from the input file provided.
 
bool operator[] (const std::string &flag_name) const
 Return the value of the flag corresponding to the name provided.
 
void report_flag_state ()
 Prompts spdlog to report the value of every expected flag in the input file.
 

Private Member Functions

const int position_from_name (const std::string &flag_name) const
 Returns the internal index in flag_values of the flag with the name provided.
 
bool fetch_flag_value (const std::string flag_name, bool fail_on_not_found=false) const
 Fetch the value of the flag variable from the input file.
 

Private Attributes

std::string input_filename = "input_file.mat"
 Name of the input file to read flags from.
 
bool flag_values [NFLAGS] = {false}
 Flag values present in the input file.
 

Constructor & Destructor Documentation

◆ InputFlags()

InputFlags::InputFlags ( const std::string &  _input_filename,
bool  fail_on_not_found = false 
)
inline

Construct a new InputFlags object by reading flags from the input file provided.

The user may optionally specify that an error should be thrown if flags cannot be found through the fail_on_not_found argument.

Parameters
_input_filenameThe input file to read from
fail_on_not_foundIf true, any flags that cannot be located in the input file will cause an error to be thrown.

Member Function Documentation

◆ fetch_flag_value()

bool InputFlags::fetch_flag_value ( const std::string  flag_name,
bool  fail_on_not_found = false 
) const
private

Fetch the value of the flag variable from the input file.

Parameters
flag_nameThe name of the flag to fetch
fail_on_not_foundIf true, throw an error if the flag cannot be located. Otherwise, return the default flag value.
Returns
true This flag was present and set to true
false This flag was present and set to false, OR was not present

◆ position_from_name()

const int InputFlags::position_from_name ( const std::string &  flag_name) const
inlineprivate

Returns the internal index in flag_values of the flag with the name provided.

Parameters
flag_nameName of the flag
Returns
const int Index of this flag's value in flag_values

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