STK++ 0.9.13
STK::IContainer2D< SizeRows_, SizeCols_ > Class Template Reference

Interface base class for 2D containers. More...

#include <STK_IContainer2D.h>

Inheritance diagram for STK::IContainer2D< SizeRows_, SizeCols_ >:
Inheritance graph

Public Types

typedef TRange< SizeRows_RowRange
 Type of the Range for the rows.
 
typedef TRange< SizeCols_ColRange
 Type of the Range for the columns.
 

Public Member Functions

 IContainer2D ()
 Default constructor.
 
 IContainer2D (RowRange const &I, ColRange const &J)
 Constructor with specified ranges.
 
 IContainer2D (IContainer2D const &T)
 Copy constructor.
 
 ~IContainer2D ()
 destructor.
 
ColRange constcols () const
 
int beginCols () const
 
int endCols () const
 
int sizeCols () const
 
RowRange constrows () const
 
int beginRows () const
 
int endRows () const
 
int sizeRows () const
 
int lastIdxCols () const
 
int lastIdxRows () const
 
bool empty () const
 

Protected Member Functions

void shift (int rbeg, int cbeg)
 Set the first index of the rows and columns.
 
void setRanges (RowRange const &I=RowRange(), ColRange const &J=ColRange())
 Set the ranges of the container.
 
void setRows (RowRange const &I=RowRange())
 Set the range of the number of rows.
 
void shiftRows (int beg)
 Set the first index of the rows.
 
void incRangeRows (int inc)
 Increment the range of the number of rows.
 
void incBeginRows (int inc)
 Increment the first index of the number of rows.
 
void decBeginRows (int dec)
 Decrement the first index of the number of rows.
 
void incEndRows (int inc)
 Increment the end of the number of rows.
 
void decEndRows (int dec)
 Decrement the end of the number of rows.
 
void setCols (ColRange const &J=ColRange())
 Set the columns range.
 
void shiftCols (int beg)
 Shift the columns first index to beg.
 
void incRangeCols (int inc)
 Increment the columns range.
 
void incBeginCols (int inc)
 increment the first index of the columns.
 
void decBeginCols (int dec)
 Decrement the columns first index.
 
void incEndCols (int inc)
 Increment the last index of the columns.
 
void decEndCols (int dec)
 Decrement the last index of the columns.
 
void exchange (IContainer2D &T)
 exchange this container with T
 
void incLastIdxRows (int inc)
 Increment the end of the number of rows.
 
void decLastIdxRows (int dec)
 Decrement the end of the number of rows.
 
void incLastIdxCols (int inc)
 Increment the last index of the columns.
 
void decLastIdxCols (int dec)
 Decrement the last index of the columns.
 

Private Attributes

RowRange rows_
 Vertical range : Range of the indexes for the rows.
 
ColRange cols_
 Horizontal range : Range of the indexes for the columns.
 

Detailed Description

template<int SizeRows_, int SizeCols_>
class STK::IContainer2D< SizeRows_, SizeCols_ >

Interface base class for 2D containers.

The IContainer2D class is the base class for all two-dimensional containers storing data and which cannot be part of an expression. A two-dimensional container is defined by an horizontal range of index for the columns and a vertical range of index for the rows.

This Interface base class stores the ranges and allows to derived classes to manipulate these ranges.

Definition at line 53 of file STK_IContainer2D.h.

Member Typedef Documentation

◆ ColRange

template<int SizeRows_, int SizeCols_>
typedef TRange<SizeCols_> STK::IContainer2D< SizeRows_, SizeCols_ >::ColRange

Type of the Range for the columns.

Definition at line 59 of file STK_IContainer2D.h.

◆ RowRange

template<int SizeRows_, int SizeCols_>
typedef TRange<SizeRows_> STK::IContainer2D< SizeRows_, SizeCols_ >::RowRange

Type of the Range for the rows.

Definition at line 57 of file STK_IContainer2D.h.

Constructor & Destructor Documentation

◆ IContainer2D() [1/3]

template<int SizeRows_, int SizeCols_>
STK::IContainer2D< SizeRows_, SizeCols_ >::IContainer2D ( )
inline

Default constructor.

cols_ = 1:0 and rows_ = 1:0.

Definition at line 62 of file STK_IContainer2D.h.

62: rows_(), cols_() {}
RowRange rows_
Vertical range : Range of the indexes for the rows.
ColRange cols_
Horizontal range : Range of the indexes for the columns.

◆ IContainer2D() [2/3]

template<int SizeRows_, int SizeCols_>
STK::IContainer2D< SizeRows_, SizeCols_ >::IContainer2D ( RowRange const I,
ColRange const J 
)
inline

Constructor with specified ranges.

Parameters
I,Jvertical and horizontal range

Definition at line 66 of file STK_IContainer2D.h.

66: rows_(I), cols_(J) {}

◆ IContainer2D() [3/3]

template<int SizeRows_, int SizeCols_>
STK::IContainer2D< SizeRows_, SizeCols_ >::IContainer2D ( IContainer2D< SizeRows_, SizeCols_ > const T)
inline

Copy constructor.

Parameters
Tthe container to copy

Definition at line 70 of file STK_IContainer2D.h.

70: rows_(T.rows_), cols_(T.cols_) {}

◆ ~IContainer2D()

template<int SizeRows_, int SizeCols_>
STK::IContainer2D< SizeRows_, SizeCols_ >::~IContainer2D ( )
inline

destructor.

Definition at line 72 of file STK_IContainer2D.h.

72{}

Member Function Documentation

◆ beginCols()

template<int SizeRows_, int SizeCols_>
int STK::IContainer2D< SizeRows_, SizeCols_ >::beginCols ( ) const
inline
Returns
the index of the first column

Definition at line 77 of file STK_IContainer2D.h.

77{ return cols_.begin();}
int begin() const
get the first index of the TRange.
Definition STK_Range.h:93

References STK::RangeBase< Derived >::begin(), and STK::IContainer2D< SizeRows_, SizeCols_ >::cols_.

Referenced by STK::IArray2D< Derived >::beginCols().

◆ beginRows()

template<int SizeRows_, int SizeCols_>
int STK::IContainer2D< SizeRows_, SizeCols_ >::beginRows ( ) const
inline
Returns
the index of the first row

Definition at line 86 of file STK_IContainer2D.h.

86{ return rows_.begin();}

References STK::RangeBase< Derived >::begin(), and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

Referenced by STK::IArray2D< Derived >::beginRows().

◆ cols()

template<int SizeRows_, int SizeCols_>
ColRange const & STK::IContainer2D< SizeRows_, SizeCols_ >::cols ( ) const
inline
Returns
the columns range

Definition at line 75 of file STK_IContainer2D.h.

75{ return cols_;}

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_.

Referenced by STK::IArray2D< Derived >::cols(), and STK::IArray2D< Derived >::colsImpl().

◆ decBeginCols()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::decBeginCols ( int  dec)
inlineprotected

Decrement the columns first index.

Parameters
decthe decrement to apply

Definition at line 159 of file STK_IContainer2D.h.

159{ cols_.decFirst(dec);}
TRange & decFirst(int dec=1)
create the TRange [begin_-dec, end_]
Definition STK_Range.h:227

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::decFirst().

◆ decBeginRows()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::decBeginRows ( int  dec)
inlineprotected

Decrement the first index of the number of rows.

Parameters
decthe decrement to apply

Definition at line 130 of file STK_IContainer2D.h.

130{ rows_.decFirst(dec);}

References STK::TRange< Size_ >::decFirst(), and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

◆ decEndCols()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::decEndCols ( int  dec)
inlineprotected

Decrement the last index of the columns.

Parameters
decthe decrement to apply

Definition at line 167 of file STK_IContainer2D.h.

167{ cols_.decLast(dec);}
TRange & decLast(int dec=1)
create the TRange [begin_, end_-dec)
Definition STK_Range.h:246

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::decLast().

◆ decEndRows()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::decEndRows ( int  dec)
inlineprotected

◆ decLastIdxCols()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::decLastIdxCols ( int  dec)
inlineprotected

Decrement the last index of the columns.

Parameters
decthe decrement to apply

Definition at line 192 of file STK_IContainer2D.h.

192{ cols_.decLast(dec);}

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::decLast().

◆ decLastIdxRows()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::decLastIdxRows ( int  dec)
inlineprotected

Decrement the end of the number of rows.

Parameters
decthe decrement to apply

Definition at line 184 of file STK_IContainer2D.h.

184{ rows_.decLast(dec);}

References STK::TRange< Size_ >::decLast(), and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

◆ empty()

template<int SizeRows_, int SizeCols_>
bool STK::IContainer2D< SizeRows_, SizeCols_ >::empty ( ) const
inline
Returns
true if the container is empty, false otherwise

Definition at line 98 of file STK_IContainer2D.h.

98{ return (cols_.empty() || rows_.empty());}
bool empty() const
check if the range is empty or not.
Definition STK_Range.h:200

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, STK::TRange< Size_ >::empty(), and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

Referenced by STK::IArray2D< Derived >::empty().

◆ endCols()

template<int SizeRows_, int SizeCols_>
int STK::IContainer2D< SizeRows_, SizeCols_ >::endCols ( ) const
inline
Returns
the ending index of the columns

Definition at line 79 of file STK_IContainer2D.h.

79{ return cols_.end();}
int end() const
get the ending index of the TRange.
Definition STK_Range.h:192

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::end().

Referenced by STK::IArray2D< Derived >::endCols().

◆ endRows()

template<int SizeRows_, int SizeCols_>
int STK::IContainer2D< SizeRows_, SizeCols_ >::endRows ( ) const
inline
Returns
the ending index of rows

Definition at line 88 of file STK_IContainer2D.h.

88{ return rows_.end();}

References STK::TRange< Size_ >::end(), and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

Referenced by STK::IArray2D< Derived >::endRows().

◆ exchange()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::exchange ( IContainer2D< SizeRows_, SizeCols_ > &  T)
inlineprotected

exchange this container with T

Parameters
Tthe container to exchange with this

Definition at line 172 of file STK_IContainer2D.h.

173 {
174 std::swap(T.rows_, this->rows_ );
175 std::swap(T.cols_, this->cols_ );
176 }

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

◆ incBeginCols()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::incBeginCols ( int  inc)
inlineprotected

increment the first index of the columns.

Parameters
incthe increment to apply

Definition at line 155 of file STK_IContainer2D.h.

155{ cols_.incFirst(inc);}
TRange & incFirst(int inc=1)
create the TRange [begin_+inc, end_].
Definition STK_Range.h:223

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::incFirst().

◆ incBeginRows()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::incBeginRows ( int  inc)
inlineprotected

Increment the first index of the number of rows.

Parameters
incthe increment to apply

Definition at line 126 of file STK_IContainer2D.h.

126{ rows_.incFirst(inc);}

References STK::TRange< Size_ >::incFirst(), and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

◆ incEndCols()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::incEndCols ( int  inc)
inlineprotected

Increment the last index of the columns.

Parameters
incthe increment to apply

Definition at line 163 of file STK_IContainer2D.h.

163{ cols_.incLast(inc);}
TRange & incLast(int inc=1)
create the TRange [begin_, end_+inc)
Definition STK_Range.h:242

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::incLast().

◆ incEndRows()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::incEndRows ( int  inc)
inlineprotected

◆ incLastIdxCols()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::incLastIdxCols ( int  inc)
inlineprotected

Increment the last index of the columns.

Parameters
incthe increment to apply

Definition at line 188 of file STK_IContainer2D.h.

188{ cols_.incLast(inc);}

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::incLast().

◆ incLastIdxRows()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::incLastIdxRows ( int  inc)
inlineprotected

Increment the end of the number of rows.

Parameters
incthe increment to apply

Definition at line 180 of file STK_IContainer2D.h.

180{ rows_.incLast(inc);}

References STK::TRange< Size_ >::incLast(), and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

◆ incRangeCols()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::incRangeCols ( int  inc)
inlineprotected

Increment the columns range.

Parameters
incthe increment to apply the range

Definition at line 151 of file STK_IContainer2D.h.

151{ cols_.inc(inc);}
TRange & inc(int inc=1)
create the TRange [begin_+inc, end_+inc_].
Definition STK_Range.h:214

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::inc().

◆ incRangeRows()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::incRangeRows ( int  inc)
inlineprotected

Increment the range of the number of rows.

Parameters
incthe increment to apply

Definition at line 122 of file STK_IContainer2D.h.

122{ rows_.inc(inc);}

References STK::TRange< Size_ >::inc(), and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

◆ lastIdxCols()

template<int SizeRows_, int SizeCols_>
int STK::IContainer2D< SizeRows_, SizeCols_ >::lastIdxCols ( ) const
inline
Returns
the index of the last column

Definition at line 93 of file STK_IContainer2D.h.

93{ return cols_.lastIdx();}
int lastIdx() const
get the last index of the TRange.
Definition STK_Range.h:206

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::lastIdx().

Referenced by STK::IArray2D< Derived >::lastIdxCols().

◆ lastIdxRows()

template<int SizeRows_, int SizeCols_>
int STK::IContainer2D< SizeRows_, SizeCols_ >::lastIdxRows ( ) const
inline
Returns
the index of the last row

Definition at line 95 of file STK_IContainer2D.h.

95{ return rows_.lastIdx();}

References STK::TRange< Size_ >::lastIdx(), and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

Referenced by STK::IArray2D< Derived >::lastIdxRows().

◆ rows()

template<int SizeRows_, int SizeCols_>
RowRange const & STK::IContainer2D< SizeRows_, SizeCols_ >::rows ( ) const
inline
Returns
the range of the rows

Definition at line 84 of file STK_IContainer2D.h.

84{ return rows_;}

References STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

Referenced by STK::IArray2D< Derived >::rows(), and STK::IArray2D< Derived >::rowsImpl().

◆ setCols()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::setCols ( ColRange const J = ColRange())
inlineprotected

Set the columns range.

Parameters
Jthe columns range

Definition at line 143 of file STK_IContainer2D.h.

143{ cols_ = J;}

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_.

◆ setRanges()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::setRanges ( RowRange const I = RowRange(),
ColRange const J = ColRange() 
)
inlineprotected

Set the ranges of the container.

Parameters
I,Jthe vertical and horizontal range

Definition at line 108 of file STK_IContainer2D.h.

109 { rows_ = I; cols_ =J;}

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

◆ setRows()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::setRows ( RowRange const I = RowRange())
inlineprotected

Set the range of the number of rows.

Parameters
Ithe range of the rows number

Definition at line 114 of file STK_IContainer2D.h.

114{ rows_ = I;}

References STK::IContainer2D< SizeRows_, SizeCols_ >::rows_.

◆ shift()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::shift ( int  rbeg,
int  cbeg 
)
inlineprotected

Set the first index of the rows and columns.

Parameters
rbeg,cbegthe first index of the rows and columns

Definition at line 104 of file STK_IContainer2D.h.

104{ rows_.shift(rbeg); cols_.shift(cbeg);}
TRange & shift(int begin)
Shift the TRange giving the first element.
Definition STK_Range.h:210

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, STK::IContainer2D< SizeRows_, SizeCols_ >::rows_, and STK::TRange< Size_ >::shift().

◆ shiftCols()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::shiftCols ( int  beg)
inlineprotected

Shift the columns first index to beg.

Parameters
begthe new first index

Definition at line 147 of file STK_IContainer2D.h.

147{ cols_.shift(beg);}

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::shift().

◆ shiftRows()

template<int SizeRows_, int SizeCols_>
void STK::IContainer2D< SizeRows_, SizeCols_ >::shiftRows ( int  beg)
inlineprotected

Set the first index of the rows.

Parameters
begthe first index of the rows

Definition at line 118 of file STK_IContainer2D.h.

118{ rows_.shift(beg);}

References STK::IContainer2D< SizeRows_, SizeCols_ >::rows_, and STK::TRange< Size_ >::shift().

◆ sizeCols()

template<int SizeRows_, int SizeCols_>
int STK::IContainer2D< SizeRows_, SizeCols_ >::sizeCols ( ) const
inline
Returns
the number of column

Definition at line 81 of file STK_IContainer2D.h.

81{ return cols_.size();}
int size() const
get the size of the TRange (the number of elements).
Definition STK_Range.h:196

References STK::IContainer2D< SizeRows_, SizeCols_ >::cols_, and STK::TRange< Size_ >::size().

Referenced by STK::IArray2D< Derived >::sizeCols().

◆ sizeRows()

template<int SizeRows_, int SizeCols_>
int STK::IContainer2D< SizeRows_, SizeCols_ >::sizeRows ( ) const
inline
Returns
the number of rows

Definition at line 90 of file STK_IContainer2D.h.

90{ return rows_.size();}

References STK::IContainer2D< SizeRows_, SizeCols_ >::rows_, and STK::TRange< Size_ >::size().

Referenced by STK::IArray2D< Derived >::sizeRows().

Member Data Documentation

◆ cols_

◆ rows_


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