NEML2 2.0.0
|
Selection of multiple enum value from a list of candidates. More...
Selection of multiple enum value from a list of candidates.
#include <MultiEnumSelection.h>
Public Member Functions | |
MultiEnumSelection ()=default | |
MultiEnumSelection (const std::vector< std::string > &candidates, const std::vector< std::string > &selections) | |
Create a multi-enum selection from a list of candidates and default selections. | |
MultiEnumSelection (const std::vector< std::string > &candidates, const std::vector< int > &values, const std::vector< std::string > &selections) | |
Create a multi-enum selection from a list of candidates, their corresponding values, and default selections. | |
void | select (const std::vector< std::string > &selections) |
bool | operator== (const MultiEnumSelection &other) const |
Test for inequality. | |
bool | operator!= (const MultiEnumSelection &other) const |
Test for inequality. | |
operator std::vector< std::string > () const | |
Poor man's reflection implementation. | |
operator std::vector< int > () const | |
Selected values cast to int. | |
template<typename T > | |
std::vector< T > | as () const |
Statically cast the enum value to a C++ enum class. | |
Public Member Functions inherited from EnumSelectionBase | |
EnumSelectionBase ()=default | |
EnumSelectionBase (const std::vector< std::string > &candidates) | |
Create an enum selection from a list of candidates. | |
EnumSelectionBase (const std::vector< std::string > &candidates, const std::vector< int > &values) | |
Create an enum selection from a list of candidates and their corresponding values. | |
const std::unordered_map< std::string, int > & | candidates () const |
Candidates. | |
std::string | candidates_str () const |
Stringified candidates. | |
Additional Inherited Members | |
Protected Attributes inherited from EnumSelectionBase | |
std::unordered_map< std::string, int > | _candidate_map |
Mapping enum options to int. | |
|
default |
MultiEnumSelection | ( | const std::vector< std::string > & | candidates, |
const std::vector< std::string > & | selections ) |
Create a multi-enum selection from a list of candidates and default selections.
MultiEnumSelection | ( | const std::vector< std::string > & | candidates, |
const std::vector< int > & | values, | ||
const std::vector< std::string > & | selections ) |
Create a multi-enum selection from a list of candidates, their corresponding values, and default selections.
|
inline |
Statically cast the enum value to a C++ enum class.
|
inline |
Poor man's reflection implementation.
bool operator!= | ( | const MultiEnumSelection & | other | ) | const |
Test for inequality.
bool operator== | ( | const MultiEnumSelection & | other | ) | const |
Test for inequality.