STK++ 0.9.13
|
Interface base class for homogeneous 2D containers like allocators. More...
#include <STK_ITContainer2D.h>
Public Types | |
enum | { structure_ = hidden::Traits<Derived>::structure_ , orient_ = hidden::Traits<Derived>::orient_ , sizeRows_ = hidden::Traits<Derived>::sizeRows_ , sizeCols_ = hidden::Traits<Derived>::sizeCols_ , storage_ = hidden::Traits<Derived>::storage_ } |
typedef hidden::Traits< Derived >::Type | Type |
typedef hidden::Traits< Derived >::TypeConst | TypeConst |
typedef hidden::Traits< Derived >::Row | Row |
typedef hidden::Traits< Derived >::Col | Col |
typedef TRange< sizeRows_ > | RowRange |
Type of the Range for the rows. | |
typedef TRange< sizeCols_ > | ColRange |
Type of the Range for the columns. | |
typedef IContainer2D< sizeRows_, sizeCols_ > | Base2D |
Type of the Base container. | |
typedef IRecursiveTemplate< Derived > | Base |
Type of the Base container. | |
![]() | |
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 | |
Type & | elt (int i, int j) |
TypeConst | elt (int i, int j) const |
Type & | elt (int i) |
TypeConst | elt (int i) const |
Type & | elt () |
TypeConst | elt () const |
Derived & | resize (int sizeRows, int sizeCols) |
resize the container | |
Derived & | resize (int size) |
Resize 1D container. | |
void | shift (int firstRow, int firstCol) |
shift the first indexes of the container | |
void | shift (int beg) |
shift the first indexes of the 1D container | |
![]() | |
IContainer2D () | |
Default constructor. | |
IContainer2D (RowRange const &I, ColRange const &J) | |
Constructor with specified ranges. | |
IContainer2D (IContainer2D const &T) | |
Copy constructor. | |
~IContainer2D () | |
destructor. | |
ColRange const & | cols () const |
int | beginCols () const |
int | endCols () const |
int | sizeCols () const |
RowRange const & | rows () const |
int | beginRows () const |
int | endRows () const |
int | sizeRows () const |
int | lastIdxCols () const |
int | lastIdxRows () const |
bool | empty () const |
![]() | |
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. | |
Protected Member Functions | |
ITContainer2D () | |
Default constructor. | |
ITContainer2D (RowRange const &I, ColRange const &J) | |
constructor with specified Range. | |
ITContainer2D (ITContainer2D const &T) | |
Copy constructor. | |
~ITContainer2D () | |
destructor. | |
![]() | |
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. | |
![]() | |
IRecursiveTemplate () | |
constructor. | |
~IRecursiveTemplate () | |
destructor. | |
Interface base class for homogeneous 2D containers like allocators.
The ITContainer2D class is the template base class for all homogeneous two-dimensional containers containing element of type Type
where Type is note necessarily a scalar. Some methods assume that derived class is not part of an expression and is not constant, so that it can be #- shifted, #- resized #- accessed in modification.
Implement the curious recursive template paradigm : the template parameter Derived
is the name of the class that implements ITContainer2D
. For example template<class Type> class Derived: public ITContainer2D< Derived<Type> > {...}
Functions used in this interface and to implement in derived class if necessary have the following definitions:
elt1Impl(pos)
have to return a reference as we are using derived classes for storing any kind of data. Definition at line 84 of file STK_ITContainer2D.h.
typedef IRecursiveTemplate<Derived> STK::ITContainer2D< Derived >::Base |
Type of the Base container.
Definition at line 113 of file STK_ITContainer2D.h.
typedef IContainer2D<sizeRows_, sizeCols_ > STK::ITContainer2D< Derived >::Base2D |
Type of the Base container.
Definition at line 111 of file STK_ITContainer2D.h.
typedef hidden::Traits<Derived>::Col STK::ITContainer2D< Derived >::Col |
Definition at line 94 of file STK_ITContainer2D.h.
typedef TRange<sizeCols_> STK::ITContainer2D< Derived >::ColRange |
Type of the Range for the columns.
Definition at line 108 of file STK_ITContainer2D.h.
typedef hidden::Traits<Derived>::Row STK::ITContainer2D< Derived >::Row |
Definition at line 93 of file STK_ITContainer2D.h.
typedef TRange<sizeRows_> STK::ITContainer2D< Derived >::RowRange |
Type of the Range for the rows.
Definition at line 106 of file STK_ITContainer2D.h.
typedef hidden::Traits<Derived>::Type STK::ITContainer2D< Derived >::Type |
Definition at line 90 of file STK_ITContainer2D.h.
typedef hidden::Traits<Derived>::TypeConst STK::ITContainer2D< Derived >::TypeConst |
Definition at line 91 of file STK_ITContainer2D.h.
Enumerator | |
---|---|
structure_ | |
orient_ | |
sizeRows_ | |
sizeCols_ | |
storage_ |
Definition at line 96 of file STK_ITContainer2D.h.
|
inlineprotected |
Default constructor.
Definition at line 117 of file STK_ITContainer2D.h.
|
inlineprotected |
constructor with specified Range.
I,J | range of the rows and columns |
Definition at line 121 of file STK_ITContainer2D.h.
|
inlineprotected |
Copy constructor.
T | the container to copy |
Definition at line 125 of file STK_ITContainer2D.h.
|
inlineprotected |
|
inline |
Definition at line 167 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived().
Referenced by STK::ITContainer2D< Derived >::elt(), and STK::ITContainer2D< Derived >::elt().
|
inline |
Definition at line 169 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived().
|
inline |
i | index of the element to get |
Definition at line 159 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived().
|
inline |
i | index of the element to get |
Definition at line 165 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived().
|
inline |
i,j | indexes of the element to get |
Definition at line 133 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived(), STK::IContainer2D< hidden::Traits< Derived >::sizeRows_, hidden::Traits< Derived >::sizeCols_ >::beginCols(), STK::IContainer2D< hidden::Traits< Derived >::sizeRows_, hidden::Traits< Derived >::sizeCols_ >::beginRows(), STK::ITContainer2D< Derived >::elt(), STK::IContainer2D< hidden::Traits< Derived >::sizeRows_, hidden::Traits< Derived >::sizeCols_ >::endCols(), STK::IContainer2D< hidden::Traits< Derived >::sizeRows_, hidden::Traits< Derived >::sizeCols_ >::endRows(), and STKOUT_OF_RANGE_2ARG.
|
inline |
i,j | indexes of the element to get |
Definition at line 146 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived(), STK::IContainer2D< hidden::Traits< Derived >::sizeRows_, hidden::Traits< Derived >::sizeCols_ >::beginCols(), STK::IContainer2D< hidden::Traits< Derived >::sizeRows_, hidden::Traits< Derived >::sizeCols_ >::beginRows(), STK::ITContainer2D< Derived >::elt(), STK::IContainer2D< hidden::Traits< Derived >::sizeRows_, hidden::Traits< Derived >::sizeCols_ >::endCols(), STK::IContainer2D< hidden::Traits< Derived >::sizeRows_, hidden::Traits< Derived >::sizeCols_ >::endRows(), and STKOUT_OF_RANGE_2ARG.
|
inline |
Resize 1D container.
size | the size to set to the vector |
Definition at line 179 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived().
|
inline |
resize the container
sizeRows,sizeCols | size of the rows and columns |
Definition at line 174 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived(), and STK::IContainer2D< hidden::Traits< Derived >::sizeRows_, hidden::Traits< Derived >::sizeCols_ >::sizeCols().
|
inline |
shift the first indexes of the 1D container
beg | the index of the first row or column |
Definition at line 188 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived().
|
inline |
shift the first indexes of the container
firstRow,firstCol | indexes of the first row and first column |
Definition at line 184 of file STK_ITContainer2D.h.
References STK::IRecursiveTemplate< Derived >::asDerived().