21#define CreateMooseEnumClass(EnumName, ...) \
22 static inline std::string get##EnumName##Options() \
25 std::string s = #__VA_ARGS__; \
27 std::vector<std::string> elements; \
28 MooseUtils::tokenize(s, elements, 1, ","); \
29 for (auto & elem : elements) \
30 elem.erase(std::remove_if(elem.begin(), elem.end(), isspace), elem.end()); \
31 return MooseUtils::join(elements, " "); \
75 MooseEnum(std::string names, std::string default_name =
"",
bool allow_out_of_range =
false);
130 void assign(
const std::string & name,
const std::optional<std::string> & context = {});
153 template <
typename T>
174#ifdef LIBMESH_HAVE_CXX11_TYPE_TRAITS
175 static_assert(std::is_enum<T>::value ==
true,
176 "The type requested from MooseEnum::getEnum must be an enum type!\n\n");
void ErrorVector unsigned int
The base class for both the MooseEnum and MultiMooseEnum classes.
Class for containing MooseEnum item information.
const int & id() const
Return the numeric, name, or raw name.
const std::string & rawName() const
static const int INVALID_ID
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
CompareMode
Enum item for controlling comparison in the compareCurrent method.
virtual void checkDeprecated() const override
Check whether the current value is deprecated when called.
MooseEnum & operator=(const MooseEnum &other_enum)=default
Copy Assignment operator must be explicitly defined when a copy ctor exists and this method is used.
friend std::ostream & operator<<(std::ostream &out, const MooseEnum &obj)
Operator for printing to iostreams.
MooseEnumItem _current
The current id.
virtual bool isValid() const override
IsValid.
virtual ~MooseEnum()=default
bool operator!=(const char *value) const
void assign(const std::string &name, const std::optional< std::string > &context={})
bool operator==(const char *value) const
Comparison operators for comparing with character constants, MooseEnums or integer values.
MooseEnum()
Constructor for use by libmesh::Parameters and ReporterMode.
bool compareCurrent(const MooseEnum &other, CompareMode mode=CompareMode::COMPARE_NAME) const
Method for comparing currently set values between MooseEnum.
T getEnum() const
get the current value cast to the enum type T
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...