Teuchos::AnyNumberParameterEntryValidator Class Reference

Standard implementation of a ParameterEntryValidator that accepts numbers from a number of different formats and converts them to numbers in another format. More...

#include <Teuchos_StandardParameterEntryValidators.hpp>

Inheritance diagram for Teuchos::AnyNumberParameterEntryValidator:
Inheritance graph
[legend]

List of all members.

Classes

class  AcceptedTypes
 Determines the types that are accepted. More...

Private Member Functions

void finishInitialization ()
void throwTypeError (ParameterEntry const &entry, std::string const &paramName, std::string const &sublistName) const

Private Attributes

EPreferredType preferredType_
const AcceptedTypes acceptedTypes_
std::string acceptedTypesString_

Related Functions

(Note that these are not member functions.)



RCP
< AnyNumberParameterEntryValidator
anyNumberParameterEntryValidator (AnyNumberParameterEntryValidator::EPreferredType const preferredType, AnyNumberParameterEntryValidator::AcceptedTypes const &acceptedTypes)
 Nonmember constructor AnyNumberParameterEntryValidator.

Public types



enum  EPreferredType { PREFER_INT, PREFER_DOUBLE, PREFER_STRING }
 

Determines what type is the preferred type.

More...

Constructors



 AnyNumberParameterEntryValidator ()
 Construct with a preferrded type of double and accept all types.
 AnyNumberParameterEntryValidator (EPreferredType const preferredType, AcceptedTypes const &acceptedTypes)
 Construct with allowed input and output types and the preferred type.

Local non-virtual validated lookup functions



int getInt (const ParameterEntry &entry, const std::string &paramName="", const std::string &sublistName="", const bool activeQuery=true) const
 Get an integer value from a parameter entry.
double getDouble (const ParameterEntry &entry, const std::string &paramName="", const std::string &sublistName="", const bool activeQuery=true) const
 Get a double value from a parameter entry.
std::string getString (const ParameterEntry &entry, const std::string &paramName="", const std::string &sublistName="", const bool activeQuery=true) const
 Get a std::string value from a parameter entry.
int getInt (ParameterList &paramList, const std::string &paramName, const int defaultValue) const
 Lookup parameter from a parameter list and return as an int value.
double getDouble (ParameterList &paramList, const std::string &paramName, const double defaultValue) const
 Lookup parameter from a parameter list and return as an double value.
std::string getString (ParameterList &paramList, const std::string &paramName, const std::string &defaultValue) const
 Lookup parameter from a parameter list and return as an std::string value.

Overridden from ParameterEntryValidator



void printDoc (std::string const &docString, std::ostream &out) const
 
Teuchos::RCP< const Array
< std::string > > 
validStringValues () const
 
void validate (ParameterEntry const &entry, std::string const &paramName, std::string const &sublistName) const
 
void validateAndModify (std::string const &paramName, std::string const &sublistName, ParameterEntry *entry) const
 

Detailed Description

Standard implementation of a ParameterEntryValidator that accepts numbers from a number of different formats and converts them to numbers in another format.

Objects of this type are meant to be used as both abstract objects passed to Teuchos::ParameterList objects to be used to validate parameter types and values, and to be used by the code that reads parameter values. Having a single definition for the types of valids input and outputs for a parameter value makes it easier to write error-free validated code.

Definition at line 426 of file Teuchos_StandardParameterEntryValidators.hpp.


Member Enumeration Documentation

Determines what type is the preferred type.

Enumerator:
PREFER_INT 
PREFER_DOUBLE 
PREFER_STRING 

Definition at line 433 of file Teuchos_StandardParameterEntryValidators.hpp.


Constructor & Destructor Documentation

Teuchos::AnyNumberParameterEntryValidator::AnyNumberParameterEntryValidator (  ) 

Construct with a preferrded type of double and accept all types.

Definition at line 106 of file Teuchos_StandardParameterEntryValidators.cpp.

Teuchos::AnyNumberParameterEntryValidator::AnyNumberParameterEntryValidator ( EPreferredType const   preferredType,
AcceptedTypes const &  acceptedTypes 
)

Construct with allowed input and output types and the preferred type.

Parameters:
preferredType [in] Determines the preferred type. This enum value is used to set the default value in the override validateAndModify().
acceptedType [in] Determines the types that are allowed in the parameter list.

Definition at line 114 of file Teuchos_StandardParameterEntryValidators.cpp.


Member Function Documentation

int Teuchos::AnyNumberParameterEntryValidator::getInt ( const ParameterEntry entry,
const std::string &  paramName = "",
const std::string &  sublistName = "",
const bool  activeQuery = true 
) const

Get an integer value from a parameter entry.

Definition at line 128 of file Teuchos_StandardParameterEntryValidators.cpp.

double Teuchos::AnyNumberParameterEntryValidator::getDouble ( const ParameterEntry entry,
const std::string &  paramName = "",
const std::string &  sublistName = "",
const bool  activeQuery = true 
) const

Get a double value from a parameter entry.

Definition at line 145 of file Teuchos_StandardParameterEntryValidators.cpp.

std::string Teuchos::AnyNumberParameterEntryValidator::getString ( const ParameterEntry entry,
const std::string &  paramName = "",
const std::string &  sublistName = "",
const bool  activeQuery = true 
) const

Get a std::string value from a parameter entry.

Definition at line 162 of file Teuchos_StandardParameterEntryValidators.cpp.

int Teuchos::AnyNumberParameterEntryValidator::getInt ( ParameterList paramList,
const std::string &  paramName,
const int  defaultValue 
) const

Lookup parameter from a parameter list and return as an int value.

Definition at line 179 of file Teuchos_StandardParameterEntryValidators.cpp.

double Teuchos::AnyNumberParameterEntryValidator::getDouble ( ParameterList paramList,
const std::string &  paramName,
const double  defaultValue 
) const

Lookup parameter from a parameter list and return as an double value.

Definition at line 190 of file Teuchos_StandardParameterEntryValidators.cpp.

std::string Teuchos::AnyNumberParameterEntryValidator::getString ( ParameterList paramList,
const std::string &  paramName,
const std::string &  defaultValue 
) const

Lookup parameter from a parameter list and return as an std::string value.

Definition at line 201 of file Teuchos_StandardParameterEntryValidators.cpp.

void Teuchos::AnyNumberParameterEntryValidator::printDoc ( std::string const &  docString,
std::ostream &  out 
) const [virtual]
RCP< const Array< std::string > > Teuchos::AnyNumberParameterEntryValidator::validStringValues (  )  const [virtual]
void Teuchos::AnyNumberParameterEntryValidator::validate ( ParameterEntry const &  entry,
std::string const &  paramName,
std::string const &  sublistName 
) const [virtual]
void Teuchos::AnyNumberParameterEntryValidator::validateAndModify ( std::string const &  paramName,
std::string const &  sublistName,
ParameterEntry entry 
) const [virtual]
void Teuchos::AnyNumberParameterEntryValidator::finishInitialization (  )  [private]
void Teuchos::AnyNumberParameterEntryValidator::throwTypeError ( ParameterEntry const &  entry,
std::string const &  paramName,
std::string const &  sublistName 
) const [private]

Friends And Related Function Documentation

RCP< AnyNumberParameterEntryValidator > anyNumberParameterEntryValidator ( AnyNumberParameterEntryValidator::EPreferredType const   preferredType,
AnyNumberParameterEntryValidator::AcceptedTypes const &  acceptedTypes 
) [related]

Nonmember constructor AnyNumberParameterEntryValidator.


Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Tue Oct 20 10:14:05 2009 for Teuchos Package Browser (Single Doxygen Collection) by  doxygen 1.6.1