PetaVision
Alpha
|
#include <ConfigFileArguments.hpp>
Public Member Functions | |
ConfigFileArguments (std::string const &configFile, MPI_Comm communicator, bool allowUnrecognizedArguments) | |
virtual | ~ConfigFileArguments () |
bool const & | getBooleanArgument (std::string const &name) const |
int const & | getIntegerArgument (std::string const &name) const |
Configuration::IntOptional const & | getIntOptionalArgument (std::string const &name) const |
std::string const & | getStringArgument (std::string const &name) const |
Configuration::ConfigurationType | getType (std::string const &name) const |
unsigned int const & | getUnsignedIntArgument (std::string const &name) const |
int | printState () const |
void | resetState (std::string const &configFile, MPI_Comm communicator, bool allowUnrecognizedArguments) |
void | resetState (std::istream &configStream, bool allowUnrecognizedArguments) |
void | resetState () |
bool | setBooleanArgument (std::string const &name, bool const &value) |
bool | setIntegerArgument (std::string const &name, int const &value) |
bool | setIntOptionalArgument (std::string const &name, Configuration::IntOptional const &value) |
bool | setStringArgument (std::string const &name, std::string const &value) |
bool | setUnsignedIntArgument (std::string const &name, unsigned int const &value) |
Protected Member Functions | |
int | initialize (std::string const &configFile, MPI_Comm communicator, bool allowUnrecognizedArguments) |
int | initialize (std::istream &configStream, bool allowUnrecognizedArguments) |
Private Member Functions | |
int | initialize_base () |
A subclass of Arguments whose constructor takes a filename as an argument. The arguments are passed to initialize(), which calls resetState().
Definition at line 20 of file ConfigFileArguments.hpp.
PV::ConfigFileArguments::ConfigFileArguments | ( | std::string const & | configFile, |
MPI_Comm | communicator, | ||
bool | allowUnrecognizedArguments | ||
) |
The constructor for ConfigFileArguments. The given config file is opened as an ifstream and passed to Arguments::initialize().
Definition at line 18 of file ConfigFileArguments.cpp.
|
inlinevirtual |
The destructor for ConfigFileArguments.
Definition at line 35 of file ConfigFileArguments.hpp.
|
inlineinherited |
Returns the value of the specified Boolean value in the current configuration. Throws an invalid_argument exception if the input argument does not refer to a Boolean.
Definition at line 62 of file Arguments.hpp.
|
inlineinherited |
Returns the value of the specified integer in the current configuration. Throws an invalid_argument exception if the input argument does not refer to an integer.
Definition at line 71 of file Arguments.hpp.
|
inlineinherited |
Returns the value of the specified optional integer in the current configuration. Throws an invalid_argument exception if the input argument does not refer to an optional integer.
Definition at line 98 of file Arguments.hpp.
|
inlineinherited |
Returns the value of the specified string in the current configuration. Throws an invalid_argument exception if the input argument does not refer to a string in the configruation.
Definition at line 89 of file Arguments.hpp.
|
inlineinherited |
Returns the type for the given string: unrecognized, boolean, integer, unsigned, string, or optional integer.
Definition at line 53 of file Arguments.hpp.
|
inlineinherited |
Returns the value of the specified unsigned integer in the current configuration. Throws an invalid_argument exception if the input argument does not refer to an unsigned integer.
Definition at line 80 of file Arguments.hpp.
|
protected |
Called by the ConfigFileArguments constructor. It calls resetState with its arguments.
Definition at line 28 of file ConfigFileArguments.cpp.
|
protectedinherited |
initialize() is called by the constructor, and calls the resetState(istream, bool) method to set the data members.
Definition at line 27 of file Arguments.cpp.
|
private |
initialize_base() is called by the constructor to initialize the internal variables to false for flags, zero for integers, and nullptr for strings.
Definition at line 26 of file ConfigFileArguments.cpp.
|
inherited |
Prints the effective command line based on the arguments used in instantiation, and any set-methods used since then.
Definition at line 40 of file Arguments.cpp.
void PV::ConfigFileArguments::resetState | ( | std::string const & | configFile, |
MPI_Comm | communicator, | ||
bool | allowUnrecognizedArguments | ||
) |
resetState is called during instantiation, and can also be called as a public method to discard the results of any set-methods and to use a new file for the base configuration.
The root process of the communicator reads the file specified by configFile into a string, and broadcasts it to the other processes of the communicator. That string is then converted to an input stringstream which is passed to Arguments::resetState.
Definition at line 36 of file ConfigFileArguments.cpp.
|
inherited |
Sets the object's state based on the given input stream. The allowUnrecognizedArguments flag has the same effect as in the constructor.
This method creates a ConfigParser object from its arguments, and sets the Arguments data members according to the ConfigParser's get-methods. See ConfigParser::initialize() for a description of how the configuration stream is parsed.
Definition at line 32 of file Arguments.cpp.
|
inherited |
Resets all member variables to their state at the time the object was instantiated or reinitialized using resetState(istream, bool). That is, the arguments are retrieved from the ConfigParser arguments, and the effect of any set-method that had been called since then is discarded.
Definition at line 38 of file Arguments.cpp.
|
inlineinherited |
Sets the indicated Boolean value in the current configuration to the indicated value. If the configuration does not have a Boolean with the indicated name, the method does nothing.
Definition at line 107 of file Arguments.hpp.
|
inlineinherited |
Sets the indicated integer in the current configuration to the indicated value. If the configuration does not have an integer with the indicated name, the method does nothing.
Definition at line 116 of file Arguments.hpp.
|
inlineinherited |
Sets the indicated optional integer in the current configuration to the indicated value. If the configuration does not have an optional integer with the indicated name, the method does nothing.
Definition at line 143 of file Arguments.hpp.
|
inlineinherited |
Sets the indicated string in the current configuration to the indicated value. If the configuration does not have a string with the indicated name, the method does nothing.
Definition at line 134 of file Arguments.hpp.
|
inlineinherited |
Sets the indicated unsigned integer in the current configuration to the indicated value. If the configuration does not have an unsigned integer with the indicated name, the method does nothing.
Definition at line 125 of file Arguments.hpp.