STK++ 0.9.13
STK::RangeBase< Derived > Class Template Reference

Base class for TRange class. More...

#include <STK_Range.h>

Inheritance diagram for STK::RangeBase< Derived >:
Inheritance graph

Public Member Functions

 ~RangeBase ()
 destructor.
 
int begin () const
 get the first index of the TRange.
 
template<int OtherSize_>
bool isIn (TRange< OtherSize_ > const &I) const
 check if this TRange in include in an other TRange
 
template<int OtherSize_>
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.
 
Derived & operator+= (int i)
 shift range a:b becomes (a+i):(b+i)
 
Derived & operator-= (int i)
 shift range a:b becomes (a+i):(b+i)
 
template<int OtherSize_>
bool operator== (TRange< OtherSize_ > const &I) const
 compare this range with range I
 
template<int OtherSize_>
bool operator!= (TRange< OtherSize_ > const &I) const
 compare this range with range I
 
- Public Member Functions inherited from STK::IRecursiveTemplate< Derived >
Derived & asDerived ()
 static cast : return a reference of this with a cast to the derived class.
 
Derived constasDerived () 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 constasPtrDerived () 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.
 

Protected Member Functions

 RangeBase ()
 Default constructor.
 
 RangeBase (int begin)
 constructor.
 
 RangeBase (RangeBase const &I)
 Copy constructor.
 
template<class OtherDerived >
 RangeBase (RangeBase< OtherDerived > const &I)
 Copy constructor.
 
- Protected Member Functions inherited from STK::IRecursiveTemplate< Derived >
 IRecursiveTemplate ()
 constructor.
 
 ~IRecursiveTemplate ()
 destructor.
 

Protected Attributes

int begin_
 First index.
 

Detailed Description

template<class Derived>
class STK::RangeBase< Derived >

Base class for TRange class.

Definition at line 68 of file STK_Range.h.

Constructor & Destructor Documentation

◆ RangeBase() [1/4]

template<class Derived >
STK::RangeBase< Derived >::RangeBase ( )
inlineprotected

Default constructor.

Definition at line 72 of file STK_Range.h.

72: begin_(firstIdx_) {}
int begin_
First index.
Definition STK_Range.h:142
const int firstIdx_
base index of the containers created in STK++.
Definition STK_Range.h:48

◆ RangeBase() [2/4]

template<class Derived >
STK::RangeBase< Derived >::RangeBase ( int  begin)
inlineprotected

constructor.

Parameters
beginbeginning of range

Definition at line 76 of file STK_Range.h.

76: begin_(begin) {}
int begin() const
get the first index of the TRange.
Definition STK_Range.h:93

◆ RangeBase() [3/4]

template<class Derived >
STK::RangeBase< Derived >::RangeBase ( RangeBase< Derived > const I)
inlineprotected

Copy constructor.

Parameters
Irange to copy

Definition at line 80 of file STK_Range.h.

80: begin_(I.begin_) {}

◆ RangeBase() [4/4]

template<class Derived >
template<class OtherDerived >
STK::RangeBase< Derived >::RangeBase ( RangeBase< OtherDerived > const I)
inlineprotected

Copy constructor.

Parameters
Irange to copy

Definition at line 85 of file STK_Range.h.

85: begin_(I.begin()) {}

◆ ~RangeBase()

template<class Derived >
STK::RangeBase< Derived >::~RangeBase ( )
inline

destructor.

Definition at line 89 of file STK_Range.h.

89{}

Member Function Documentation

◆ begin()

template<class Derived >
int STK::RangeBase< Derived >::begin ( ) const
inline

get the first index of the TRange.

Returns
the first index of the range

Definition at line 93 of file STK_Range.h.

93{ return begin_;};

References STK::RangeBase< Derived >::begin_.

Referenced by STK::MemSAllocator1D< Type_, NzMax_ >::begin(), STK::IContainer2D< SizeRows_, SizeCols_ >::beginCols(), STK::ITContainerBase< Derived >::beginCols(), STK::IContainer2D< SizeRows_, SizeCols_ >::beginRows(), STK::ITContainerBase< Derived >::beginRows(), STK::CArray< Type_, SizeRows_, SizeCols_, Orient_ >::CArray(), STK::CArray< Type_, SizeRows_, SizeCols_, Orient_ >::CArray(), STK::CArrayPoint< Type_, SizeCols_, Orient_ >::CArrayPoint(), STK::CArrayPoint< Type_, SizeCols_, Orient_ >::CArrayPoint(), STK::CArraySquare< Type_, Size_, Orient_ >::CArraySquare(), STK::CArraySquare< Type_, Size_, Orient_ >::CArraySquare(), STK::CArrayVector< Type_, SizeRows_, Orient_ >::CArrayVector(), STK::CArrayVector< Type_, SizeRows_, Orient_ >::CArrayVector(), STK::hidden::MemHandler< Type_, UnknownSize >::free(), STK::RangeBase< Derived >::isIn(), STK::hidden::MemHandler< Type_, UnknownSize >::malloc(), STK::MemSAllocator1D< Type_, NzMax_ >::memmove(), STK::Arrays::SumOp< Lhs, Rhs >::operator()(), STK::Arrays::DifferenceOp< Lhs, Rhs >::operator()(), STK::Arrays::Product< Lhs, Rhs >::operator()(), STK::Arrays::DivOp< Lhs, Rhs >::operator()(), STK::MemAllocator< Type_, Size_ >::realloc(), STK::hidden::MemHandler< Type_, UnknownSize >::realloc(), and STK::hidden::ProductDispatcher< Lhs, Rhs, Result, lhsStructure_, RhsStructure_ >::run().

◆ isContaining() [1/2]

template<class Derived >
bool STK::RangeBase< Derived >::isContaining ( int  i) const
inline

Return true if i is in this TRange.

Parameters
ithe integer to compare
Returns
true if i is in this, false otherwise

Definition at line 113 of file STK_Range.h.

113{ return ((begin_<=i)&&(i<this->asDerived().end()));}
Derived & asDerived()
static cast : return a reference of this with a cast to the derived class.

References STK::IRecursiveTemplate< Derived >::asDerived(), and STK::RangeBase< Derived >::begin_.

◆ isContaining() [2/2]

template<class Derived >
template<int OtherSize_>
bool STK::RangeBase< Derived >::isContaining ( TRange< OtherSize_ > const I) const
inline

check if the TRange I is include in the this TRange

Parameters
Ithe range to compare
Returns
true if this contain I, false otherwise

Definition at line 107 of file STK_Range.h.

108 { return ((begin_<= I.begin())&&(this->asDerived().end()>=I.end()));}

References STK::RangeBase< Derived >::begin_.

◆ isIn()

template<class Derived >
template<int OtherSize_>
bool STK::RangeBase< Derived >::isIn ( TRange< OtherSize_ > const I) const
inline

check if this TRange in include in an other TRange

Parameters
Ithe index to compare
Returns
true if this is include in I, false otherwise

Definition at line 100 of file STK_Range.h.

101 { return ((this->asDerived().begin() >= I.begin()) && (this->asDerived().end() <= I.end()));}

References STK::IRecursiveTemplate< Derived >::asDerived(), and STK::RangeBase< Derived >::begin().

◆ operator!=()

template<class Derived >
template<int OtherSize_>
bool STK::RangeBase< Derived >::operator!= ( TRange< OtherSize_ > const I) const
inline

compare this range with range I

Parameters
Ithe Index to compare
Returns
true if the range are different, false otherwise

Definition at line 138 of file STK_Range.h.

139 { return ((begin_ != I.begin()) || (this->asDerived().end() != I.end()));}

References STK::RangeBase< Derived >::begin_.

◆ operator+=()

template<class Derived >
Derived & STK::RangeBase< Derived >::operator+= ( int  i)
inline

shift range a:b becomes (a+i):(b+i)

Parameters
ishift to apply
Returns
true if the range are equals, false otherwise

Definition at line 119 of file STK_Range.h.

119{ return this->asDerived().inc(i);}

References STK::IRecursiveTemplate< Derived >::asDerived().

◆ operator-=()

template<class Derived >
Derived & STK::RangeBase< Derived >::operator-= ( int  i)
inline

shift range a:b becomes (a+i):(b+i)

Parameters
ishift to apply
Returns
true if the range are equals, false otherwise

Definition at line 124 of file STK_Range.h.

124{ return this->asDerived().dec(i);}

References STK::IRecursiveTemplate< Derived >::asDerived().

◆ operator==()

template<class Derived >
template<int OtherSize_>
bool STK::RangeBase< Derived >::operator== ( TRange< OtherSize_ > const I) const
inline

compare this range with range I

Parameters
Ithe Index to compare
Returns
true if the range are equals, false otherwise

Definition at line 131 of file STK_Range.h.

132 { return ((begin_ == I.begin()) && (this->asDerived().end() == I.end()));}

References STK::RangeBase< Derived >::begin_.

Member Data Documentation

◆ begin_


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