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>
170 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");
bool operator!=(const char *value) const
CompareMode
Enum item for controlling comparison in the compareCurrent method.
static const int INVALID_ID
T getEnum() const
get the current value cast to the enum type T
virtual void checkDeprecated() const override
Check whether the current value is deprecated when called.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
The base class for both the MooseEnum and MultiMooseEnum classes.
MooseEnumItem _current
The current id.
MooseEnum()
Constructor for use by libmesh::Parameters and ReporterMode.
virtual ~MooseEnum()=default
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
const std::string & rawName() const
void assign(const std::string &name, const std::optional< std::string > &context={})
friend std::ostream & operator<<(std::ostream &out, const MooseEnum &obj)
Operator for printing to iostreams.
const int & id() const
Return the numeric, name, or raw name.
MooseEnum & operator=(const MooseEnum &other_enum)=default
Copy Assignment operator must be explicitly defined when a copy ctor exists and this method is used...
Class for containing MooseEnum item information.
bool operator==(const char *value) const
Comparison operators for comparing with character constants, MooseEnums or integer values...
bool compareCurrent(const MooseEnum &other, CompareMode mode=CompareMode::COMPARE_NAME) const
Method for comparing currently set values between MooseEnum.
OStreamProxy out(std::cout)
virtual bool isValid() const override
IsValid.
void ErrorVector unsigned int