Ethereum  PoC-8
The C++ Implementation of Ethereum
dev::RangeMask Class Reference

#include <RangeMask.h>

Classes

class  const_iterator
 

Public Types

using Range = std::pair< unsigned, unsigned >
 
using Ranges = std::vector< Range >
 

Public Member Functions

 RangeMask ()
 Constructs an empty range mask with empty ground range. More...
 
 RangeMask (unsigned _begin, unsigned _end)
 Constructs an empty range mask with ground range [_begin, _end). More...
 
 RangeMask (Range const &_c)
 Constructs an empty range mask with ground range _c. More...
 
RangeMask unionedWith (RangeMask const &_m) const
 
RangeMask operator+ (RangeMask const &_m) const
 
RangeMask lowest (unsigned _items) const
 
RangeMask operator~ () const
 
RangeMask inverted () const
 
RangeMaskinvert ()
 
template<class S >
RangeMask operator- (S const &_m) const
 
template<class S >
RangeMaskoperator-= (S const &_m)
 
RangeMaskoperator+= (RangeMask const &_m)
 
RangeMaskunionWith (RangeMask const &_m)
 
RangeMaskoperator+= (Range const &_m)
 
RangeMaskunionWith (Range const &_m)
 
RangeMaskoperator+= (unsigned _m)
 Adds the single element _i to the range mask. More...
 
RangeMaskunionWith (unsigned _i)
 Adds the single element _i to the range mask. More...
 
bool contains (unsigned _i) const
 
bool empty () const
 
bool full () const
 
void clear ()
 
void reset ()
 
std::pair< unsigned, unsigned > const & all () const
 
void extendAll (unsigned _i)
 Extends the ground range to include _i. More...
 
const_iterator begin () const
 
const_iterator end () const
 
unsigned next (unsigned _t) const
 
size_t size () const
 
size_t firstOut () const
 
size_t lastIn () const
 

Friends

std::ostream & operator<< (std::ostream &_out, RangeMask const &_r)
 

Detailed Description

Set of elements of a certain "ground range" representable by unions of ranges inside this ground range. Ranges are given as pairs (begin, end), denoting the interval [begin, end), i.e. end is excluded. Supports set-theoretic operators, size and iteration.

Definition at line 46 of file RangeMask.h.

Member Typedef Documentation

◆ Range

using dev::RangeMask::Range = std::pair<unsigned, unsigned>

Definition at line 51 of file RangeMask.h.

◆ Ranges

using dev::RangeMask::Ranges = std::vector<Range>

Definition at line 52 of file RangeMask.h.

Constructor & Destructor Documentation

◆ RangeMask() [1/3]

dev::RangeMask::RangeMask ( )
inline

Constructs an empty range mask with empty ground range.

Definition at line 55 of file RangeMask.h.

◆ RangeMask() [2/3]

dev::RangeMask::RangeMask ( unsigned  _begin,
unsigned  _end 
)
inline

Constructs an empty range mask with ground range [_begin, _end).

Definition at line 57 of file RangeMask.h.

◆ RangeMask() [3/3]

dev::RangeMask::RangeMask ( Range const &  _c)
inline

Constructs an empty range mask with ground range _c.

Definition at line 59 of file RangeMask.h.

Member Function Documentation

◆ all()

std::pair<unsigned, unsigned> const& dev::RangeMask::all ( ) const
inline
Returns
the ground range.

Definition at line 153 of file RangeMask.h.

◆ begin()

const_iterator dev::RangeMask::begin ( ) const
inline

Definition at line 179 of file RangeMask.h.

◆ clear()

void dev::RangeMask::clear ( )
inline

Definition at line 141 of file RangeMask.h.

◆ contains()

bool dev::RangeMask::contains ( unsigned  _i) const
inline

Definition at line 123 of file RangeMask.h.

◆ empty()

bool dev::RangeMask::empty ( ) const
inline

Definition at line 131 of file RangeMask.h.

◆ end()

const_iterator dev::RangeMask::end ( ) const
inline

Definition at line 180 of file RangeMask.h.

◆ extendAll()

void dev::RangeMask::extendAll ( unsigned  _i)
inline

Extends the ground range to include _i.

Definition at line 155 of file RangeMask.h.

◆ firstOut()

size_t dev::RangeMask::firstOut ( ) const
inline

Definition at line 203 of file RangeMask.h.

◆ full()

bool dev::RangeMask::full ( ) const
inline

Definition at line 136 of file RangeMask.h.

◆ invert()

RangeMask& dev::RangeMask::invert ( )
inline

Changes the range mask to its complement relative to the ground range and returns a reference to itself.

Definition at line 95 of file RangeMask.h.

◆ inverted()

RangeMask dev::RangeMask::inverted ( ) const
inline
Returns
a copy of this range mask representing the complement relative to the ground range.

Definition at line 78 of file RangeMask.h.

◆ lastIn()

size_t dev::RangeMask::lastIn ( ) const
inline

Definition at line 210 of file RangeMask.h.

◆ lowest()

RangeMask dev::RangeMask::lowest ( unsigned  _items) const
inline
Returns
a new range mask containing the smallest _items elements (not ranges).

Definition at line 66 of file RangeMask.h.

◆ next()

unsigned dev::RangeMask::next ( unsigned  _t) const
inline
Returns
the smallest element in the range mask that is larger than _t or the end of the base range if such an element does not exist.

Definition at line 183 of file RangeMask.h.

◆ operator+()

RangeMask dev::RangeMask::operator+ ( RangeMask const &  _m) const
inline

Definition at line 63 of file RangeMask.h.

◆ operator+=() [1/3]

RangeMask& dev::RangeMask::operator+= ( Range const &  _m)
inline

Definition at line 110 of file RangeMask.h.

◆ operator+=() [2/3]

RangeMask& dev::RangeMask::operator+= ( RangeMask const &  _m)
inline

Definition at line 100 of file RangeMask.h.

◆ operator+=() [3/3]

RangeMask& dev::RangeMask::operator+= ( unsigned  _m)
inline

Adds the single element _i to the range mask.

Definition at line 116 of file RangeMask.h.

◆ operator-()

template<class S >
RangeMask dev::RangeMask::operator- ( S const &  _m) const
inline

Definition at line 97 of file RangeMask.h.

◆ operator-=()

template<class S >
RangeMask& dev::RangeMask::operator-= ( S const &  _m)
inline

Definition at line 98 of file RangeMask.h.

◆ operator~()

RangeMask dev::RangeMask::operator~ ( ) const
inline
Returns
the complement of the range mask relative to the ground range.

Definition at line 75 of file RangeMask.h.

◆ reset()

void dev::RangeMask::reset ( )
inline

Definition at line 146 of file RangeMask.h.

◆ size()

size_t dev::RangeMask::size ( ) const
inline
Returns
the number of elements (not ranges) in the range mask.

Definition at line 195 of file RangeMask.h.

◆ unionedWith()

RangeMask dev::RangeMask::unionedWith ( RangeMask const &  _m) const
inline
Returns
the union with the range mask _m, taking also the union of the ground ranges.

Definition at line 62 of file RangeMask.h.

◆ unionWith() [1/3]

RangeMask & dev::RangeMask::unionWith ( RangeMask::Range const &  _m)

Modifies this range mask to also include the range _m, which has to be a subset of the ground range.

Definition at line 233 of file RangeMask.h.

◆ unionWith() [2/3]

RangeMask& dev::RangeMask::unionWith ( RangeMask const &  _m)
inline

Definition at line 102 of file RangeMask.h.

◆ unionWith() [3/3]

RangeMask& dev::RangeMask::unionWith ( unsigned  _i)
inline

Adds the single element _i to the range mask.

Definition at line 118 of file RangeMask.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  _out,
RangeMask const &  _r 
)
friend

Definition at line 224 of file RangeMask.h.


The documentation for this class was generated from the following file: