Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Teuchos::ParameterEntry Class Reference

This object is held as the "value" in the Teuchos::ParameterList std::map. More...

#include <Teuchos_ParameterEntry.hpp>

(Note that these are not member symbols.)

template<typename T>
T & getValue (const ParameterEntry &entry)
 A templated helper function for returning the value of type T held in the ParameterEntry object, where the type T can be specified in the call. This is an easier way to call the getValue method in the ParameterEntry class, since the user does not have to pass in a pointer of type T.
template<typename T>
T & getValue (RCP< const ParameterEntry > entry)
 A templated helper function for returning the value of type T held in the ParameterEntry object, where the type T can be specified in the call. This is an easier way to call the getValue method in the ParameterEntry class, since the user does not have to pass in a pointer of type T.
bool operator== (const ParameterEntry &e1, const ParameterEntry &e2)
 Returns true if two ParameterEntry objects are equal.
bool operator!= (const ParameterEntry &e1, const ParameterEntry &e2)
 Returns true if two ParameterEntry objects are not equal.
std::ostream & operator<< (std::ostream &os, const ParameterEntry &e)
 Output stream operator for handling the printing of parameter entries.

Public types

typedef unsigned int ParameterEntryID

I/O Methods

any val_
 Templated Datatype.
bool isUsed_
 Has this parameter been accessed by a "get" function?
bool isDefault_
 Was this parameter a default value assigned by a "get" function?
std::string docString_
 Optional documentation field.
RCP< const ParameterEntryValidatorvalidator_
 Optional validator object.
std::ostream & leftshift (std::ostream &os, bool printFlags=true) const
 Output a non-list parameter to the given output stream.
static const std::string & getTagName ()
 Get the string that should be used as the tag name for all parameters when they are serialized to xml.
void reset ()
 Reset the entry.

Constructors/Destructor

 ParameterEntry ()
 Default Constructor.
 ParameterEntry (const ParameterEntry &source)
 Copy constructor.
 ParameterEntry (ParameterEntry &&other)
 Move constructor.
template<typename T, typename = std::enable_if_t< ! std::is_same_v<std::decay_t<T>, ParameterEntry>>>
 ParameterEntry (T &&value, bool isDefault=false, bool isList=false, const std::string &docString="", RCP< const ParameterEntryValidator > const &validator=null)
 Templated constructor.

Set Methods

ParameterEntryoperator= (const ParameterEntry &source)
 Replace the current parameter entry with source.
ParameterEntryoperator= (ParameterEntry &&)
 Move-assignment operator.
template<typename T>
void setValue (T value, bool isDefault=false, const std::string &docString="", RCP< const ParameterEntryValidator > const &validator=null)
 Templated set method that uses the input value type to determine the type of parameter.
void setAnyValue (const any &value, bool isDefault=false)
 Set the value as an any object.
void setValidator (RCP< const ParameterEntryValidator > const &validator)
 Set the validator.
void setDocString (const std::string &docString)
 Set the documentation std::string.
ParameterListsetList (bool isDefault=false, const std::string &docString="")
 Create a parameter entry that is an empty list.

Get Methods

template<typename T>
T & getValue (T *ptr) const
 Templated get method that uses the input pointer type to determine the type of parameter to return.
anygetAny (bool activeQry=true)
 Direct access to the Teuchos::any data value underlying this object. The bool argument activeQry (default: true) indicates that the call to getAny() will set the isUsed() value of the ParameterEntry to true.
const anygetAny (bool activeQry=true) const
 Constant direct access to the Teuchos::any data value underlying this object. The bool argument activeQry (default: true) indicates that the call to getAny() will set the isUsed() value of the ParameterEntry to true.

Attribute/Query Methods

bool isUsed () const
 Return whether or not the value has been used; i.e., whether or not the value has been retrieved via a get function.
bool isList () const
 Return whether or not the value itself is a list.
template<typename T>
bool isType () const
 Test the type of the data being contained.
bool isArray () const
 Test if the type of data being contained is a Teuchos::Array.
bool isTwoDArray () const
 Test if the type of data being contained is a Teuchos::TwoDArray.
bool isDefault () const
 Indicate whether this entry takes on the default value.
std::string docString () const
 Return the (optional) documentation std::string.
RCP< const ParameterEntryValidatorvalidator () const
 Return the (optional) validator object.

Detailed Description

This object is held as the "value" in the Teuchos::ParameterList std::map.

This structure holds a Teuchos::any value and information on the status of this parameter (isUsed, isDefault, etc.). The type of parameter is chosen through the templated Set/Get methods.

Definition at line 67 of file Teuchos_ParameterEntry.hpp.

Member Typedef Documentation

◆ ParameterEntryID

Definition at line 75 of file Teuchos_ParameterEntry.hpp.

Constructor & Destructor Documentation

◆ ParameterEntry() [1/4]

Teuchos::ParameterEntry::ParameterEntry ( )

Default Constructor.

Definition at line 51 of file Teuchos_ParameterEntry.cpp.

◆ ParameterEntry() [2/4]

Teuchos::ParameterEntry::ParameterEntry ( const ParameterEntry & source)

Copy constructor.

Definition at line 57 of file Teuchos_ParameterEntry.cpp.

◆ ParameterEntry() [3/4]

Teuchos::ParameterEntry::ParameterEntry ( ParameterEntry && other)

Move constructor.

Definition at line 77 of file Teuchos_ParameterEntry.cpp.

◆ ParameterEntry() [4/4]

template<typename T, typename>
Teuchos::ParameterEntry::ParameterEntry ( T && value,
bool isDefault = false,
bool isList = false,
const std::string & docString = "",
RCP< const ParameterEntryValidator > const & validator = null )
inlineexplicit

Templated constructor.

Note
Accepting a ParameterEntry would lead to infinite recursion.

Definition at line 321 of file Teuchos_ParameterEntry.hpp.

Member Function Documentation

◆ operator=() [1/2]

ParameterEntry & Teuchos::ParameterEntry::operator= ( const ParameterEntry & source)

Replace the current parameter entry with source.

Definition at line 63 of file Teuchos_ParameterEntry.cpp.

◆ operator=() [2/2]

ParameterEntry & Teuchos::ParameterEntry::operator= ( ParameterEntry && other)

Move-assignment operator.

Definition at line 85 of file Teuchos_ParameterEntry.cpp.

◆ setValue()

template<typename T>
void Teuchos::ParameterEntry::setValue ( T value,
bool isDefault = false,
const std::string & docString = "",
RCP< const ParameterEntryValidator > const & validator = null )
inline

Templated set method that uses the input value type to determine the type of parameter.

Note
  • Invalidates any previous values stored by this object although it doesn't necessarily erase them.
  • Resets 'isUsed' functionality.

Definition at line 343 of file Teuchos_ParameterEntry.hpp.

◆ setAnyValue()

void Teuchos::ParameterEntry::setAnyValue ( const any & value,
bool isDefault = false )

Set the value as an any object.

This wipes all other data including documentation strings.

Warning! Do not use function ths to set a sublist!

Definition at line 98 of file Teuchos_ParameterEntry.cpp.

◆ setValidator()

void Teuchos::ParameterEntry::setValidator ( RCP< const ParameterEntryValidator > const & validator)

Set the validator.

Definition at line 110 of file Teuchos_ParameterEntry.cpp.

◆ setDocString()

void Teuchos::ParameterEntry::setDocString ( const std::string & docString)

Set the documentation std::string.

Definition at line 118 of file Teuchos_ParameterEntry.cpp.

◆ setList()

ParameterList & Teuchos::ParameterEntry::setList ( bool isDefault = false,
const std::string & docString = "" )

Create a parameter entry that is an empty list.

Definition at line 124 of file Teuchos_ParameterEntry.cpp.

◆ getValue()

template<typename T>
T & Teuchos::ParameterEntry::getValue ( T * ptr) const
inline

Templated get method that uses the input pointer type to determine the type of parameter to return.

Note
This method will cast the value to the type requested. If that type is incorrect, an std::exception will be thrown by the any_cast.

Definition at line 363 of file Teuchos_ParameterEntry.hpp.

◆ getAny() [1/2]

any & Teuchos::ParameterEntry::getAny ( bool activeQry = true)
inline

Direct access to the Teuchos::any data value underlying this object. The bool argument activeQry (default: true) indicates that the call to getAny() will set the isUsed() value of the ParameterEntry to true.

Definition at line 370 of file Teuchos_ParameterEntry.hpp.

◆ getAny() [2/2]

const any & Teuchos::ParameterEntry::getAny ( bool activeQry = true) const
inline

Constant direct access to the Teuchos::any data value underlying this object. The bool argument activeQry (default: true) indicates that the call to getAny() will set the isUsed() value of the ParameterEntry to true.

Definition at line 379 of file Teuchos_ParameterEntry.hpp.

◆ isUsed()

bool Teuchos::ParameterEntry::isUsed ( ) const
inline

Return whether or not the value has been used; i.e., whether or not the value has been retrieved via a get function.

Definition at line 390 of file Teuchos_ParameterEntry.hpp.

◆ isList()

bool Teuchos::ParameterEntry::isList ( ) const

Return whether or not the value itself is a list.

Definition at line 136 of file Teuchos_ParameterEntry.cpp.

◆ isType()

template<typename T>
bool Teuchos::ParameterEntry::isType ( ) const
inline

Test the type of the data being contained.

Definition at line 395 of file Teuchos_ParameterEntry.hpp.

◆ isArray()

bool Teuchos::ParameterEntry::isArray ( ) const

Test if the type of data being contained is a Teuchos::Array.

Definition at line 167 of file Teuchos_ParameterEntry.cpp.

◆ isTwoDArray()

bool Teuchos::ParameterEntry::isTwoDArray ( ) const

Test if the type of data being contained is a Teuchos::TwoDArray.

Definition at line 155 of file Teuchos_ParameterEntry.cpp.

◆ isDefault()

bool Teuchos::ParameterEntry::isDefault ( ) const
inline

Indicate whether this entry takes on the default value.

Definition at line 399 of file Teuchos_ParameterEntry.hpp.

◆ docString()

std::string Teuchos::ParameterEntry::docString ( ) const
inline

Return the (optional) documentation std::string.

Definition at line 403 of file Teuchos_ParameterEntry.hpp.

◆ validator()

RCP< const ParameterEntryValidator > Teuchos::ParameterEntry::validator ( ) const
inline

Return the (optional) validator object.

Definition at line 408 of file Teuchos_ParameterEntry.hpp.

◆ leftshift()

std::ostream & Teuchos::ParameterEntry::leftshift ( std::ostream & os,
bool printFlags = true ) const

Output a non-list parameter to the given output stream.

The parameter is followed by "[default]" if it is the default value given through a Set method. Otherwise, if the parameter was unused (not accessed through a Get method), it will be followed by "[unused]". This function is called by the "std::ostream& operator<<".

Definition at line 141 of file Teuchos_ParameterEntry.cpp.

◆ getTagName()

const std::string & Teuchos::ParameterEntry::getTagName ( )
inlinestatic

Get the string that should be used as the tag name for all parameters when they are serialized to xml.

Definition at line 226 of file Teuchos_ParameterEntry.hpp.

◆ reset()

void Teuchos::ParameterEntry::reset ( )
private

Reset the entry.

Definition at line 183 of file Teuchos_ParameterEntry.cpp.

◆ getValue() [1/2]

template<typename T>
T & getValue ( const ParameterEntry & entry)
related

A templated helper function for returning the value of type T held in the ParameterEntry object, where the type T can be specified in the call. This is an easier way to call the getValue method in the ParameterEntry class, since the user does not have to pass in a pointer of type T.

Definition at line 269 of file Teuchos_ParameterEntry.hpp.

◆ getValue() [2/2]

template<typename T>
T & getValue ( RCP< const ParameterEntry > entry)
related

A templated helper function for returning the value of type T held in the ParameterEntry object, where the type T can be specified in the call. This is an easier way to call the getValue method in the ParameterEntry class, since the user does not have to pass in a pointer of type T.

Definition at line 280 of file Teuchos_ParameterEntry.hpp.

◆ operator==()

bool operator== ( const ParameterEntry & e1,
const ParameterEntry & e2 )
related

Returns true if two ParameterEntry objects are equal.

Definition at line 288 of file Teuchos_ParameterEntry.hpp.

◆ operator!=()

bool operator!= ( const ParameterEntry & e1,
const ParameterEntry & e2 )
related

Returns true if two ParameterEntry objects are not equal.

Definition at line 301 of file Teuchos_ParameterEntry.hpp.

◆ operator<<()

std::ostream & operator<< ( std::ostream & os,
const ParameterEntry & e )
related

Output stream operator for handling the printing of parameter entries.

Definition at line 309 of file Teuchos_ParameterEntry.hpp.

Member Data Documentation

◆ val_

any Teuchos::ParameterEntry::val_
private

Templated Datatype.

Definition at line 239 of file Teuchos_ParameterEntry.hpp.

◆ isUsed_

bool Teuchos::ParameterEntry::isUsed_
mutableprivate

Has this parameter been accessed by a "get" function?

Definition at line 242 of file Teuchos_ParameterEntry.hpp.

◆ isDefault_

bool Teuchos::ParameterEntry::isDefault_
mutableprivate

Was this parameter a default value assigned by a "get" function?

Definition at line 245 of file Teuchos_ParameterEntry.hpp.

◆ docString_

std::string Teuchos::ParameterEntry::docString_
private

Optional documentation field.

Definition at line 248 of file Teuchos_ParameterEntry.hpp.

◆ validator_

RCP<const ParameterEntryValidator> Teuchos::ParameterEntry::validator_
private

Optional validator object.

Definition at line 256 of file Teuchos_ParameterEntry.hpp.


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