|
Teuchos - Trilinos Tools Package
Version of the Day
|
Go to the documentation of this file.
43 #ifndef TEUCHOS_PARAMETER_ENTRY_H
44 #define TEUCHOS_PARAMETER_ENTRY_H
53 #include "Teuchos_ParameterEntryValidator.hpp"
57 #ifndef DOXYGEN_SHOULD_SKIP_THIS
91 T value,
bool isDefault =
false,
bool isList =
false,
92 const std::string &docString =
"",
113 T value,
bool isDefault =
false,
114 const std::string &docString =
"",
125 const any &value,
bool isDefault =
false
134 void setDocString(
const std::string &docString);
138 bool isDefault =
false,
139 const std::string &docString =
""
154 T& getValue(T *ptr)
const;
161 any& getAny(
bool activeQry =
true);
168 const any& getAny(
bool activeQry =
true)
const;
183 template <
typename T>
188 bool isArray()
const;
191 bool isTwoDArray()
const;
195 bool isDefault()
const;
199 std::string docString()
const;
215 std::ostream& leftshift(std::ostream& os,
bool printFlags =
true)
const;
221 static const std::string tagName =
"Parameter";
236 mutable bool isUsed_;
239 mutable bool isDefault_;
242 std::string docString_;
247 #pragma warning(push)
248 #pragma warning(disable:4251)
265 return entry.
getValue(static_cast<T*>(0));
276 return entry->
getValue(static_cast<T*>(0));
297 return !( e1 == e2 );
319 const std::string &docString_in,
324 isDefault_(isDefault_in),
325 docString_(docString_in),
326 validator_(validator_in)
328 static_assert(std::is_same<
typename Teuchos::is_comparable<T>::type, std::true_type>::value &&
329 std::is_same<
typename Teuchos::is_printable<T>::type, std::true_type>::value,
330 "ParameterList values must be comparable and printable!");
338 T value_in,
bool isDefault_in,
const std::string &docString_in,
342 static_assert(std::is_same<
typename Teuchos::is_comparable<T>::type, std::true_type>::value &&
343 std::is_same<
typename Teuchos::is_printable<T>::type, std::true_type>::value,
344 "ParameterList values must be comparable and printable!");
346 isDefault_ = isDefault_in;
347 if(docString_in.length())
348 docString_ = docString_in;
349 if(validator_in.
get())
350 validator_ = validator_in;
360 return const_cast<T&>(Teuchos::any_cast<T>( val_ ));
366 if (activeQry ==
true) {
375 if (activeQry ==
true) {
387 template <
typename T>
390 {
return val_.
type() ==
typeid(T); }
394 {
return isDefault_; }
398 {
return docString_; }
403 {
return validator_; }
bool isUsed() const
Return whether or not the value has been used; i.e., whether or not the value has been retrieved via ...
Reference-counted pointer class and non-member templated function implementations.
unsigned int ParameterEntryID
std::ostream & operator<<(std::ostream &os, const ParameterEntry &e)
Output stream operator for handling the printing of parameter entries.
RCP< const ParameterEntryValidator > validator() const
Return the (optional) validator object.
bool isList() const
Return whether or not the value itself is a list.
const std::type_info & type() const
Return the type of value being stored.
Smart reference counting pointer class for automatic garbage collection.
T & getValue(RCP< const ParameterEntry > entry)
A templated helper function for returning the value of type T held in the ParameterEntry object,...
T & getValue(T *ptr) const
Templated get method that uses the input pointer type to determine the type of parameter to return.
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.
bool isDefault() const
Indicate whether this entry takes on the default value.
bool isType() const
Test the type of the data being contained.
any & getAny(bool activeQry=true)
Direct access to the Teuchos::any data value underlying this object. The bool argument activeQry (def...
T & getValue(const ParameterEntry &entry)
A templated helper function for returning the value of type T held in the ParameterEntry object,...
Teuchos header file which uses auto-configuration information to include necessary C++ headers.
bool operator!=(const ParameterEntry &e1, const ParameterEntry &e2)
Returns true if two ParameterEntry objects are not equal.
bool operator==(const ParameterEntry &e1, const ParameterEntry &e2)
Returns true if two ParameterEntry objects are equal.
Modified boost::any class for holding a templated value.
T * get() const
Get the raw C++ pointer to the underlying object.
A list of parameters of arbitrary type.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
This object is held as the "value" in the Teuchos::ParameterList std::map.
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...
std::string docString() const
Return the (optional) documentation std::string.
Modified boost::any class, which is a container for a templated value.
ParameterEntry()
Default Constructor.