10 #ifndef TEUCHOS_PARAMETER_ENTRY_H
11 #define TEUCHOS_PARAMETER_ENTRY_H
20 #include "Teuchos_ParameterEntryValidator.hpp"
24 #ifndef DOXYGEN_SHOULD_SKIP_THIS
59 template <
typename T,
typename = std::enable_if_t< ! std::is_same_v<std::decay_t<T>, ParameterEntry>>>
61 T&& value,
bool isDefault =
false,
bool isList =
false,
62 const std::string &docString =
"",
86 T value,
bool isDefault =
false,
87 const std::string &docString =
"",
98 const any &value,
bool isDefault =
false
107 void setDocString(
const std::string &docString);
111 bool isDefault =
false,
112 const std::string &docString =
""
127 T& getValue(T *ptr)
const;
134 any& getAny(
bool activeQry =
true);
141 const any& getAny(
bool activeQry =
true)
const;
156 template <
typename T>
161 bool isArray()
const;
164 bool isTwoDArray()
const;
168 bool isDefault()
const;
172 std::string docString()
const;
188 std::ostream& leftshift(std::ostream& os,
bool printFlags =
true)
const;
194 static const std::string tagName =
"Parameter";
209 mutable bool isUsed_;
212 mutable bool isDefault_;
215 std::string docString_;
220 #pragma warning(push)
221 #pragma warning(disable:4251)
238 return entry.
getValue(static_cast<T*>(0));
249 return entry->
getValue(static_cast<T*>(0));
270 return !( e1 == e2 );
286 template<
typename T,
typename>
292 const std::string &docString_in,
295 : val_(std::forward<T>(value_in)),
297 isDefault_(isDefault_in),
298 docString_(docString_in),
299 validator_(validator_in)
308 T value_in,
bool isDefault_in,
const std::string &docString_in,
313 isDefault_ = isDefault_in;
314 if(docString_in.length())
315 docString_ = docString_in;
316 if(validator_in.
get())
317 validator_ = validator_in;
327 return const_cast<T&
>(Teuchos::any_cast<T>( val_ ));
333 if (activeQry ==
true) {
342 if (activeQry ==
true) {
354 template <
typename T>
357 {
return val_.
type() ==
typeid(T); }
361 {
return isDefault_; }
365 {
return docString_; }
370 {
return validator_; }
Modified boost::any class for holding a templated value.
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.
ParameterEntry()
Default Constructor.
RCP< const ParameterEntryValidator > validator() const
Return the (optional) validator object.
std::ostream & leftshift(std::ostream &os, bool printFlags=true) const
Output a non-list parameter to the given output stream.
This object is held as the "value" in the Teuchos::ParameterList std::map.
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...
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
bool isType() const
Test the type of the data being contained.
T * get() const
Get the raw C++ pointer to the underlying object.
bool isDefault() const
Indicate whether this entry takes on the default value.
Modified boost::any class, which is a container for a templated value.
T & getValue(T *ptr) const
Templated get method that uses the input pointer type to determine the type of parameter to return...
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.
T & getValue(RCP< const ParameterEntry > entry)
A templated helper function for returning the value of type T held in the ParameterEntry object...
bool isList() const
Return whether or not the value itself is a list.
A list of parameters of arbitrary type.
T & getValue(const ParameterEntry &entry)
A templated helper function for returning the value of type T held in the ParameterEntry object...
unsigned int ParameterEntryID
any & getAny(bool activeQry=true)
Direct access to the Teuchos::any data value underlying this object. The bool argument activeQry (def...
Smart reference counting pointer class for automatic garbage collection.
const std::type_info & type() const
Return the type of value being stored.
std::string docString() const
Return the (optional) documentation std::string.
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.
std::ostream & operator<<(std::ostream &os, const ParameterEntry &e)
Output stream operator for handling the printing of parameter entries.