AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::inlet::Field Class Reference

Provides functions to help define how individual field variables in an input file are expected to behave. It also holds the Sidre Group to the individual field. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/inlet/Field.hpp>

Inheritance diagram for axom::inlet::Field:

Public Types

using Verifier = std::function< bool(const axom::inlet::Field &, std::vector< VerificationError > *errors)>
 

Public Member Functions

 Field (axom::sidre::Group *sidreGroup, axom::sidre::Group *root, axom::sidre::DataTypeId type=axom::sidre::DataTypeId::NO_TYPE_ID, bool docEnabled=true)
 Constructor for the Field class. More...
 
virtual ~Field ()=default
 
const axom::sidre::GroupsidreGroup () const
 Returns pointer to the Sidre Group class for this Field. More...
 
Fieldrequired (bool isRequired=true) override
 Set the required status of this object. More...
 
bool isRequired () const override
 Return the required status. More...
 
FielddefaultValue (const std::string &value) override
 Set the default value of this object. More...
 
FielddefaultValue (const char *value) override
 Set the default value of this object. More...
 
FielddefaultValue (bool value) override
 Set the default value of this object. More...
 
FielddefaultValue (int value) override
 Set the default value of this object. More...
 
FielddefaultValue (double value) override
 Set the default value of this object. More...
 
Fieldrange (double startVal, double endVal) override
 Set the range of this object. More...
 
Fieldrange (int startVal, int endVal) override
 Set the range of this object. More...
 
FieldvalidValues (const std::vector< int > &set) override
 Set the valid values for this object. More...
 
FieldvalidValues (const std::vector< double > &set) override
 Set the valid values for this object. More...
 
FieldvalidValues (const std::vector< std::string > &set) override
 Set the valid values for this object. More...
 
FieldvalidValues (const std::initializer_list< const char * > &set) override
 Set the valid values for this object. More...
 
FieldvalidValues (const std::initializer_list< int > &set) override
 Set the valid values for this object. More...
 
FieldvalidValues (const std::initializer_list< double > &set) override
 Set the valid values. More...
 
FieldregisterVerifier (Verifier lambda) override
 Registers the function object that will verify this object's contents during the verification stage. More...
 
bool verify (std::vector< VerificationError > *errors=nullptr) const override
 Verifies the object to make sure it satisfies the imposed requirements. More...
 
std::string name () const
 
template<typename T >
get () const
 Returns a value of primitive type. More...
 
InletType type () const
 Returns the type of the stored value. More...
 
bool exists () const
 Returns whether a value for the Field exists, i.e., if a value was provided in the input file or if a default was provided. More...
 
bool isUserProvided () const
 Returns whether a value was provided in the input file. More...
 
template<>
bool get () const
 
template<>
int get () const
 
template<>
double get () const
 
VerifiableScalarregisterVerifier (std::function< bool(const axom::inlet::Field &)> lambda)
 Registers the function object that will verify this object's contents during the verification stage. More...
 
virtual VerifiableScalarregisterVerifier (Verifier verifier)=0
 Registers the function object that will verify this object's contents during the verification stage. More...
 
VerifiableScalarregisterVerifier (std::function< bool(const axom::inlet::Field &)> lambda)
 Registers the function object that will verify this object's contents during the verification stage. More...
 

Detailed Description

Provides functions to help define how individual field variables in an input file are expected to behave. It also holds the Sidre Group to the individual field.

See also
Inlet Container

Member Typedef Documentation

◆ Verifier

using axom::inlet::VerifiableScalar::Verifier = std::function<bool(const axom::inlet::Field&, std::vector<VerificationError>* errors)>
inherited

A function which can verify the contents of the item being verified. It should report any errors via the INLET_VERIFICATION_WARNING macro, passing in the given array of errors.

Constructor & Destructor Documentation

◆ Field()

axom::inlet::Field::Field ( axom::sidre::Group sidreGroup,
axom::sidre::Group root,
axom::sidre::DataTypeId  type = axom::sidre::DataTypeId::NO_TYPE_ID,
bool  docEnabled = true 
)
inline

Constructor for the Field class.

This class provides functions to define the behavior of the Field data already read and stored in the given Sidre Group.

Parameters
[in]sidreGroupPointer to the already created Sidre Group.
[in]rootPointer to the sidreRootGroup containing this Field
[in]typeFieldType specifying the data type of this Field instance. Default is FieldType::UNSPECIFIED.
[in]docEnabledBoolean indicating whether or not documentation generation is enabled for Input file this Field instance belongs to.

◆ ~Field()

virtual axom::inlet::Field::~Field ( )
virtualdefault

Member Function Documentation

◆ sidreGroup()

const axom::sidre::Group* axom::inlet::Field::sidreGroup ( ) const
inline

Returns pointer to the Sidre Group class for this Field.

Provides access to the Sidre Group class that holds all the stored information for this Field class.

Returns
Pointer to the Sidre Group class for this Field

◆ required()

Field& axom::inlet::Field::required ( bool  isRequired = true)
overridevirtual

Set the required status of this object.

Set whether this object is required, or not, to be in the input file. The default behavior is to not be required.

Parameters
[in]isRequiredBoolean value of whether object is required
Returns
Reference to calling object, for chaining

Implements axom::inlet::VerifiableScalar.

◆ isRequired()

bool axom::inlet::Field::isRequired ( ) const
overridevirtual

Return the required status.

Return that this object is required, or not, to be in the input file. The default behavior is to not be required.

Returns
Boolean value of whether this object is required

Implements axom::inlet::VerifiableScalar.

◆ defaultValue() [1/5]

Field& axom::inlet::Field::defaultValue ( const std::string &  value)
overridevirtual

Set the default value of this object.

Set the default value for the object in the input file.

Parameters
[in]valueThe default string value
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ defaultValue() [2/5]

Field& axom::inlet::Field::defaultValue ( const char *  value)
overridevirtual

Set the default value of this object.

Set the default value for the object in the input file.

Parameters
[in]valueThe default string value
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ defaultValue() [3/5]

Field& axom::inlet::Field::defaultValue ( bool  value)
overridevirtual

Set the default value of this object.

Set the default value for the object in the input file.

Parameters
[in]valueThe default boolean value
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ defaultValue() [4/5]

Field& axom::inlet::Field::defaultValue ( int  value)
overridevirtual

Set the default value of this object.

Set the default value for the object in the input file.

Parameters
[in]valueThe default integer value
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ defaultValue() [5/5]

Field& axom::inlet::Field::defaultValue ( double  value)
overridevirtual

Set the default value of this object.

Set the default value for the object in the input file.

Parameters
[in]valueThe default double value
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ range() [1/2]

Field& axom::inlet::Field::range ( double  startVal,
double  endVal 
)
overridevirtual

Set the range of this object.

Set the continuous range for the object in the input file.

Parameters
[in]startValThe start of the range
[in]endValThe end of the range
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ range() [2/2]

Field& axom::inlet::Field::range ( int  startVal,
int  endVal 
)
overridevirtual

Set the range of this object.

Set the continuous range for the object in the input file.

Parameters
[in]startValThe start of the range
[in]endValThe end of the range
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ validValues() [1/6]

Field& axom::inlet::Field::validValues ( const std::vector< int > &  set)
overridevirtual

Set the valid values for this object.

Parameters
[in]setAn vector containing the set of allowed integer values
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ validValues() [2/6]

Field& axom::inlet::Field::validValues ( const std::vector< double > &  set)
overridevirtual

Set the valid values for this object.

Parameters
[in]setAn vector containing the set of allowed double values
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ validValues() [3/6]

Field& axom::inlet::Field::validValues ( const std::vector< std::string > &  set)
overridevirtual

Set the valid values for this object.

Parameters
[in]setA vector containing the set of allowed string values
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ validValues() [4/6]

Field& axom::inlet::Field::validValues ( const std::initializer_list< const char * > &  set)
overridevirtual

Set the valid values for this object.

Parameters
[in]setAn initializer list containing the set of allowed C-string values
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ validValues() [5/6]

Field& axom::inlet::Field::validValues ( const std::initializer_list< int > &  set)
overridevirtual

Set the valid values for this object.

Parameters
[in]setAn initializer list containing the valid integer values
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ validValues() [6/6]

Field& axom::inlet::Field::validValues ( const std::initializer_list< double > &  set)
overridevirtual

Set the valid values.

Parameters
[in]setAn initializer list containing the valid double values
Returns
Reference to calling object for chaining

Implements axom::inlet::VerifiableScalar.

◆ registerVerifier() [1/4]

Field& axom::inlet::Field::registerVerifier ( Verifier  verifier)
overridevirtual

Registers the function object that will verify this object's contents during the verification stage.

Parameters
[in]verifierThe function object.

Implements axom::inlet::VerifiableScalar.

◆ verify()

bool axom::inlet::Field::verify ( std::vector< VerificationError > *  errors = nullptr) const
overridevirtual

Verifies the object to make sure it satisfies the imposed requirements.

Parameters
[in]errorsAn optional vector of errors to append to in the case of verification failure

Ownership is not taken of errors, the raw pointer is only used for its optional reference semantics, as opposed to something like std::optional<std::reference_wrapper<T>>

Implements axom::inlet::VerifiableScalar.

◆ name()

std::string axom::inlet::Field::name ( ) const
Returns
The full name for this Field.

◆ get() [1/4]

template<typename T >
T axom::inlet::Field::get ( ) const

Returns a value of primitive type.

Returns
The value
Template Parameters
TThe type to retrieve

◆ type()

InletType axom::inlet::Field::type ( ) const

Returns the type of the stored value.

Returns
The type
See also
InletType

◆ exists()

bool axom::inlet::Field::exists ( ) const

Returns whether a value for the Field exists, i.e., if a value was provided in the input file or if a default was provided.

◆ isUserProvided()

bool axom::inlet::Field::isUserProvided ( ) const

Returns whether a value was provided in the input file.

◆ get() [2/4]

template<>
bool axom::inlet::Field::get ( ) const

◆ get() [3/4]

template<>
int axom::inlet::Field::get ( ) const

◆ get() [4/4]

template<>
double axom::inlet::Field::get ( ) const

◆ registerVerifier() [2/4]

VerifiableScalar& axom::inlet::VerifiableScalar::registerVerifier

Registers the function object that will verify this object's contents during the verification stage.

Parameters
[in]lambdaThe function object.

◆ registerVerifier() [3/4]

virtual VerifiableScalar& axom::inlet::VerifiableScalar::registerVerifier

Registers the function object that will verify this object's contents during the verification stage.

Parameters
[in]verifierThe function object.

◆ registerVerifier() [4/4]

VerifiableScalar& axom::inlet::VerifiableScalar::registerVerifier ( std::function< bool(const axom::inlet::Field &)>  lambda)
inherited

Registers the function object that will verify this object's contents during the verification stage.

Parameters
[in]lambdaThe function object.

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