27#include "neml2/base/EnumSelectionBase.h"
51 const std::vector<int> &
values,
68 const std::vector<std::string> &
selections()
const {
return _selections; }
71 const std::vector<int> &
values()
const {
return _values; }
75 std::vector<T>
as()
const
78 ret.reserve(_values.size());
79 for (
const auto & v : _values)
80 ret.push_back(
static_cast<T
>(v));
86 std::vector<std::string> _selections;
89 std::vector<int> _values;
EnumSelectionBase()=default
const std::unordered_map< std::string, int > & choices() const
Choices.
Definition EnumSelectionBase.h:52
Selection of multiple enum value from a list of choices.
Definition MultiEnumSelection.h:41
const std::vector< int > & values() const
Selected values cast to int.
Definition MultiEnumSelection.h:71
std::vector< T > as() const
Statically cast the enum value to a C++ enum class.
Definition MultiEnumSelection.h:75
MultiEnumSelection(const std::vector< std::string > &choices, const std::vector< int > &values, const std::vector< std::string > &selections)
Create a multi-enum selection from a list of choices, their corresponding values, and default selecti...
bool operator==(const MultiEnumSelection &other) const
Test for inequality.
void select(const std::vector< std::string > &selections)
MultiEnumSelection()=default
MultiEnumSelection(const std::vector< std::string > &choices, const std::vector< std::string > &selections)
Create a multi-enum selection from a list of choices and default selections.
bool operator!=(const MultiEnumSelection &other) const
Test for inequality.
std::size_t size() const
Number of selected values.
const std::vector< std::string > & selections() const
Poor man's reflection implementation.
Definition MultiEnumSelection.h:68
Definition DiagnosticsInterface.h:31
std::ostream & operator<<(std::ostream &, const EnumSelection &)
std::stringstream & operator>>(std::stringstream &, EnumSelection &)