AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::inlet::Verifiable< BaseType > Class Template Referenceabstract

Interface for trivially verifiable objects - namely those that can be marked as required or checked with a user-provided lambda. More...

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

Inheritance diagram for axom::inlet::Verifiable< BaseType >:

Public Types

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

Public Member Functions

virtual ~Verifiable ()=default
 
Verifiable< BaseType > & operator= (const Verifiable< BaseType > &)=delete
 
virtual Verifiable< BaseType > & required (bool isRequired=true)=0
 Set the required status of this object. More...
 
virtual bool isRequired () const =0
 Return the required status. More...
 
Verifiable< BaseType > & registerVerifier (std::function< bool(const BaseType &)> verifier)
 Registers the function object that will verify this object's contents during the verification stage. More...
 
virtual Verifiable< BaseType > & registerVerifier (Verifier verifier)=0
 Registers the function object that will verify this object's contents during the verification stage. More...
 
virtual bool verify (std::vector< VerificationError > *errors=nullptr) const =0
 Verifies the object to make sure it satisfies the imposed requirements. More...
 

Detailed Description

template<typename BaseType>
class axom::inlet::Verifiable< BaseType >

Interface for trivially verifiable objects - namely those that can be marked as required or checked with a user-provided lambda.

Template Parameters
BaseTypeThe "base" type of the object, used for the argument type of a verifying predicate

In practice this interface is used for the Container and Function classes. Currently the only supported means of verifying a composite type (container) or function type are the methods exposed by this interface.

Member Typedef Documentation

◆ Verifier

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

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

Constructor & Destructor Documentation

◆ ~Verifiable()

template<typename BaseType >
virtual axom::inlet::Verifiable< BaseType >::~Verifiable ( )
virtualdefault

Member Function Documentation

◆ operator=()

template<typename BaseType >
Verifiable<BaseType>& axom::inlet::Verifiable< BaseType >::operator= ( const Verifiable< BaseType > &  )
delete

◆ required()

template<typename BaseType >
virtual Verifiable<BaseType>& axom::inlet::Verifiable< BaseType >::required ( bool  isRequired = true)
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.

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

Implemented in axom::inlet::AggregateVerifiable< BaseType >, axom::inlet::AggregateVerifiable< axom::inlet::Container >, axom::inlet::AggregateVerifiable< axom::inlet::Function >, axom::inlet::Function, and axom::inlet::Container.

◆ isRequired()

template<typename BaseType >
virtual bool axom::inlet::Verifiable< BaseType >::isRequired ( ) const
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.

Returns
Boolean value of whether this object is required

Implemented in axom::inlet::AggregateVerifiable< BaseType >, axom::inlet::AggregateVerifiable< axom::inlet::Container >, axom::inlet::AggregateVerifiable< axom::inlet::Function >, axom::inlet::Function, and axom::inlet::Container.

◆ registerVerifier() [1/2]

template<typename BaseType >
Verifiable<BaseType>& axom::inlet::Verifiable< BaseType >::registerVerifier ( std::function< bool(const BaseType &)>  verifier)
inline

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

Parameters
[in]verifierThe function object.

◆ registerVerifier() [2/2]

template<typename BaseType >
virtual Verifiable<BaseType>& axom::inlet::Verifiable< BaseType >::registerVerifier ( Verifier  verifier)
pure virtual

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

Parameters
[in]verifierThe function which will verify the contents of the container.

Implemented in axom::inlet::Function, and axom::inlet::Container.

◆ verify()

template<typename BaseType >
virtual bool axom::inlet::Verifiable< BaseType >::verify ( std::vector< VerificationError > *  errors = nullptr) const
pure virtual

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>>

Implemented in axom::inlet::AggregateVerifiable< BaseType >, axom::inlet::AggregateVerifiable< axom::inlet::Container >, axom::inlet::AggregateVerifiable< axom::inlet::Function >, axom::inlet::Function, and axom::inlet::Container.


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