STK++ 0.9.13
|
Index sub-vector region with fixed size. More...
#include <STK_Range.h>
Public Types | |
typedef RangeBase< TRange< Size_ > > | Base |
Public Member Functions | |
TRange (int size=Size_) | |
Default constructor. | |
TRange (int first, int) | |
Full constructor. | |
TRange (int first, int, bool) | |
Complete constructor. | |
TRange (TRange const &I) | |
copy constructor | |
template<int OtherSize_> | |
TRange (TRange< OtherSize_ > const &I) | |
copy constructor | |
~TRange () | |
destructor. | |
int | end () const |
get the ending index of the TRange. | |
int | size () const |
get the size of the TRange (the number of elements). | |
bool | empty () const |
check if the range is empty or not. | |
int | lastIdx () const |
get the last index of the TRange. | |
TRange & | shift (int begin) |
Shift the TRange giving the first element. | |
TRange & | inc (int inc=1) |
create the TRange [begin_+inc, end_+inc_]. | |
TRange & | dec (int dec=1) |
create the TRange [begin_-dec, end_-dec] | |
TRange & | incFirst (int inc=1) |
create the TRange [begin_+inc, end_]. | |
TRange & | decFirst (int dec=1) |
create the TRange [begin_-dec, end_] | |
TRange & | incEnd (int inc=1) |
create the TRange [begin_, end_+inc) | |
TRange & | decEnd (int dec=1) |
create the TRange [begin_, end_-dec) | |
TRange & | incLast (int inc=1) |
create the TRange [begin_, end_+inc) | |
TRange & | decLast (int dec=1) |
create the TRange [begin_, end_-dec) | |
![]() | |
~RangeBase () | |
destructor. | |
int | begin () const |
get the first index of the TRange. | |
bool | isIn (TRange< OtherSize_ > const &I) const |
check if this TRange in include in an other TRange | |
bool | isContaining (TRange< OtherSize_ > const &I) const |
check if the TRange I is include in the this TRange | |
bool | isContaining (int i) const |
Return true if i is in this TRange. | |
TRange< Size_ > & | operator+= (int i) |
shift range a:b becomes (a+i):(b+i) | |
TRange< Size_ > & | operator-= (int i) |
shift range a:b becomes (a+i):(b+i) | |
bool | operator== (TRange< OtherSize_ > const &I) const |
compare this range with range I | |
bool | operator!= (TRange< OtherSize_ > const &I) const |
compare this range with range I | |
![]() | |
Derived & | asDerived () |
static cast : return a reference of this with a cast to the derived class. | |
Derived const & | asDerived () const |
static cast : return a const reference of this with a cast to the derived class. | |
Derived * | asPtrDerived () |
static cast : return a ptr on a Derived of this with a cast to the derived class. | |
Derived const * | asPtrDerived () const |
static cast : return a ptr on a constant Derived of this with a cast to the derived class. | |
Derived * | clone () const |
create a leaf using the copy constructor of the Derived class. | |
Derived * | clone (bool isRef) const |
create a leaf using the copy constructor of the Derived class and a flag determining if the clone is a reference or not. | |
Additional Inherited Members | |
![]() | |
RangeBase () | |
Default constructor. | |
RangeBase (int begin) | |
constructor. | |
RangeBase (RangeBase const &I) | |
Copy constructor. | |
RangeBase (RangeBase< OtherDerived > const &I) | |
Copy constructor. | |
![]() | |
IRecursiveTemplate () | |
constructor. | |
~IRecursiveTemplate () | |
destructor. | |
![]() | |
int | begin_ |
First index. | |
Index sub-vector region with fixed size.
A TRange is an ordered pair [first,end) denoting a sub-vector region, similar to a Fortran 90 or Matlab colon notation. For example:
overwrites the elements (2, 3, 4) of A by the elements (0, 1, 2) of B. There is no stride argument, only contiguous regions are allowed.
Definition at line 160 of file STK_Range.h.
Definition at line 163 of file STK_Range.h.
|
inline |
Default constructor.
Give the size of the sub-region.
size | size of the sub-region (size is not used in fixed size range) |
Definition at line 169 of file STK_Range.h.
|
inline |
Full constructor.
Give the beginning and the size of the sub-region.
first | beginning of the sub-region |
Definition at line 173 of file STK_Range.h.
Complete constructor.
Give the beginning and the last indexes of the sub-region.
first | first index of the sub-region |
Definition at line 177 of file STK_Range.h.
copy constructor
I | Range to copy |
Definition at line 181 of file STK_Range.h.
|
inline |
copy constructor
I | Range to copy |
Definition at line 186 of file STK_Range.h.
|
inline |
|
inline |
create the TRange [begin_-dec, end_-dec]
dec | the decrement to apply |
Definition at line 218 of file STK_Range.h.
References STK::RangeBase< TRange< Size_ > >::begin_, and STK::TRange< Size_ >::dec().
Referenced by STK::TRange< Size_ >::dec(), STK::TRange< UnknownSize >::decEnd(), STK::TRange< Size_ >::decFirst(), STK::TRange< UnknownSize >::decFirst(), and STK::TRange< UnknownSize >::decLast().
|
inline |
create the TRange [begin_, end_-dec)
dec | the decrement to apply |
Definition at line 236 of file STK_Range.h.
|
inline |
create the TRange [begin_-dec, end_]
dec | the decrement to apply |
Definition at line 227 of file STK_Range.h.
References STK::RangeBase< TRange< Size_ > >::begin_, and STK::TRange< Size_ >::dec().
Referenced by STK::IContainer2D< SizeRows_, SizeCols_ >::decBeginCols(), and STK::IContainer2D< SizeRows_, SizeCols_ >::decBeginRows().
|
inline |
create the TRange [begin_, end_-dec)
dec | the decrement to apply |
Definition at line 246 of file STK_Range.h.
Referenced by STK::IContainer2D< SizeRows_, SizeCols_ >::decEndCols(), STK::IContainer2D< SizeRows_, SizeCols_ >::decEndRows(), STK::IContainer2D< SizeRows_, SizeCols_ >::decLastIdxCols(), and STK::IContainer2D< SizeRows_, SizeCols_ >::decLastIdxRows().
|
inline |
check if the range is empty or not.
true
if size <=0, false
otherwise Definition at line 200 of file STK_Range.h.
Referenced by STK::IContainer2D< SizeRows_, SizeCols_ >::empty().
|
inline |
get the ending index of the TRange.
Definition at line 192 of file STK_Range.h.
References STK::RangeBase< TRange< Size_ > >::begin_.
Referenced by STK::IContainer2D< SizeRows_, SizeCols_ >::endCols(), STK::ITContainerBase< Derived >::endCols(), STK::IContainer2D< SizeRows_, SizeCols_ >::endRows(), STK::ITContainerBase< Derived >::endRows(), STK::TRange< UnknownSize >::inf(), STK::TRange< UnknownSize >::lastIdx(), STK::IArray2D< Derived >::merge(), and STK::TRange< UnknownSize >::sup().
|
inline |
create the TRange [begin_+inc, end_+inc_].
inc | the increment to apply |
Definition at line 214 of file STK_Range.h.
References STK::RangeBase< TRange< Size_ > >::begin_, and STK::TRange< Size_ >::inc().
Referenced by STK::TRange< Size_ >::inc(), STK::TRange< UnknownSize >::incEnd(), STK::TRange< Size_ >::incFirst(), STK::TRange< UnknownSize >::incFirst(), STK::TRange< UnknownSize >::incLast(), STK::IContainer2D< SizeRows_, SizeCols_ >::incRangeCols(), STK::IContainer2D< SizeRows_, SizeCols_ >::incRangeRows(), and STK::TRange< UnknownSize >::shift().
|
inline |
create the TRange [begin_, end_+inc)
inc | the increment to apply |
Definition at line 232 of file STK_Range.h.
|
inline |
create the TRange [begin_+inc, end_].
inc | the increment to apply |
Definition at line 223 of file STK_Range.h.
References STK::RangeBase< TRange< Size_ > >::begin_, and STK::TRange< Size_ >::inc().
Referenced by STK::IContainer2D< SizeRows_, SizeCols_ >::incBeginCols(), and STK::IContainer2D< SizeRows_, SizeCols_ >::incBeginRows().
|
inline |
create the TRange [begin_, end_+inc)
inc | the increment to apply |
Definition at line 242 of file STK_Range.h.
Referenced by STK::IContainer2D< SizeRows_, SizeCols_ >::incEndCols(), STK::IContainer2D< SizeRows_, SizeCols_ >::incEndRows(), STK::IContainer2D< SizeRows_, SizeCols_ >::incLastIdxCols(), STK::IContainer2D< SizeRows_, SizeCols_ >::incLastIdxRows(), and STK::IArray2D< Derived >::merge().
|
inline |
get the last index of the TRange.
Definition at line 206 of file STK_Range.h.
References STK::RangeBase< TRange< Size_ > >::begin_.
Referenced by STK::IContainer2D< SizeRows_, SizeCols_ >::lastIdxCols(), STK::IContainer2D< SizeRows_, SizeCols_ >::lastIdxRows(), and STK::IArray2D< Derived >::merge().
|
inline |
Shift the TRange giving the first element.
begin | new value of the first element. |
Definition at line 210 of file STK_Range.h.
References STK::RangeBase< TRange< Size_ > >::begin(), and STK::RangeBase< TRange< Size_ > >::begin_.
Referenced by STK::IContainer2D< SizeRows_, SizeCols_ >::shift(), STK::IContainer2D< SizeRows_, SizeCols_ >::shiftCols(), and STK::IContainer2D< SizeRows_, SizeCols_ >::shiftRows().
|
inline |
get the size of the TRange (the number of elements).
Definition at line 196 of file STK_Range.h.
Referenced by STK::IContainer2D< SizeRows_, SizeCols_ >::sizeCols(), STK::ITContainerBase< Derived >::sizeCols(), STK::IContainer2D< SizeRows_, SizeCols_ >::sizeRows(), and STK::ITContainerBase< Derived >::sizeRows().