5#ifndef IDENTIFIER_IDENTIFIERFIELD_H
6#define IDENTIFIER_IDENTIFIERFIELD_H
124 inline std::pair<element_type, element_type>
135 return std::get<element_vector>(
m_data);
160 void set (
bool wraparound);
168 operator std::string ()
const;
199 std::variant<element_vector, BoundedRange>
m_data{};
214 if (
const auto * p{std::get_if<BoundedRange>(&
m_data)}; p) {
216 throw std::out_of_range(
"IdentifierField::get_value_at");
218 return (p->first +
index);
220 return ((std::get<element_vector>(
m_data)).at(
index));
std::ostream & operator<<(std::ostream &out, const IdentifierField &c)
std::istream & operator>>(std::istream &in, IdentifierField &c)
boost::container::small_vector< element_type, 12 >::size_type size_type
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
ExpandedIdentifier::size_type size_type
bool operator==(const IdentifierField &other) const
static constexpr auto minimum_possible
IdentifierField()=default
Create a wild-card value.
size_type get_indices() const
std::pair< element_type, element_type > BoundedRange
void set_previous(int previous)
bool get_previous(element_type current, element_type &previous) const
Returns false if previous/next is at end of range, or not possible.
element_type get_minimum() const
Query the values.
void add_value(element_type value)
void set(element_type minimum, element_type maximum)
static constexpr auto maximum_possible
bool empty() const
If true, this field does not have any constraints, and may hold any value representable by element_ty...
bool overlaps_with(const IdentifierField &other) const
Check whether two IdentifierFields overlap (Are there any values which satisfy the constraints of bot...
std::vector< element_type > element_vector
std::pair< element_type, element_type > get_minmax() const
void set_maximum(element_type value)
continuation_mode m_continuation_mode
static constexpr auto invalidValues
bool check_for_both_bounded()
Check mode - switch from enumerated to both_bounded if possible.
size_type get_value_index(element_type value) const
bool isEnumerated() const
void operator|=(const IdentifierField &other)
Find the union of two fields.
void optimize()
Optimize - try to switch mode to both_bounded, set up lookup table for finding index from value.
bool get_next(element_type current, element_type &next) const
ExpandedIdentifier::element_type element_type
void create_index_table()
Create index table from value table.
bool match(element_type value) const
The basic match operation Given a value, test to see if it satisfies the constraints for this field.
std::vector< size_type > index_vector
static constexpr int m_maxNumberOfIndices
element_type get_value_at(size_type index) const
const element_vector & get_values() const
void set(const element_vector &values)
void set_minimum(element_type value)
element_type get_maximum() const
size_type get_bits() const
Return the number of bits needed to store a value of this field.
const index_vector & get_indexes() const
std::variant< element_vector, BoundedRange > m_data