STORMM Source Documentation
Loading...
Searching...
No Matches
stormm::namelist::NamelistEmulator Class Reference

Collection of variables to transcribe information contained within a namelist. More...

#include <namelist_emulator.h>

Public Member Functions

 NamelistEmulator (const std::string &title_in, CaseSensitivity casing_in=CaseSensitivity::AUTOMATIC, ExceptionResponse unknown_keyword_policy=ExceptionResponse::WARN, const std::string &help_in=std::string("No description provided"), bool cli_content_in=false)
 Construct an object to emulate Fortran namelist functionality, with improvements.
 
const std::string & getTitle () const
 Obtain the title of this namelist (i.e. &cntrl or &dock)
 
bool isCommandLineContent () const
 Detect whether the namelist emulator serves command-line inputs for a program.
 
int getKeywordCount () const
 Obtain the number of parameters catalogged within this namelist emulator.
 
CaseSensitivity getCaseSensitivity () const
 Obtain the case sensitivity setting for this namelist.
 
ExceptionResponse getPolicy () const
 Relay the exception handling policy for this namelist.
 
const std::string & getKeyword (size_t index) const
 Get a keyword from this namelist based on an index. This is for retrieving the keyword itself, not a value associated with a keyword.
 
NamelistType getKeywordKind (const std::string &keyword_query) const
 Get the type of a specific keyword within this namelist.
 
int getKeywordEntries (const std::string &keyword_query) const
 Get the number of entries associated with a specific keyword.
 
int getSubKeyCount (const std::string &keyword_query) const
 Get the template size of a keyword, the number of sub-keys it contains. For non-struct keywords the template size is reported as 0.
 
std::vector< bool > getAllBoolValues (const std::string &keyword_query, const std::string &sub_key) const
 Get all boolen values assigned to a particular keyword. The keyword must have STRUCT type, as the only other option for a BOOL keyword is a single value.
 
std::vector< int > getAllIntValues (const std::string &keyword_query, const std::string &sub_key=std::string("")) const
 Get all integer values assigned to a particular keyword.
 
std::vector< double > getAllRealValues (const std::string &keyword_query, const std::string &sub_key=std::string("")) const
 Get all real values assigned to a particular keyword.
 
std::vector< std::string > getAllStringValues (const std::string &keyword_query, const std::string &sub_key=std::string("")) const
 Get all string values assigned to a particular keyword.
 
const std::string & getHelp () const
 Report the help message associated with a keyword or sub-key. This can be useful for developers who wish to alert users to erroneous input.
 
const std::string & getHelp (const std::string &keyword_query) const
 
const std::string & getHelp (const std::string &keyword_query, const std::string &sub_key) const
 
const NamelistEmulatorgetSelfPointer () const
 Get a pointer to the object itself.
 
void setTitle (const std::string &title_in)
 Set the title of the namelist.
 
void setCommandLineContent (bool cli_content_in=true)
 Set whether the namelist actually serves command line input for a whole program.
 
void addDefaultValue (const std::string &key, const std::string &next_default)
 Add a value to one keyword's default settings. This enables a single keyword to have a collection of default values. The keyword will be checked to ensure that it permits multiple values.
 
void triggerResizeBuffer (const std::string &key)
 When loading data for STRUCT-type keywords, the decision to increment the number of entries on file cannot be made with the first sub-key assignment. Instead, the entire struct must be read from input before the number of entries can be incremented. Because a function (readNamelist(), see input.h) that manages a NamelistEmulator loops over the input that can be associated with each list of subk-eys for a given STRUCT, that function must go through the NamelistEmulator in order to increment the keyword's entry count.
 
void addCategory (const std::string &new_category)
 Add a category to a namelist to group its keywords for user documentation.
 
void categorizeKeyword (const std::string &key, const std::string &category_label)
 Place a namelist keyword into one of a list of arbitrary categories defined by the developer. This is for organizing the user documentation.
 
void printKeywordDocumentation (int p_idx, int name_width, int kw_kind_width, const std::string &kw_dflt) const
 Print the documentation for a specific keyword. The format is fixed in the sense that it will have a set indentation, a dash for a bullet point, and the keyword printed in a space large enough for a series of related keywords in a column.
 
std::string convertDefaultToString (const NamelistElement &tkw) const
 Convert the default value of a keyword to a string for output in a formatted table.
 
void printHelp () const
 Print a detailed message concerning the user documentation for keywords in this namelist. This function can be called from the main program, for any namelists that accept its inputs, and is itself called by the printProgramDocumentation() function in the docs namespace (see Reporting/custom_help.h)
 
InputStatus getKeywordStatus (const std::string &keyword_query) const
 Test whether a keyword has been set, be that by default or user input.
 
InputStatus getKeywordStatus (const std::string &keyword_query, const std::string &sub_key, int repeat_no=0) const
 
bool hasKeyword (const std::string &query) const
 Test whether a namelist contains a particular keyword at all.
 
bool hasKeyword (const std::string &query, NamelistType query_kind) const
 
bool getBoolValue (const std::string &keyword_query) const
 Get the value of a boolean keyword from the within the namelist.
 
bool getBoolValue (const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
int getIntValue (const std::string &keyword_query, int index=0) const
 Get a labeled integer value from within the namelist.
 
int getIntValue (const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
double getRealValue (const std::string &keyword_query, int index=0) const
 Get a labeled real number value from within the namelist.
 
double getRealValue (const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
const std::string & getStringValue (const std::string &keyword_query, int index=0) const
 Get a labeled string value from within the namelist.
 
const std::string & getStringValue (const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
template<typename T>
void assignVariable (T *var, double mult, const std::string &keyword_query, int index=0) const
 Assign a value, external to the object, based on the content inside of it. This will first check whether the appropriate keyword is not missing (that is has a default value, or has been specified by the user). If the associated keyword is indeed missing, there will be no effect on the external variable.
 
template<typename T>
void assignVariable (T *var, const std::string &keyword_query, int index=0) const
 
void assignVariable (std::string *var, double mult, const std::string &keyword_query, int index=0) const
 
void assignVariable (std::string *var, const std::string &keyword_query, int index=0) const
 
template<typename T>
void assignVariable (T *var_x, T *var_y, T *var_z, double mult, const std::string &keyword_query, int index=0) const
 
template<typename T>
void assignVariable (T *var_x, T *var_y, T *var_z, const std::string &keyword_query, int index=0) const
 
template<typename T>
void assignVariable (T *var, const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
template<typename T>
void assignVariable (T *var, double mult, const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
void assignVariable (std::string *var, double mult, const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
void assignVariable (std::string *var, const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
template<typename T>
void assignVariable (T *var_x, T *var_y, T *var_z, double mult, const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
template<typename T>
void assignVariable (T *var_x, T *var_y, T *var_z, const std::string &keyword_query, const std::string &sub_key, int index=0) const
 
void addKeyword (const std::vector< NamelistElement > &new_keys)
 Add a keyword to the namelist.
 
void addKeywords (const std::vector< NamelistElement > &new_keys)
 
void addKeyword (const NamelistElement &new_key)
 
void addKeyword (const std::string &keyword_in, NamelistType kind_in, const std::string &default_in=std::string(""), DefaultIsObligatory obligate=DefaultIsObligatory::NO, InputRepeats rep_in=InputRepeats::NO, const std::string &help_in=std::string("No description provided"))
 
void addKeyword (const std::string keyword_in, const std::vector< std::string > &sub_keys_in, const std::vector< NamelistType > &sub_kinds_in, const std::vector< std::string > &default_list, DefaultIsObligatory obligate_list=DefaultIsObligatory::NO, InputRepeats rep_in=InputRepeats::NO, const std::string &help_in=std::string("No description provided"), const std::vector< std::string > &sub_help_in=std::vector< std::string >(1, "No description provided"), const std::vector< KeyRequirement > &template_requirements_in={})
 
void addKeyword (const NamelistEmulator *other, const std::string &query)
 
void addKeyword (const NamelistEmulator &other, const std::string &query)
 
void setDefaultValue (const std::string &key, const std::string &modified_default, int default_idx=0)
 Set a default value for one of the namelist's keywords. Like addDefaultValue() and other functions below, the effect will be to pass through the NamelistEmulator to.
 
void setDefaultValue (const std::string &key, const std::vector< std::string > &modified_defaults, const std::vector< std::string > &sub_key_specs)
 
void activateBool (const std::string &key)
 Activate a BOOL-type keyword, or a BOOL-type member of a STRUCT-type keyword. These functions are analogous to assignElement() below, but because BOOL-type keywords do not take distinct values the functions that set BOOL-type variables to ON are named differently.
 
void activateBool (const std::string &key, const std::string &sub_key)
 
int assignElement (const std::string &key, const std::string &value)
 Assign values to elements of each particular NamelistType. These overloaded functions can be called from anywhere, but constructors making control objects for programs using the STORMM libraries are the ideal place to use them. They in turn call the set(...)Value member functions of the target NamelistElement object in the NamelistEmulator. Returns 1 if the given value was successfully assigned to the label or 0 if not.
 
int assignElement (const std::string &key, const std::string &sub_key, const std::string &value)
 
void addHelp (const std::string &blurb)
 Attach a help message to the namelist itself, to a keyword within the namelist, or even to a member variable of a STRUCT-associated keyword in the namelist. This is provided so that developers do not have to include help messages at the initialization of each namelist keyword. This will overwrite existing help messages.
 
void addHelp (const std::string &key, const std::string &blurb)
 
void addHelp (const std::string &key, const std::string &sub_key, const std::string &blurb)
 
void setImperative (const std::string &key, KeyRequirement req)
 Change the requirement associated with a keyword. By default, all keywords are set to "REQUIRED" just as all STRUCT-type keyword subkeys are required unless stated otherwise. Even if required, many keywords, like STRUCT subkeys, will have default values that satisfy the requirements.
 
void setImperative (const std::vector< std::string > &directives)
 
void setImperative (const std::string &key, const std::vector< std::string > &directives)
 
std::string printContents (int file_width=default_output_file_width, int max_entry_counts=4, NamelistIntroduction print_decor=NamelistIntroduction::HEADER) const
 Print a complete table of the values for all parameters in this namelist, starting including their sources (input statuses, i.e. DEFAULT, MISSING, or USER-SPECIFIED).
 
void printContents (std::ostream *foutp, int file_width=default_output_file_width, int max_entry_counts=4, NamelistIntroduction print_decor=NamelistIntroduction::HEADER) const
 
void printContents (std::ofstream *foutp, int file_width=default_output_file_width, int max_entry_counts=4, NamelistIntroduction print_decor=NamelistIntroduction::HEADER) const
 
void printContents (const std::string &file_name, PrintSituation expectation, int file_width=default_output_file_width, int max_entry_counts=4, NamelistIntroduction print_decor=NamelistIntroduction::HEADER) const
 

Detailed Description

Collection of variables to transcribe information contained within a namelist.

Constructor & Destructor Documentation

◆ NamelistEmulator()

stormm::namelist::NamelistEmulator::NamelistEmulator ( const std::string & title_in,
CaseSensitivity casing_in = CaseSensitivity::AUTOMATIC,
ExceptionResponse unknown_keyword_policy = ExceptionResponse::WARN,
const std::string & help_in = std::string("No description provided"),
bool cli_content_in = false )

Construct an object to emulate Fortran namelist functionality, with improvements.

Parameters
title_inThe title of the namelist
casing_inCase sensitivity to abide (default "AUTOMATIC", which in this context means that namelist titles and keywords are case insensitive but values are case sensitive)

Member Function Documentation

◆ activateBool()

void stormm::namelist::NamelistEmulator::activateBool ( const std::string & key)

Activate a BOOL-type keyword, or a BOOL-type member of a STRUCT-type keyword. These functions are analogous to assignElement() below, but because BOOL-type keywords do not take distinct values the functions that set BOOL-type variables to ON are named differently.

Overloaded:

  • Activate the named BOOL keyword
  • Activate a BOOL sub-key within the named STRUCT
Parameters
keyThe keyword of interest
sub_keyThe sub-key of interest

◆ addCategory()

void stormm::namelist::NamelistEmulator::addCategory ( const std::string & new_category)

Add a category to a namelist to group its keywords for user documentation.

Parameters
new_categoryThe name of the new keyword category

◆ addDefaultValue()

void stormm::namelist::NamelistEmulator::addDefaultValue ( const std::string & key,
const std::string & next_default )

Add a value to one keyword's default settings. This enables a single keyword to have a collection of default values. The keyword will be checked to ensure that it permits multiple values.

Parameters
keyThe keyword of interest
next_defaultThe new value to include, as a string, to be re-interpreted as necessary

◆ addHelp()

void stormm::namelist::NamelistEmulator::addHelp ( const std::string & blurb)

Attach a help message to the namelist itself, to a keyword within the namelist, or even to a member variable of a STRUCT-associated keyword in the namelist. This is provided so that developers do not have to include help messages at the initialization of each namelist keyword. This will overwrite existing help messages.

Overloaded:

  • Attach a help message to the namelist as a whole
  • Attach a help message to any keyword (including STRUCTs) within the namelist
  • Attach a help message to a sub-key within a STRUCT keyword in the namelist
Parameters
blurbThe help message to attach
keyLabel of the namelist keyword to which the help message gets attached
sub_keyLabel of the member variable of the STRUCT namelist keyword to which the help message gets attached

◆ addKeyword()

void stormm::namelist::NamelistEmulator::addKeyword ( const std::vector< NamelistElement > & new_keys)

Add a keyword to the namelist.

Overloaded:

  • Add a single keyword (be it a INTEGER, REAL, STRING, or STRUCT namelist element)
  • Add multiple keywords
  • Provide a NamelistElement object
  • Provide input parameters with one-to-one correspondence to NameListElement objects (this can save space and make the API cleaner)
  • Import a named keyword from another NamelistEmulator object (the other object will be checked to see that it has the keyword of interest)
Parameters
new_keysThe keywords to add
new_keyThe keyword to add
otherAnother NamelistEmulator from which to import a keyword
queryName of the keyword to copy from another NamelistEmulator

◆ assignElement()

int stormm::namelist::NamelistEmulator::assignElement ( const std::string & key,
const std::string & value )

Assign values to elements of each particular NamelistType. These overloaded functions can be called from anywhere, but constructors making control objects for programs using the STORMM libraries are the ideal place to use them. They in turn call the set(...)Value member functions of the target NamelistElement object in the NamelistEmulator. Returns 1 if the given value was successfully assigned to the label or 0 if not.

Overloaded:

  • Assign a single integer, real, or string value to an INTEGER, REAL, or STRING namelist element, respectively
  • Assign a single integer, real, or string value to the INTEGER, REAL, or STRING member of a STRUCT namelist element
Parameters
keyThe keyword of interest
sub_keyThe sub-key of interest
sub_keyThe value to assign to the keyword or STRUCT sub-key

◆ assignVariable()

template<typename T>
void stormm::namelist::NamelistEmulator::assignVariable ( T * var,
double mult,
const std::string & keyword_query,
int index = 0 ) const

Assign a value, external to the object, based on the content inside of it. This will first check whether the appropriate keyword is not missing (that is has a default value, or has been specified by the user). If the associated keyword is indeed missing, there will be no effect on the external variable.

Overloaded:

  • Assign other integers
  • Assign other real values
  • Assign other strings
  • Assign triplets of other numerical variables (useful for cases where a generic keyword can assign settings for all three dimensions of an object)
  • Provide a multiplier to scale the units of user input into internal units (a common case is degrees to radians)
Parameters
varThe integer, real, or string ariable to assign
multMultiplication factor to apply to any value extracted from the &namelist. This factor is only available for scalar results (or triplicate input extractions) and will be cast to the data type of var for integral types.
keyword_queryThe keyword associated with the input data of interest
sub_keyThe sub-key within a STRUCT associated with the input data of interest
indexIndex of the keyword repeat to retrieve

◆ categorizeKeyword()

void stormm::namelist::NamelistEmulator::categorizeKeyword ( const std::string & key,
const std::string & category_label )

Place a namelist keyword into one of a list of arbitrary categories defined by the developer. This is for organizing the user documentation.

Parameters
keyThe namelist keyword to find and categorize
category_labelThe category to put it in

◆ convertDefaultToString()

std::string stormm::namelist::NamelistEmulator::convertDefaultToString ( const NamelistElement & tkw) const

Convert the default value of a keyword to a string for output in a formatted table.

Parameters
tkwThe keyword of interest

◆ getAllBoolValues()

std::vector< bool > stormm::namelist::NamelistEmulator::getAllBoolValues ( const std::string & keyword_query,
const std::string & sub_key ) const

Get all boolen values assigned to a particular keyword. The keyword must have STRUCT type, as the only other option for a BOOL keyword is a single value.

Parameters
keyword_queryIdentifier of the keyword of interest

◆ getAllIntValues()

std::vector< int > stormm::namelist::NamelistEmulator::getAllIntValues ( const std::string & keyword_query,
const std::string & sub_key = std::string("") ) const

Get all integer values assigned to a particular keyword.

Parameters
keyword_queryIdentifier of the keyword of interest

◆ getAllRealValues()

std::vector< double > stormm::namelist::NamelistEmulator::getAllRealValues ( const std::string & keyword_query,
const std::string & sub_key = std::string("") ) const

Get all real values assigned to a particular keyword.

Parameters
keyword_queryIdentifier of the keyword of interest

◆ getAllStringValues()

std::vector< std::string > stormm::namelist::NamelistEmulator::getAllStringValues ( const std::string & keyword_query,
const std::string & sub_key = std::string("") ) const

Get all string values assigned to a particular keyword.

Parameters
keyword_queryIdentifier of the keyword of interest

◆ getBoolValue()

bool stormm::namelist::NamelistEmulator::getBoolValue ( const std::string & keyword_query) const

Get the value of a boolean keyword from the within the namelist.

Overloaded:

  • Get a BOOL value for a non-STRUCT keyword
  • Get a BOOL value from within a STRUCT keyword
Parameters
keyword_queryIdentifier of the keyword of interest
sub_keyIdentifier for the member variable within the STRUCT of interest
indexFor keywords that store multiple values, retrieve this value

◆ getHelp()

const std::string & stormm::namelist::NamelistEmulator::getHelp ( ) const

Report the help message associated with a keyword or sub-key. This can be useful for developers who wish to alert users to erroneous input.

Overloaded:

  • Report user documentation for the namelist as a whole
  • Report user documentation for any keyword (including STRUCTs) within the namelist
  • Report user documentation for a sub-key within a STRUCT keyword in the namelist
Parameters
keyword_queryIdentifier of the keyword of interest
sub_keyIdentifier for the member variable within the STRUCT of interest

◆ getIntValue()

int stormm::namelist::NamelistEmulator::getIntValue ( const std::string & keyword_query,
int index = 0 ) const

Get a labeled integer value from within the namelist.

Overloaded:

  • Get an INTEGER value for a non-STRUCT keyword
  • Get an INTEGER value from within a STRUCT keyword
Parameters
keyword_queryIdentifier of the keyword of interest
sub_keyIdentifier for the member variable within the STRUCT of interest
indexFor keywords that store multiple values, retrieve this value

◆ getKeyword()

const std::string & stormm::namelist::NamelistEmulator::getKeyword ( size_t index) const

Get a keyword from this namelist based on an index. This is for retrieving the keyword itself, not a value associated with a keyword.

Parameters
indexIndex of the keyword in the list held by this namelist. In fact, this is best used to step through the list of keywords in the order they were added, not much more.

◆ getKeywordEntries()

int stormm::namelist::NamelistEmulator::getKeywordEntries ( const std::string & keyword_query) const

Get the number of entries associated with a specific keyword.

Parameters
keyword_queryThe keyword of interest

◆ getKeywordKind()

NamelistType stormm::namelist::NamelistEmulator::getKeywordKind ( const std::string & keyword_query) const

Get the type of a specific keyword within this namelist.

Parameters
keyword_queryThe keyword of interest

◆ getKeywordStatus()

InputStatus stormm::namelist::NamelistEmulator::getKeywordStatus ( const std::string & keyword_query) const

Test whether a keyword has been set, be that by default or user input.

Overloaded:

  • Get the status of the first instance of a keyword
  • Get the status of a sub-key within a keyword
  • Get the status of a specific, repeated specification of a keyword
Parameters
keyword_queryThe keyword of interest
sub_keyThe keyword of interest
repeat_noThe number of the repetition to check for its status. This is needed only in the case of STRUCT-type keywords, as a plain INTEGER, REAL, or STRING keyword will be "established" if there is but one default or user-specified value given–subsequent applications of such a keyword are, by construction, established (status cannot be missing). In contrast, a STRUCT keyword can be specified many times, but the status of its individual members may still be inquestion if not all components of the STRUCT are given in each application.

◆ getRealValue()

double stormm::namelist::NamelistEmulator::getRealValue ( const std::string & keyword_query,
int index = 0 ) const

Get a labeled real number value from within the namelist.

Overloaded:

  • Get a REAL value associated with a non-STRUCT keyword
  • Get a REAL value from within a STRUCT keyword
Parameters
keyword_queryIdentifier of the keyword of interest
sub_keyIdentifier for the member variable within the STRUCT of interest
indexFor keywords that store multiple values, retrieve this value

◆ getStringValue()

const std::string & stormm::namelist::NamelistEmulator::getStringValue ( const std::string & keyword_query,
int index = 0 ) const

Get a labeled string value from within the namelist.

Overloaded:

  • Get a STRING value associated with a non-STRUCT keyword
  • Get a STRING value from within a STRUCT keyword
Parameters
keyword_queryIdentifier of the keyword of interest
sub_keyIdentifier for the member variable within the STRUCT of interest
indexFor keywords that store multiple values, retrieve this value

◆ hasKeyword()

bool stormm::namelist::NamelistEmulator::hasKeyword ( const std::string & query) const

Test whether a namelist contains a particular keyword at all.

Overloaded:

  • Test for a keyword by name only
  • Test for a named keyword of a specific type
Parameters
queryThe keyword to search for
query_kindThe type that the keyword must have if it is present

◆ printContents()

std::string stormm::namelist::NamelistEmulator::printContents ( int file_width = default_output_file_width,
int max_entry_counts = 4,
NamelistIntroduction print_decor = NamelistIntroduction::HEADER ) const

Print a complete table of the values for all parameters in this namelist, starting including their sources (input statuses, i.e. DEFAULT, MISSING, or USER-SPECIFIED).

Overloaded:

  • Write to a string for further processing
  • Write directly to an output file stream
  • Write to a named output file, given a state that it must be found in
Parameters
foutpFile to which information should be printed, defaulting to the terminal
file_widthThe width at which to print results (this parameter will be ignored and replaced with the terminal width if the output goes to the terminal)
max_entry_reportsThe maximum number of entries to report from any given keyword
print_decorIndicate whether to introduce the namelist or rely on some previous iteration writing to the same file

◆ printKeywordDocumentation()

void stormm::namelist::NamelistEmulator::printKeywordDocumentation ( int p_idx,
int name_width,
int kw_kind_width,
const std::string & kw_dflt ) const

Print the documentation for a specific keyword. The format is fixed in the sense that it will have a set indentation, a dash for a bullet point, and the keyword printed in a space large enough for a series of related keywords in a column.

Parameters
p_idxIndex of the keyword within the namelist emulator
name_widthWidth at which to print keyword names
kw_kind_widthWidth at which to print keyword kinds
kw_dfltDefault value of the parameter, pre-converted to a string and pre-pended with white space for alignment

◆ setCommandLineContent()

void stormm::namelist::NamelistEmulator::setCommandLineContent ( bool cli_content_in = true)

Set whether the namelist actually serves command line input for a whole program.

Parameters
cli_content_inSet to TRUE to indicate that the namelist does command line parsing

◆ setDefaultValue()

void stormm::namelist::NamelistEmulator::setDefaultValue ( const std::string & key,
const std::string & modified_default,
int default_idx = 0 )

Set a default value for one of the namelist's keywords. Like addDefaultValue() and other functions below, the effect will be to pass through the NamelistEmulator to.

Parameters
keyThe name of the keyword within the namelist
modified_defaultThe new default setting to apply to the keyword
default_idxThe index of the default to set, in the event that there are already multiple default values
modified_defaultsThe list of modified default values
sub_key_specsThe list of sub-keys to which each default corresponds

◆ setImperative()

void stormm::namelist::NamelistEmulator::setImperative ( const std::string & key,
KeyRequirement req )

Change the requirement associated with a keyword. By default, all keywords are set to "REQUIRED" just as all STRUCT-type keyword subkeys are required unless stated otherwise. Even if required, many keywords, like STRUCT subkeys, will have default values that satisfy the requirements.

Overloaded:

  • Set the criticality of a keyword
  • Set the criticality of a subkey within a STRUCT keyword
Parameters
keyThe namelist keyword to find and alter
sub_key_queryName of the sub-key to search if the namelist element is a STRUCT
reqThe requirement level to impose

◆ setTitle()

void stormm::namelist::NamelistEmulator::setTitle ( const std::string & title_in)

Set the title of the namelist.

Parameters
title_inThe title to set

◆ triggerResizeBuffer()

void stormm::namelist::NamelistEmulator::triggerResizeBuffer ( const std::string & key)

When loading data for STRUCT-type keywords, the decision to increment the number of entries on file cannot be made with the first sub-key assignment. Instead, the entire struct must be read from input before the number of entries can be incremented. Because a function (readNamelist(), see input.h) that manages a NamelistEmulator loops over the input that can be associated with each list of subk-eys for a given STRUCT, that function must go through the NamelistEmulator in order to increment the keyword's entry count.

Parameters
keyThe STRUCT-type keyword of interest (its membership in the namelist will be verified)

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