275 explicit inline operator bool()
const;
288 cmpError = std::numeric_limits<int>::max(),
320 cmpOverlapsOther = 2,
328 cmpOverlapsSelf = -2,
529#include <misc/gen/Range.hpp>
Type to contain and manipulate range lists.
Definition Range.h:68
Vector sort() const
Sorts the vector according the Range operator '<'.
Vector & rearrange()
Rearranges vector of ranges which means the vector is sorted and ranges are merged if possible.
Vector extract(const Vector &rl, Vector &rl_ex) const
Extracts the covered ranges in the vector using the 'rl' vector and puts them in the 'rl_ex' vector.
Vector & sort()
Sorts the vector according the Range operator '<'.
Vector & merge(const Vector &rl_add)
Adds the passed list to this vector and rearranges it.
Class to manage 64-bit integer ranges.
Definition Range.h:53
ECompare compare(const Range &other) const
Base function for comparing ranges.
size_type getSize() const
Returns the size of the range minimum is 1.
bool operator>=(const Range &r)=delete
Not allowed operator.
Range & assign(const Range &r)
InitializeBase instance with other instance.
Range(const RANGE &r)
Base class constructor.
RANGE::size_type size_type
Integer type used for start and stop.
Definition Range.h:58
Range & set(const RANGE &r)
InitializeBase instance with other instance.
const Range & copyTo(RANGE &dst) const
bool isOverlapped(const Range &r) const
Returns if the passed range have some overlap.
void clear()
Clears the range to an empty state.
Range operator+(const Range &r) const
Returns a new range which is a super Set of the two ranges.
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.
bool operator>(const Range &r)=delete
Not allowed operator.
id_type getId() const
Returns the owner id of this range.
friend std::istream & operator>>(std::istream &is, Range &r)
Input stream operator for a range.
Range & assign(size_type start, size_type stop, id_type id=0)
Assigns the data members.
Range & setId(id_type id)
Set the owner id of this range.
bool operator>=(const Range &r) const =delete
Not allowed operator.
const RANGE & getBase() const
Gets the underlying base structure.
Range & operator=(Range &&)=default
Move assignment operator is default.
Range(const Range &r)
Copy constructor.
Range(size_type start, size_type stop, id_type id=0)
Initializing constructor.
RANGE::id_type id_type
Integer type used for the ID.
Definition Range.h:62
void normalize()
Swaps start and stop if the order is wrong.
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.
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.
bool operator<=(const Range &r) const =delete
Not allowed operator.
bool operator>(const Range &r) const =delete
Not allowed operator.
static size_type split(size_type seg_sz, const Vector &req, Vector &rl)
Same as split but now for a complete vector of ranges.
Vector::iter_type Iterator
Iteration type for lists of ranges.
Definition Range.h:121
bool operator<=(const Range &r)=delete
Not allowed operator.
bool operator<(const Range &r) const
Operator used for sorting. Depends only on the start position first and then the stop position....
bool isInRange(size_type idx) const
Check if idx is within this range.
size_type getStop() const
Const function to access the stop of the range.
friend std::ostream & operator<<(std::ostream &os, const Range &r)
Output stream operator for a range.
bool isWithinOther(const Range &r) const
Returns true if the passed range is part of this range.
ECompare
All possible comparison results.
Definition Range.h:284
Range()
Default constructor.
Range & operator+=(const Range &r)
Returns a new range which is a super Set of the two ranges.
Range & operator=(const Range &r)
Assignment operator allow derived classes to copy their data members.
bool isWithinSelf(const Range &r) const
Returns true if this range is part of the passed range.
bool isEmpty() const
Return true if the range is empty.
size_type getStart() const
Const function to access the start of the range.
Range offset(size_type ofs) const
Shifts the range using the passed offset.
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 ...
bool operator!=(const Range &r) const
Tests if the range start and stop members are not the same.
size_type split(size_type seg_sz, Vector &rl_dst) const
Splits this range into segments bounded ranges according to the passed segment size.
Range & offsetBy(size_type ofs)
Shifts this range using the passed offset.
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.
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.
Counted vector having additional methods and operators for ease of usage. This template class extends...
Definition TVector.h:20
TIterator< value_type > iter_type
Iteration type of the template.
Definition TVector.h:37
#define _MISC_FUNC
Definition misc/global.h:39
#define _MISC_CLASS
Definition misc/global.h:40
#define _MISC_DATA
Definition misc/global.h:38
Definition Application.h:10
_GII_FUNC std::istream & operator>>(std::istream &is, ResultData &)
Stream operator for setting up this instance with a setup std::string.
_MISC_DATA bool RangeCompareExact
_GII_FUNC std::ostream & operator<<(std::ostream &os, const ResultData &)
Stream operator for the setup std::string.
uint64_t size_type
Integer type used for start and stop.
Definition Range.h:27
id_type _id
Identifier of this range.
Definition Range.h:43
int64_t id_type
Integer type used for the ID.
Definition Range.h:31
size_type _start
Start position of the range or interval.
Definition Range.h:35
size_type _stop
Stop position of the range or interval.
Definition Range.h:39