SST  13.0.0
SST::ConfigBase Class Reference

Base class to parse command line options for SST Simulation Configuration variables. More...

#include <configBase.h>

Inheritance diagram for SST::ConfigBase:
SST::ConfigShared SST::Config SST::SSTInfoConfig

Public Member Functions

int parseCmdLine (int argc, char *argv[], bool ignore_unknown=false)
 Parse command-line arguments to update configuration values. More...

Static Public Member Functions

static bool parseBoolean (const std::string &arg, bool &success, const std::string &option)

Protected Member Functions

 ConfigBase (bool suppress_print, bool suppress_sdl)
 ConfigBase constructor. More...
 ConfigBase ()
 Default constructor used for serialization. More...
int printUsage ()
 Called to print the help/usage message.
void addOption (struct option opt, const char *argname, const char *desc, std::function< int(const char *arg)> callback, bool header, bool sdl_avail)
 Add options to the Config object. More...
virtual std::string getUsagePrelude ()
 Called to get the prelude for the help/usage message.
virtual int checkArgsAfterParsing ()
void enableDashDashSupport (std::function< int(const char *arg)> callback)
void addPositionalCallback (std::function< int(int num, const char *arg)> callback)
std::string getRunName ()
 Get the name of the executable being run. More...
bool setOptionExternal (const std::string &entryName, const std::string &value)
 Set a configuration string to update configuration values.

Detailed Description

Base class to parse command line options for SST Simulation Configuration variables.

NOTE: This class contains only state for parsing the command line. All options will be stored in classes derived from this class. This means that we don't need to be able to serialize anything in this class.

Constructor & Destructor Documentation

◆ ConfigBase() [1/2]

SST::ConfigBase::ConfigBase ( bool  suppress_print,
bool  suppress_sdl 

ConfigBase constructor.

Meant to only be created by main function

◆ ConfigBase() [2/2]

SST::ConfigBase::ConfigBase ( )

Default constructor used for serialization.

After serialization, the Config object is only used to get the values of set options and it can no longer parse arguments. Given that, it will no longer print anything, so set suppress_print_ to true. None of this class needs to be serialized because it it's state is only for parsing the arguments.

Member Function Documentation

◆ addOption()

void SST::ConfigBase::addOption ( struct option  opt,
const char *  argname,
const char *  desc,
std::function< int(const char *arg)>  callback,
bool  header,
bool  sdl_avail 

Add options to the Config object.

The options will be added in the order they are in the input array, and across calls to the function.

◆ getRunName()

std::string SST::ConfigBase::getRunName ( )

Get the name of the executable being run.

This is only avaialable after parseCmdLine() is called.

Referenced by SST::SSTInfoConfig::getUsagePrelude().

◆ parseCmdLine()

int SST::ConfigBase::parseCmdLine ( int  argc,
char *  argv[],
bool  ignore_unknown = false 

Parse command-line arguments to update configuration values.

Returns 0 if execution should continue. Returns -1 if there was an error. Returns 1 if run command line only asked for information to be print (e.g. –help or -V, for example).

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