AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Basic interface for verifiable scalar values of Inlet primitive type, namely int, double, bool, or std::string - implementations can use this directly (inlet::Field) or forward to all elements of a collection (inlet::AggregrateField) More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/main/src/axom/inlet/VerifiableScalar.hpp>
Public Types | |
using | Verifier = std::function< bool(const axom::inlet::Field &, std::vector< VerificationError > *errors)> |
Public Member Functions | |
virtual | ~VerifiableScalar ()=default |
VerifiableScalar & | operator= (const VerifiableScalar &)=delete |
virtual VerifiableScalar & | required (bool isRequired=true)=0 |
Set the required status of this object. More... | |
virtual bool | isRequired () const =0 |
Return the required status. More... | |
VerifiableScalar & | registerVerifier (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 VerifiableScalar & | registerVerifier (Verifier verifier)=0 |
Registers the function object that will verify this object's contents during the verification stage. More... | |
virtual VerifiableScalar & | defaultValue (const std::string &value)=0 |
Set the default value of this object. More... | |
virtual VerifiableScalar & | defaultValue (const char *value)=0 |
Set the default value of this object. More... | |
virtual VerifiableScalar & | defaultValue (bool value)=0 |
Set the default value of this object. More... | |
virtual VerifiableScalar & | defaultValue (int value)=0 |
Set the default value of this object. More... | |
virtual VerifiableScalar & | defaultValue (double value)=0 |
Set the default value of this object. More... | |
virtual VerifiableScalar & | range (double startVal, double endVal)=0 |
Set the range of this object. More... | |
virtual VerifiableScalar & | range (int startVal, int endVal)=0 |
Set the range of this object. More... | |
virtual VerifiableScalar & | validValues (const std::vector< int > &set)=0 |
Set the valid values for this object. More... | |
virtual VerifiableScalar & | validValues (const std::vector< double > &set)=0 |
Set the valid values for this object. More... | |
virtual VerifiableScalar & | validValues (const std::vector< std::string > &set)=0 |
Set the valid values for this object. More... | |
virtual VerifiableScalar & | validValues (const std::initializer_list< const char * > &set)=0 |
Set the valid values for this object. More... | |
virtual VerifiableScalar & | validValues (const std::initializer_list< int > &set)=0 |
Set the valid values for this object. More... | |
virtual VerifiableScalar & | validValues (const std::initializer_list< double > &set)=0 |
Set the valid values. More... | |
virtual bool | verify (std::vector< VerificationError > *errors=nullptr) const =0 |
Verifies the object to make sure it satisfies the imposed requirements. More... | |
Basic interface for verifiable scalar values of Inlet primitive type, namely int, double, bool, or std::string - implementations can use this directly (inlet::Field) or forward to all elements of a collection (inlet::AggregrateField)
In practice this interface is used for the Field and AggregateField types. In addition to the ability to mark things as required and use user-defined lambdas (as in Verifiable), default values can be provided, as can ranges of valid values and discrete sets of valid values.
using axom::inlet::VerifiableScalar::Verifier = std::function<bool(const axom::inlet::Field&, std::vector<VerificationError>* errors)> |
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.
|
virtualdefault |
|
delete |
|
pure virtual |
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.
[in] | isRequired | Boolean value of whether object is required |
Implemented in axom::inlet::Field, and axom::inlet::AggregateField.
|
pure virtual |
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.
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
VerifiableScalar& axom::inlet::VerifiableScalar::registerVerifier | ( | std::function< bool(const axom::inlet::Field &)> | lambda | ) |
Registers the function object that will verify this object's contents during the verification stage.
[in] | lambda | The function object. |
|
pure virtual |
Registers the function object that will verify this object's contents during the verification stage.
[in] | verifier | The function object. |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the default value of this object.
Set the default value for the object in the input file.
[in] | value | The default string value |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the default value of this object.
Set the default value for the object in the input file.
[in] | value | The default string value |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the default value of this object.
Set the default value for the object in the input file.
[in] | value | The default boolean value |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the default value of this object.
Set the default value for the object in the input file.
[in] | value | The default integer value |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the default value of this object.
Set the default value for the object in the input file.
[in] | value | The default double value |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the range of this object.
Set the continuous range for the object in the input file.
[in] | startVal | The start of the range |
[in] | endVal | The end of the range |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the range of this object.
Set the continuous range for the object in the input file.
[in] | startVal | The start of the range |
[in] | endVal | The end of the range |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the valid values for this object.
[in] | set | An vector containing the set of allowed integer values |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the valid values for this object.
[in] | set | An vector containing the set of allowed double values |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the valid values for this object.
[in] | set | A vector containing the set of allowed string values |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the valid values for this object.
[in] | set | An initializer list containing the set of allowed C-string values |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the valid values for this object.
[in] | set | An initializer list containing the valid integer values |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Set the valid values.
[in] | set | An initializer list containing the valid double values |
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.
|
pure virtual |
Verifies the object to make sure it satisfies the imposed requirements.
[in] | errors | An 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>>
Implemented in axom::inlet::AggregateField, and axom::inlet::Field.