ExaDG
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
dealii::Patterns::Tools::Convert< T, typename std::enable_if< ExaDG::Utilities::is_enum< T >()>::type > Struct Template Reference

#include <enum_patterns.h>

Static Public Member Functions

static std::unique_ptr< Patterns::Selection > to_pattern ()
 
static std::string to_string (T const &t, Patterns::PatternBase const &= *Convert< T >::to_pattern())
 
static T to_value (const std::string &s, Patterns::PatternBase const &= *Convert< T >::to_pattern())
 

Detailed Description

template<typename T>
struct dealii::Patterns::Tools::Convert< T, typename std::enable_if< ExaDG::Utilities::is_enum< T >()>::type >

Converter class for structs of enum (scoped or unscoped) type. dealii::Patterns::Selection is automatically generated from the given enum type and automatically checked. If a string is given that can not be converted to the enum, deal.II throws an exception in which possible values are printed.

deal.II expects the converter functions for the patterns in the following manner. Enum Patterns are not provided by deal.II since automatic relection of enums are not a part of deal.II. Similar code is placed in https://github.com/peterrum/dealii-parameter-handler-enum/blob/master/include/deal.II/base/patterns_enum.h for a different backend for enum reflection.

Member Function Documentation

◆ to_pattern()

template<typename T >
static std::unique_ptr< Patterns::Selection > dealii::Patterns::Tools::Convert< T, typename std::enable_if< ExaDG::Utilities::is_enum< T >()>::type >::to_pattern ( )
inlinestatic

Convert to pattern.

◆ to_string()

template<typename T >
static std::string dealii::Patterns::Tools::Convert< T, typename std::enable_if< ExaDG::Utilities::is_enum< T >()>::type >::to_string ( T const & t,
Patterns::PatternBase const & = *Convert<T>::to_pattern() )
inlinestatic

Convert value to string.

◆ to_value()

template<typename T >
static T dealii::Patterns::Tools::Convert< T, typename std::enable_if< ExaDG::Utilities::is_enum< T >()>::type >::to_value ( const std::string & s,
Patterns::PatternBase const & = *Convert<T>::to_pattern() )
inlinestatic

Convert string to value.


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