Range
class Range
Class representing an integer range.
constructor Range
Create an empty range.
| Range | ( | ); |
constructor Range
Create a range with a specified start and size.
| Range | ( | uint64_t start, | |
| uint64_t size | ); |
| PARAMETER | DESCRIPTION |
|---|---|
start |
The starting value of the range. |
size |
The size of the range. |
method addconst
Add another range to this range, creating a new range that includes all values included in either range or between them.
| Range add | ( | const Range & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The other range to add. |
| RETURNS | DESCRIPTION |
|---|---|
Range |
A new range that includes all values included in either range or between them. |
method add_left
Extend the range to the left.
| void add_left | ( | uint64_t amount | ); |
| PARAMETER | DESCRIPTION |
|---|---|
amount |
The amount to extend the range by. |
method add_right
Extend the range to the right.
| void add_right | ( | uint64_t amount | ); |
| PARAMETER | DESCRIPTION |
|---|---|
amount |
The amount to extend the range by. |
method align
Adjust the start of the range to a specified alignment without changing its end.
| void align | ( | uint64_t alignment | ); |
| PARAMETER | DESCRIPTION |
|---|---|
alignment |
The alignment to align the range to. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
if the resulting range would be empty. |
method containsconst
Check if the range contains another range.
| bool contains | ( | const Range & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The range to check. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method emptyconst
Check if the range is empty.
| bool empty | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method endconst
Get the last value included in the range.
| uint64_t end | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
uint64_t |
The last value included in the range. |
method intersectconst
Get the intersection of the range with another range.
| Range intersect | ( | const Range & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The other range. |
| RETURNS | DESCRIPTION |
|---|---|
Range |
The intersection of the two ranges. |
method operator!=const
Check if two ranges are different.
| bool operator!= | ( | const Range & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The other range to compare with. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method operator<const
Order two ranges, first by their starting value, then by their size.
| bool operator< | ( | const Range & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The other range to compare with. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method operator==const
Check if two ranges are the same.
| bool operator== | ( | const Range & other | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
other |
The other range to compare with. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method remove_left
Remove a specified amount from the left of the range.
| void remove_left | ( | uint64_t amount | ); |
| PARAMETER | DESCRIPTION |
|---|---|
amount |
The amount to remove from the left of the range. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
if the range is smaller than |
method remove_right
Remove a specified amount from the right of the range.
| void remove_right | ( | uint64_t amount | ); |
| PARAMETER | DESCRIPTION |
|---|---|
amount |
The amount to remove from the right of the range. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
if the range is smaller than |
method serializeconst
Serialize the range to a stream.
| void serialize | ( | std::ostream & stream | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
stream |
The stream to serialize to. |
method set_end
Set the ending value of the range, keeping the start fixed.
| void set_end | ( | uint64_t new_end | ); |
| PARAMETER | DESCRIPTION |
|---|---|
new_end |
The new ending value of the range. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
if the |
method set_start
Set the starting value of the range, keeping the end fixed.
| void set_start | ( | uint64_t new_start | ); |
| PARAMETER | DESCRIPTION |
|---|---|
new_start |
The new starting value of the range. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
if the |
member size
The size of the range. The range includes the values from start to start + size - 1.
member start
The starting value of the range.