Scanframe Modular Application 0.1.0
|
Class to manage 64-bit integer ranges. More...
#include <Range.h>
Classes | |
class | Vector |
Type to contain and manipulate range lists. More... | |
Public Types | |
enum | ECompare : int { cmpError = std::numeric_limits<int>::max() , cmpSame = 0 , cmpWithinSelf = 1 , cmpWithinOther = -1 , cmpOverlapsOther = 2 , cmpOverlapsSelf = -2 , cmpExtendsOther = 3 , cmpExtendsSelf = -3 , cmpBeforeSelf = 4 , cmpAfterSelf = -4 , cmpSelfEmpty = 5 , cmpOtherEmpty = -5 } |
All possible comparison results. More... | |
typedef RANGE::size_type | size_type |
Integer type used for start and stop. | |
typedef RANGE::id_type | id_type |
Integer type used for the ID. | |
typedef Vector::iter_type | Iterator |
Iteration type for lists of ranges. | |
Public Member Functions | |
Range () | |
Default constructor. | |
Range & | operator= (Range &&)=default |
Move assignment operator is default. | |
Range (const Range &r) | |
Copy constructor. | |
Range (const RANGE &r) | |
Base class constructor. | |
Range (size_type start, size_type stop, id_type id=0) | |
Initializing constructor. | |
void | normalize () |
Swaps start and stop if the order is wrong. | |
Range & | assign (size_type start, size_type stop, id_type id=0) |
Assigns the data members. | |
Range & | assign (const Range &r) |
InitializeBase instance with other instance. | |
Range & | set (const RANGE &r) |
InitializeBase instance with other instance. | |
const Range & | copyTo (RANGE &dst) const |
size_type | getStart () const |
Const function to access the start of the range. | |
size_type | getStop () const |
Const function to access the stop of the range. | |
void | clear () |
Clears the range to an empty state. | |
size_type | getSize () const |
Returns the size of the range minimum is 1. | |
bool | isEmpty () const |
Return true if the range is empty. | |
bool | isOverlapped (const Range &r) const |
Returns if the passed range have some overlap. | |
bool | isWithinOther (const Range &r) const |
Returns true if the passed range is part of this range. | |
bool | isWithinSelf (const Range &r) const |
Returns true if this range is part of the passed range. | |
bool | isExtension (const Range &r) const |
Returns if the passed range an extension of this one. | |
bool | isMergeable (const Range &r) const |
Returns true if the passed range can be combined to this range without having to bridge a gap. | |
size_type | split (size_type seg_sz, Vector &rl_dst) const |
Splits this range into segments bounded ranges according to the passed segment size. | |
bool | isInRange (size_type idx) const |
Check if idx is within this range. | |
const RANGE & | getBase () const |
Gets the underlying base structure. | |
operator bool () const | |
Boolean operator for testing content of this instance. | |
ECompare | compare (const Range &other) const |
Base function for comparing ranges. | |
id_type | getId () const |
Returns the owner id of this range. | |
Range & | setId (id_type id) |
Set the owner id of this range. | |
Range & | operator= (const Range &r) |
Assignment operator allow derived classes to copy their data members. | |
Range & | operator= (const RANGE &r) |
Assignment operator allow derived classes to copy their data members. | |
bool | operator== (const Range &r) const |
Tests if the range start and stop members are the same. | |
bool | operator!= (const Range &r) const |
Tests if the range start and stop members are not the same. | |
bool | operator< (const Range &r) const |
Operator used for sorting. Depends only on the start position first and then the stop position. Empty ranges are always larger than non-empty ones to be able to move empty ones to the end of a vector. | |
Range | operator& (const Range &r) const |
And operator which is a subset of both range where elements of the one also exist in the other range. | |
Range & | operator&= (const Range &r) |
And operator which is a subset of both range where elements of the one also exist in the other range. | |
Range | operator+ (const Range &r) const |
Returns a new range which is a super Set of the two ranges. | |
Range & | operator+= (const Range &r) |
Returns a new range which is a super Set of the two ranges. | |
int | exclude (const Range &r, Range &rest, Range::ECompare *cmp=nullptr) |
Exclude the range in the other which could result in an single range (0), an additional second range (1) or in an single empty range (-1). | |
Range & | offsetBy (size_type ofs) |
Shifts this range using the passed offset. | |
Range | offset (size_type ofs) const |
Shifts the range using the passed offset. | |
bool | operator> (const Range &r) const =delete |
Not allowed operator. | |
bool | operator> (const Range &r)=delete |
Not allowed operator. | |
bool | operator<= (const Range &r) const =delete |
Not allowed operator. | |
bool | operator<= (const Range &r)=delete |
Not allowed operator. | |
bool | operator>= (const Range &r) const =delete |
Not allowed operator. | |
bool | operator>= (const Range &r)=delete |
Not allowed operator. | |
Static Public Member Functions | |
static size_type | split (size_type seg_sz, const Range &req, Vector &rl_dst) |
Splits a range into segments bounded ranges according to the passed segment size. | |
static size_type | split (size_type seg_sz, const Vector &req, Vector &rl) |
Same as split but now for a complete vector of ranges. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Range &r) |
Output stream operator for a range. | |
std::istream & | operator>> (std::istream &is, Range &r) |
Input stream operator for a range. | |
Class to manage 64-bit integer ranges.
typedef RANGE::id_type sf::Range::id_type |
Integer type used for the ID.
typedef Vector::iter_type sf::Range::Iterator |
Iteration type for lists of ranges.
typedef RANGE::size_type sf::Range::size_type |
Integer type used for start and stop.
enum sf::Range::ECompare : int |
All possible comparison results.
'-' token of 'this' range.
'=' token of the 'other' range.
|
inline |
Default constructor.
|
inline |
Copy constructor.
r |
|
inlineexplicit |
Base class constructor.
Initializing constructor.
start | Start of the range. |
stop | Start of the range. |
id | Identifier of the range. |
Assigns the data members.
start | Start of the range. |
stop | Start of the range. |
id | Identifier of the range. |
|
inline |
Clears the range to an empty state.
Copies the current instance to RANGE base struct.
int sf::Range::exclude | ( | const Range & | r, |
Range & | rest, | ||
Range::ECompare * | cmp = nullptr |
||
) |
Exclude the range in the other which could result in an single range (0), an additional second range (1) or in an single empty range (-1).
r | Range excluded from this one. |
rest | Set when 2 is returned. |
cmp | Optional compare result. |
|
inline |
Gets the underlying base structure.
|
inline |
Returns the owner id of this range.
|
inline |
Returns the size of the range minimum is 1.
|
inline |
Const function to access the start of the range.
|
inline |
Const function to access the stop of the range.
|
inline |
Return true if the range is empty.
bool sf::Range::isExtension | ( | const Range & | r | ) | const |
Returns if the passed range an extension of this one.
|
inline |
Check if idx is within this range.
bool sf::Range::isMergeable | ( | const Range & | r | ) | const |
Returns true if the passed range can be combined to this range without having to bridge a gap.
bool sf::Range::isOverlapped | ( | const Range & | r | ) | const |
Returns if the passed range have some overlap.
bool sf::Range::isWithinOther | ( | const Range & | r | ) | const |
Returns true if the passed range is part of this range.
bool sf::Range::isWithinSelf | ( | const Range & | r | ) | const |
Returns true if this range is part of the passed range.
void sf::Range::normalize | ( | ) |
Swaps start and stop if the order is wrong.
Shifts the range using the passed offset.
Shifts this range using the passed offset.
ofs | Offset |
|
inlineexplicit |
Boolean operator for testing content of this instance.
|
inline |
Tests if the range start and stop members are not the same.
And operator which is a subset of both range where elements of the one also exist in the other range.
And operator which is a subset of both range where elements of the one also exist in the other range.
Returns a new range which is a super Set of the two ranges.
A gap in between is bridged by the resulting.
Returns a new range which is a super Set of the two ranges.
A gap in between is bridged by the resulting.
|
inline |
Operator used for sorting. Depends only on the start position first and then the stop position. Empty ranges are always larger than non-empty ones to be able to move empty ones to the end of a vector.
|
delete |
Not allowed operator.
|
delete |
Not allowed operator.
Assignment operator allow derived classes to copy their data members.
Assignment operator allow derived classes to copy their data members.
|
inline |
Tests if the range start and stop members are the same.
|
delete |
Not allowed operator.
|
delete |
Not allowed operator.
|
delete |
Not allowed operator.
|
delete |
Not allowed operator.
Splits a range into segments bounded ranges according to the passed segment size.
The ID field of the range carries the segment index.
seg_sz | Size of the segment. |
req | Requested range. |
rl_dst | Destination list to receive the range(s) after splitting. |
Same as split but now for a complete vector of ranges.
seg_sz | Size of the segment. |
req | Requested ranges. |
rl | List where ranges are appended. |
|
inline |
Splits this range into segments bounded ranges according to the passed segment size.
The ID field of the range carries the segment index.
seg_sz | Size of the segment. |
rl_dst | Destination list to receive the range(s) after splitting. |
|
friend |
Output stream operator for a range.
|
friend |
Input stream operator for a range.