FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | List of all members
fei::ParameterSet Class Reference

#include <fei_ParameterSet.hpp>

Classes

class  const_iterator
 

Public Member Functions

 ParameterSet ()
 
virtual ~ParameterSet ()
 
void add (const Param &param, bool maintain_unique_keys=true)
 
const Paramget (const char *name) const
 
int size () const
 
const_iterator begin () const
 
const_iterator end () const
 
int getIntParamValue (const char *name, int &paramValue) const
 
int getDoubleParamValue (const char *name, double &paramValue) const
 
int getStringParamValue (const char *name, std::string &paramValue) const
 
int getBoolParamValue (const char *name, bool &paramValue) const
 
int getVoidParamValue (const char *name, const void *&paramValue) const
 

Detailed Description

Container that functions as a database of named parameters, 

intended to store control parameters such as solver tolerances and other named options.

Individual parameters are instances of fei::Param. This is a simplistic way of simulating a std::map that can store values of varying type.

Example creation and initialization:

  fei::ParameterSet paramset;
  paramset.add(fei::Param("tolerance", 1.e-8));
  paramset.add(fei::Param("FEI_OUTPUT_PATH", "/home/me/tmp"));
  paramset.add(fei::Param("BLOCK_MATRIX", true));

Note that various fei interfaces used to accept parameters in the form of a length and a list of pointers-to-char-pointer (i.e., const char*const* paramStrings). A couple of utility functions exist for converting to and from fei::ParameterSet. See the following functions which are declared in fei_utils.hpp:
fei::utils::wrap_strings()
fei::utils::parse_strings()
fei::utils::convert_ParameterSet_to_strings()
fei::utils::strings_to_char_ptrs()

Definition at line 46 of file fei_ParameterSet.hpp.

Constructor & Destructor Documentation

fei::ParameterSet::ParameterSet ( )

Constructor

Definition at line 12 of file fei_ParameterSet.cpp.

fei::ParameterSet::~ParameterSet ( )
virtual

Destructor

Definition at line 18 of file fei_ParameterSet.cpp.

Member Function Documentation

void fei::ParameterSet::add ( const Param param,
bool  maintain_unique_keys = true 
)
inline
Add a new named parameter object to this parameter-set. If a parameter
with the same name is already present, it is replaced by this new one
if the 'maintain_unique_keys' argument is true. Otherwise, the duplicate
parameter is simply appended to the internal list of parameters.
Parameters
paramNamed parameter to be added. A copy of this parameter object is stored internally. The caller is free to destroy the input argument as soon as this method returns.
maintain_unique_keysOptional argument, defaults to true. If this argument is false, then multiple parameters with the same name may be stored.

Definition at line 235 of file fei_ParameterSet.hpp.

const fei::Param * fei::ParameterSet::get ( const char *  name) const
inline

Query for pointer to named parameter. The internal list of named parameters is searched using a linear search. If multiple parameters have the same name (i.e., the add() method has been used with the optional 'maintain_unique_keys' argument specified as false), then the parameter returned is an arbitrary one of the duplicates. In other words, parameters are not stored in any particular order.

Definition at line 260 of file fei_ParameterSet.hpp.

int fei::ParameterSet::size ( ) const
inline

Query for the number of named parameters currently stored.

Definition at line 254 of file fei_ParameterSet.hpp.

fei::ParameterSet::const_iterator fei::ParameterSet::begin ( ) const
inline

Return an iterator pointing to the beginning of the list of parameters

Definition at line 223 of file fei_ParameterSet.hpp.

fei::ParameterSet::const_iterator fei::ParameterSet::end ( ) const
inline

Return an iterator pointing just past the end of the list of parameters

Definition at line 229 of file fei_ParameterSet.hpp.

int fei::ParameterSet::getIntParamValue ( const char *  name,
int &  paramValue 
) const

Check whether a fei::Param with 'name' is present and has type fei::Param::INT. If so, set paramValue and return 0. Otherwise return -1.

Definition at line 28 of file fei_ParameterSet.cpp.

int fei::ParameterSet::getDoubleParamValue ( const char *  name,
double &  paramValue 
) const

Check whether a fei::Param with 'name' is present and has type fei::Param::INT or fei::Param::DOUBLE. If so, set paramValue and return 0. Otherwise return -1.

Definition at line 40 of file fei_ParameterSet.cpp.

int fei::ParameterSet::getStringParamValue ( const char *  name,
std::string &  paramValue 
) const

Check whether a fei::Param with 'name' is present and has type fei::Param::STRING. If so, set paramValue and return 0. Otherwise return -1.

Definition at line 57 of file fei_ParameterSet.cpp.

int fei::ParameterSet::getBoolParamValue ( const char *  name,
bool &  paramValue 
) const

Check whether a fei::Param with 'name' is present and has type fei::Param::BOOL. If so, set paramValue and return 0. Otherwise return -1.

Definition at line 69 of file fei_ParameterSet.cpp.

int fei::ParameterSet::getVoidParamValue ( const char *  name,
const void *&  paramValue 
) const

Check whether a fei::Param with 'name' is present and has type fei::Param::VOID. If so, set paramValue and return 0. Otherwise return -1.

Definition at line 81 of file fei_ParameterSet.cpp.


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