The base class for both the MooseEnum and MultiMooseEnum classes. More...
#include <MooseEnumBase.h>
Public Member Functions | |
MooseEnumBase (std::string names, bool allow_out_of_range=false) | |
Constructor that takes a list of enumeration values, and a separate string to set a default for this instance. More... | |
MooseEnumBase (const MooseEnumBase &other_enum) | |
Copy Constructor for use when creating vectors of MooseEnumBases. More... | |
MooseEnumBase & | operator= (const MooseEnumBase &other_enum)=default |
Copy Assignment operator must be explicitly defined when a copy ctor exists and this method is used. More... | |
virtual | ~MooseEnumBase ()=default |
This class must have a virtual destructor since it has derived classes. More... | |
virtual void | deprecate (const std::string &name, const std::string &raw_name="") |
Deprecates various options in the MOOSE enum. More... | |
std::vector< std::string > | getNames () const |
Method for returning a vector of all valid enumeration names for this instance. More... | |
std::string | getRawNames () const |
Method for returning the raw name strings for this instance. More... | |
std::vector< int > | getIDs () const |
Method for returning a vector of ids for this instance. More... | |
virtual bool | isValid () const =0 |
IsValid. More... | |
bool | isOutOfRangeAllowed () const |
isOutOfRangeAllowed More... | |
const std::set< MooseEnumItem > & | items () const |
Return the complete set of available flags. More... | |
void | addDocumentation (const std::string &name, const std::string &doc) |
Add an item documentation string. More... | |
const std::map< MooseEnumItem, std::string > & | getItemDocumentation () const |
Get the map containing each item's documentation string. More... | |
int | getNextValidID () const |
Compute the next valid ID. More... | |
MooseEnumBase & | operator+= (const std::string &name) |
Adds an enumeration item from name. More... | |
MooseEnumBase & | operator+= (const std::initializer_list< std::string > &names) |
Adds enumeration items from a list of names. More... | |
std::set< MooseEnumItem >::const_iterator | find (const MooseEnumItem &other) const |
Locate an item. More... | |
std::set< MooseEnumItem >::const_iterator | find (const std::string &name) const |
std::set< MooseEnumItem >::const_iterator | find (int id) const |
Protected Member Functions | |
MooseEnumBase () | |
Private constuctor for use by libmesh::Parameters. More... | |
virtual void | checkDeprecated () const =0 |
Method that must be implemented to check derived class values against the _deprecated_names. More... | |
void | checkDeprecated (const MooseEnumItem &item) const |
Check and warn deprecated values. More... | |
void | addEnumerationNames (const std::string &names) |
Methods to add possible enumeration value to the enum. More... | |
const MooseEnumItem & | addEnumerationName (const std::string &raw_name) |
const MooseEnumItem & | addEnumerationName (const std::string &name, const int &value) |
const MooseEnumItem & | addEnumerationItem (const MooseEnumItem &item) |
Protected Attributes | |
std::set< MooseEnumItem > | _items |
Storage for the assigned items. More... | |
std::map< MooseEnumItem, MooseEnumItem > | _deprecated_items |
The map of deprecated names and optional replacements. More... | |
bool | _allow_out_of_range |
Flag to enable enumeration items not previously defined. More... | |
std::map< MooseEnumItem, std::string > | _item_documentation |
The map of items and their respective documentation strings. More... | |
The base class for both the MooseEnum and MultiMooseEnum classes.
Definition at line 24 of file MooseEnumBase.h.
MooseEnumBase::MooseEnumBase | ( | std::string | names, |
bool | allow_out_of_range = false |
||
) |
Constructor that takes a list of enumeration values, and a separate string to set a default for this instance.
names | - a list of names for this enumeration |
allow_out_of_range | - determines whether this enumeration will accept values outside of its range of defined values. |
Definition at line 23 of file MooseEnumBase.C.
MooseEnumBase::MooseEnumBase | ( | const MooseEnumBase & | other_enum | ) |
Copy Constructor for use when creating vectors of MooseEnumBases.
other_enum | - The other enumeration to copy state from |
Definition at line 32 of file MooseEnumBase.C.
|
virtualdefault |
This class must have a virtual destructor since it has derived classes.
|
protected |
Private constuctor for use by libmesh::Parameters.
Definition at line 42 of file MooseEnumBase.C.
void MooseEnumBase::addDocumentation | ( | const std::string & | name, |
const std::string & | doc | ||
) |
Add an item documentation string.
Definition at line 175 of file MooseEnumBase.C.
Referenced by PseudoTimestep::validParams(), and ReferenceResidualInterface::validParams().
|
protected |
Definition at line 117 of file MooseEnumBase.C.
Referenced by ExecFlagEnum::addAvailableFlags(), addEnumerationName(), MultiMooseEnum::addValidName(), MultiMooseEnum::assignValues(), and ReporterProducerEnum::insert().
|
protected |
Definition at line 73 of file MooseEnumBase.C.
Referenced by addEnumerationNames(), MultiMooseEnum::addValidName(), and operator+=().
|
protected |
Definition at line 111 of file MooseEnumBase.C.
|
protected |
Methods to add possible enumeration value to the enum.
The MooseEnum/MultiMooseEnum are not designed to be modified, with respect to the list of possible values. However, this is not the case for the ExecFlagEnum which is a special type of MultiMooseEnum for managing the "execute_on" flags. These methods are used by ExecFlagEnum to allow users to modify the available execute flags for their object.
Definition at line 64 of file MooseEnumBase.C.
Referenced by MooseEnumBase().
|
protectedpure virtual |
Method that must be implemented to check derived class values against the _deprecated_names.
Implemented in MultiMooseEnum, and MooseEnum.
Referenced by MooseEnum::checkDeprecated(), MultiMooseEnum::checkDeprecated(), deprecate(), and operator+=().
|
protected |
Check and warn deprecated values.
Definition at line 136 of file MooseEnumBase.C.
|
virtual |
Deprecates various options in the MOOSE enum.
For each deprecated option, you may supply an optional new option that will be used in a message telling the user which new option replaces the old one.
Definition at line 45 of file MooseEnumBase.C.
std::set< MooseEnumItem >::const_iterator MooseEnumBase::find | ( | const MooseEnumItem & | other | ) | const |
Locate an item.
Definition at line 206 of file MooseEnumBase.C.
Referenced by addDocumentation(), addEnumerationItem(), ExecFlagEnum::appendCurrent(), MooseEnum::assign(), MultiMooseEnum::assignValues(), deprecate(), FVAdvection::FVAdvection(), MooseEnum::operator==(), moose::internal::ExecFlagRegistry::registerFlag(), ExecFlagEnum::removeAvailableFlags(), CreateExecutionerAction::setupAutoPreconditioning(), and ReadExecutorParamsAction::setupAutoPreconditioning().
std::set< MooseEnumItem >::const_iterator MooseEnumBase::find | ( | const std::string & | name | ) | const |
Definition at line 190 of file MooseEnumBase.C.
std::set< MooseEnumItem >::const_iterator MooseEnumBase::find | ( | int | id | ) | const |
Definition at line 199 of file MooseEnumBase.C.
std::vector< int > MooseEnumBase::getIDs | ( | ) | const |
Method for returning a vector of ids for this instance.
Definition at line 165 of file MooseEnumBase.C.
Referenced by MooseEnum::assign().
const std::map< MooseEnumItem, std::string > & MooseEnumBase::getItemDocumentation | ( | ) | const |
Get the map containing each item's documentation string.
Definition at line 184 of file MooseEnumBase.C.
std::vector< std::string > MooseEnumBase::getNames | ( | ) | const |
Method for returning a vector of all valid enumeration names for this instance.
Definition at line 149 of file MooseEnumBase.C.
int MooseEnumBase::getNextValidID | ( | ) | const |
Compute the next valid ID.
Definition at line 102 of file MooseEnumBase.C.
Referenced by addEnumerationName(), MultiMooseEnum::addValidName(), MooseEnum::assign(), MultiMooseEnum::assignValues(), and moose::internal::ExecFlagRegistry::registerFlag().
std::string MooseEnumBase::getRawNames | ( | ) | const |
Method for returning the raw name strings for this instance.
Definition at line 159 of file MooseEnumBase.C.
Referenced by MooseEnum::assign(), MultiMooseEnum::assignValues(), Moose::createMapFromVectorAndMultiMooseEnum(), AdvancedOutput::enableOutputTypes(), MooseEnum::operator==(), PiecewiseConstant::validParams(), LeastSquaresFit::validParams(), BatchMeshGeneratorAction::validParams(), and ComparisonPostprocessor::validParams().
|
inline |
isOutOfRangeAllowed
Definition at line 88 of file MooseEnumBase.h.
|
pure virtual |
IsValid.
Implemented in MultiMooseEnum, and MooseEnum.
|
inline |
Return the complete set of available flags.
Definition at line 93 of file MooseEnumBase.h.
Referenced by MooseEnum::assign(), FVAdvection::FVAdvection(), CreateExecutionerAction::setupAutoPreconditioning(), and ReadExecutorParamsAction::setupAutoPreconditioning().
MooseEnumBase & MooseEnumBase::operator+= | ( | const std::string & | name | ) |
Adds an enumeration item from name.
Definition at line 216 of file MooseEnumBase.C.
Referenced by MultiMooseEnum::operator+=().
MooseEnumBase & MooseEnumBase::operator+= | ( | const std::initializer_list< std::string > & | names | ) |
Adds enumeration items from a list of names.
Definition at line 224 of file MooseEnumBase.C.
|
default |
Copy Assignment operator must be explicitly defined when a copy ctor exists and this method is used.
|
protected |
Flag to enable enumeration items not previously defined.
Definition at line 163 of file MooseEnumBase.h.
Referenced by MooseEnum::assign(), MultiMooseEnum::assignValues(), isOutOfRangeAllowed(), and MooseEnum::operator==().
|
protected |
The map of deprecated names and optional replacements.
Definition at line 160 of file MooseEnumBase.h.
Referenced by checkDeprecated(), and deprecate().
|
protected |
The map of items and their respective documentation strings.
Definition at line 166 of file MooseEnumBase.h.
Referenced by addDocumentation(), and getItemDocumentation().
|
protected |
Storage for the assigned items.
Definition at line 157 of file MooseEnumBase.h.
Referenced by addDocumentation(), addEnumerationItem(), MultiMooseEnum::addValidName(), ExecFlagEnum::appendCurrent(), MooseEnum::assign(), MultiMooseEnum::assignValues(), ReporterProducerEnum::clear(), deprecate(), find(), getIDs(), getNames(), getNextValidID(), getRawNames(), ExecFlagEnum::items(), items(), MooseEnum::operator==(), and ExecFlagEnum::removeAvailableFlags().