#include <rangemap.h>
A RangeSet allows to add or remove a whole range of values to the set by a single operation (and a single entry in the set). Therefore, it is very useful for, e.g., selection sets where it is likely that contiguous ranges of indices are selected.
RangeSet is based on RangeMap, see there for more details.
RangeSet supports the usual iterators. They iterate through the map per range (not per each value of a range).
T | Type of keys. This must be an integral type. |
MAP | A map selector template to choose the underlying map implementation to use. This has to be an ordered map. Note that the default is the BurstTrieMap which only allows unsigned integral types. |
Public Types | |
using | Super = RangeMap< T, UnitType, MAP > |
using | Iterator = typename Super::KeyIterator |
using | ConstIterator = typename Super::ConstKeyIterator |
Static Public Member Functions | |
static Result< void > | DescribeIO (const DataSerializeInterface &stream) |
Additional Inherited Members | |
Private Types inherited from RangeMap< T, UnitType, BurstTrieMapSelector<> > | |
using | MapType = typename MAP::template Type< T, Tuple< T, UnitType > > |
using | Range = maxon::Range< T > |
using | ValueType = typename MapType::ValueType |
using | MapValue = typename MapType::ValueType |
using | Iterator = typename MapType::template IteratorTemplate< false, EntryIteratorBase > |
using | ConstIterator = typename MapType::template IteratorTemplate< true, EntryIteratorBase > |
using | KeyIterator = typename MapType::template IteratorTemplate< false, KeyIteratorBase > |
using | ConstKeyIterator = typename MapType::template IteratorTemplate< true, KeyIteratorBase > |
using | ValueIterator = typename MapType::template IteratorTemplate< false, ValueIteratorBase > |
using | ConstValueIterator = typename MapType::template IteratorTemplate< true, ValueIteratorBase > |
Static Private Member Functions inherited from RangeMap< T, UnitType, BurstTrieMapSelector<> > | |
static Result< void > | DescribeIO (const DataSerializeInterface &stream) |
using Iterator = typename Super::KeyIterator |
using ConstIterator = typename Super::ConstKeyIterator |
RangeSet | ( | ) |
HashInt GetHashCode | ( | ) | const |
UniqueHash GetUniqueHashCode | ( | ) | const |
MAXON_OPERATOR_MOVE_ASSIGNMENT | ( | RangeSet< T, MAP > | ) |
const Super& GetMap | ( | ) | const |
ResultMem Insert | ( | T | value | ) |
Adds the given value
to this set.
[in] | value | Value to add. |
ResultMem Insert | ( | T | minValue, |
T | maxValue | ||
) |
Adds the range minValue
... maxValue
to this set, i.e., all values within that range will be contained in this set afterwards. If minValue
is greater than maxValue
, nothing happens.
[in] | minValue | Lower boundary of the range to add. |
[in] | maxValue | Upper boundary of the range to add. |
ResultMem Insert | ( | const typename Super::Range & | range | ) |
Adds the given range
to this set, i.e., all values within that range will be contained in this set afterwards. If the range is empty, nothing happens.
[in] | range | The range to add. |
ResultMem Erase | ( | T | value | ) |
Removes a single value from this set.
[in] | value | Value to remove. |
ResultMem Erase | ( | T | minValue, |
T | maxValue | ||
) |
Removes the range minValue
... maxValue
from this set, i.e., all values within that range won't be contained in this set afterwards. If minValue
is greater than maxValue
, nothing happens.
[in] | minValue | Lower boundary of the range to remove. |
[in] | maxValue | Upper boundary of the range to remove. |
ResultMem Erase | ( | const typename Super::Range & | range | ) |
Removes the given range
from this set, i.e., all values within that range won't be contained in this set afterwards. If the range is empty, nothing happens.
[in] | range | The range to remove. |
Bool Contains | ( | T | value | ) | const |
Checks if this set contains value
.
[in] | value | The value to check. |
value
. Bool Contains | ( | T | minValue, |
T | maxValue | ||
) |
Checks if this set contains all values of the range minValue
... maxValue
.
[in] | minValue | Lower boundary of the range to remove. |
[in] | maxValue | Upper boundary of the range to remove. |
minValue
... maxValue
. Bool Contains | ( | const typename Super::Range & | range | ) |
Checks if this set contains all values of the given range
, i.e., if range
is a subset of this set.
[in] | range | The range to check. |
range
. Bool FindRange | ( | T | value, |
typename Super::Range & | rangeOut | ||
) | const |
Finds the contiguous range of values of this set which contains value
. If such a range exists, rangeOut
is set to the range and true
is returned, otherwise false
is returned.
[in] | value | The value to check. |
[out] | rangeOut | If a range containing value is found, rangeOut is set to this range. |
ConstIterator Begin | ( | ) | const |
ConstIterator End | ( | ) | const |
Iterator Begin | ( | ) |
Iterator End | ( | ) |
|
private |
void Reset |
Resets the map. This removes all entries and frees any memory held by the map, so the map will be in a state as if it had been newly constructed.
void Flush |
Flushes the map. This removes all entries. Depending on the underlying map, memory may still be held for later re-use.
Bool IsEmpty |
Checks if the RangeMap is empty. This is the same as GetCount() == 0
Bool IsPopulated |
Checks if the RangeMap is populated. This is the same as GetCount() != 0
Int GetCount |
Returns the number of entries in this map. Each contiguous key range where the keys are mapped to the same value requires a single entry.
Int GetMemorySize |
Calculates the memory usage for this map. Keys and Values must have a public member GetMemorySize that return the element size.
SFINAEHelper<String, K>::type ToString |
|
static |