Block-Structured AMR Software Framework
AMReX_Enum.H File Reference
#include <AMReX_String.H>
#include <algorithm>
#include <array>
#include <stdexcept>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <vector>

Go to the source code of this file.

Namespaces

 amrex
 

Macros

#define AMREX_ENUM(CLASS, ...)
 

Typedefs

template<typename T >
using amrex_enum_traits = decltype(amrex_get_enum_traits(std::declval< T >()))
 

Functions

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
std::vector< std::pair< std::string, T > > amrex::getEnumNameValuePairs ()
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
amrex::getEnum (std::string_view const &s)
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
amrex::getEnumCaseInsensitive (std::string_view const &s)
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
std::string amrex::getEnumNameString (T const &v)
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
std::vector< std::string > amrex::getEnumNameStrings ()
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
std::string amrex::getEnumClassName ()
 

Macro Definition Documentation

◆ AMREX_ENUM

#define AMREX_ENUM (   CLASS,
  ... 
)
Value:
enum class CLASS : int { __VA_ARGS__ }; \
struct CLASS##_EnumTraits { \
using enum_class_t = CLASS; \
static constexpr bool value = true; \
static constexpr std::string_view class_name{#CLASS}; \
static constexpr std::string_view enum_names{#__VA_ARGS__}; \
}; \
CLASS##_EnumTraits amrex_get_enum_traits(CLASS)
const int[]
Definition: AMReX_BLProfiler.cpp:1664

Typedef Documentation

◆ amrex_enum_traits

template<typename T >
using amrex_enum_traits = decltype(amrex_get_enum_traits(std::declval<T>()))