Go back to Home
Parameters
This library defines parameter parsing for a program. The parameters can be either given in the arguments to a program, or in a parameter file, which file name is passed to the program as an argument.
The parameters are defined as pairs, such as name=value
- If passed in arguments to the program, it has to be preceeded by –, i.e., –name=value
- In this case, no spaces can occur in this pair.
- If defined in a parameter file, DO NOT prepend – to the pair.
- In this case, you can put spaces any where
- lines starting with # are comment lines, these lines will be ignored
- empty lines are ignored
- If the same parameter name appeared more than once, the last occurrence will take effect.
- This can be used to override parameters defined in a parameter file by passing the same parameter name with a different value in an argument after the parameter file name.
The base class for all parameters is Argument, which basically does the following:
- holds the name of the parameter,
- use the to check if a pair can be parsed,
- defines a help message,
- holds the information whether a parameter is required or optional.
It Its subclassed defines parameters of various types. The defined subclasses include
- IntArgument, representing an integer
- FloatArgument, representing a float number
- StringArgument, representing a string
- BoolArgument, represent a boolean value, i.e., yes/no
- DistributionArgument, representing a SimDistribution
Files
- The definitions parameters.h
- The implementation parameters.cpp