SALOME - SMESH
SMESH_Array2< TheItemType > Class Template Reference

Purpose: The class Array2 represents bi-dimensional arrays of fixed size known at run time. More...

#include <SMESH_Array2.hxx>

Inheritance diagram for SMESH_Array2< TheItemType >:
Inheritance graph
Collaboration diagram for SMESH_Array2< TheItemType >:
Collaboration graph

Data Structures

class  Iterator
 

Public Member Functions

 SMESH_Array2 (const Standard_Integer theRowLower, const Standard_Integer theRowUpper, const Standard_Integer theColLower, const Standard_Integer theColUpper)
 Constructor. More...
 
 SMESH_Array2 (const SMESH_Array2 &theOther)
 Copy constructor. More...
 
 SMESH_Array2 (const TheItemType &theBegin, const Standard_Integer theRowLower, const Standard_Integer theRowUpper, const Standard_Integer theColLower, const Standard_Integer theColUpper)
 C array-based constructor. More...
 
void Init (const TheItemType &theValue)
 Initialise the values. More...
 
virtual Standard_Integer Size (void) const
 Size (number of items) More...
 
Standard_Integer Length (void) const
 Length (number of items) More...
 
Standard_Integer RowLength (void) const
 RowLength. More...
 
Standard_Integer ColLength (void) const
 ColLength. More...
 
Standard_Integer LowerRow (void) const
 LowerRow. More...
 
Standard_Integer UpperRow (void) const
 UpperRow. More...
 
Standard_Integer LowerCol (void) const
 LowerCol. More...
 
Standard_Integer UpperCol (void) const
 UpperCol. More...
 
Standard_Boolean IsDeletable (void) const
 myDeletable flag More...
 
virtual void Assign (const NCollection_Array2< TheItemType > &theOther)
 Assign. More...
 
SMESH_Array2operator= (const SMESH_Array2 &theOther)
 operator= (array to array) More...
 
const TheItemType & Value (const Standard_Integer theRow, const Standard_Integer theCol) const
 Constant value access. More...
 
const TheItemType & operator() (const Standard_Integer theRow, const Standard_Integer theCol) const
 operator() - alias to ChangeValue More...
 
TheItemType & ChangeValue (const Standard_Integer theRow, const Standard_Integer theCol)
 Variable value access. More...
 
TheItemType & operator() (const Standard_Integer theRow, const Standard_Integer theCol)
 operator() - alias to ChangeValue More...
 
void SetValue (const Standard_Integer theRow, const Standard_Integer theCol, const TheItemType &theItem)
 SetValue. More...
 
 ~SMESH_Array2 (void)
 Destructor - releases the memory. More...
 

Protected Attributes

Standard_Integer myLowerRow
 
Standard_Integer myUpperRow
 
Standard_Integer myLowerCol
 
Standard_Integer myUpperCol
 
TheItemType ** myData
 Pointer to the row pointers table. More...
 
TheItemType * myStart
 Pointer to the memory array. More...
 
Standard_Boolean myDeletable
 Flag showing who allocated the array. More...
 

Private Member Functions

void Allocate (void)
 Allocate memory for the array, set up indirection table. More...
 
virtual TYPENAME NCollection_Array2< TheItemType >::IteratorCreateIterator (void) const
 Creates Iterator for use on BaseCollection. More...
 

Friends

class Iterator
 

Detailed Description

template<class TheItemType>
class SMESH_Array2< TheItemType >

Purpose: The class Array2 represents bi-dimensional arrays of fixed size known at run time.

The ranges of indices are user defined.

Warning: Programs clients of such class must be independant of the range of the first element. Then, a C++ for loop must be written like this

for (i = A.LowerRow(); i <= A.UpperRow(); i++) for (j = A.LowerCol(); j <= A.UpperCol(); j++)

Definition at line 36 of file SMESH_Array2.hxx.

Constructor & Destructor Documentation

◆ SMESH_Array2() [1/3]

template<class TheItemType >
SMESH_Array2< TheItemType >::SMESH_Array2 ( const Standard_Integer  theRowLower,
const Standard_Integer  theRowUpper,
const Standard_Integer  theColLower,
const Standard_Integer  theColUpper 
)

Constructor.

Definition at line 87 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::Allocate().

Here is the call graph for this function:

◆ SMESH_Array2() [2/3]

template<class TheItemType >
SMESH_Array2< TheItemType >::SMESH_Array2 ( const SMESH_Array2< TheItemType > &  theOther)

Copy constructor.

Definition at line 100 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::Allocate().

Here is the call graph for this function:

◆ SMESH_Array2() [3/3]

template<class TheItemType >
SMESH_Array2< TheItemType >::SMESH_Array2 ( const TheItemType &  theBegin,
const Standard_Integer  theRowLower,
const Standard_Integer  theRowUpper,
const Standard_Integer  theColLower,
const Standard_Integer  theColUpper 
)

C array-based constructor.

Definition at line 113 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::Allocate(), and SMESH_Array2< TheItemType >::myStart.

Here is the call graph for this function:

◆ ~SMESH_Array2()

template<class TheItemType >
SMESH_Array2< TheItemType >::~SMESH_Array2 ( void  )

Member Function Documentation

◆ Init()

template<class TheItemType >
void SMESH_Array2< TheItemType >::Init ( const TheItemType &  theValue)

Initialise the values.

Definition at line 130 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::myStart, and SMESH_Array2< TheItemType >::Size().

Here is the call graph for this function:

◆ Size()

template<class TheItemType >
virtual Standard_Integer SMESH_Array2< TheItemType >::Size ( void  ) const
virtual

Size (number of items)

Definition at line 138 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::Length().

Referenced by SMESH_Array2< TheItemType >::Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Length()

template<class TheItemType >
Standard_Integer SMESH_Array2< TheItemType >::Length ( void  ) const

Length (number of items)

Definition at line 141 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::ColLength(), and SMESH_Array2< TheItemType >::RowLength().

Referenced by SMESH_Array2< TheItemType >::Assign(), SMESH_Array2< TheItemType >::Iterator::Init(), SMESH_Array2< TheItemType >::operator=(), and SMESH_Array2< TheItemType >::Size().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RowLength()

template<class TheItemType >
Standard_Integer SMESH_Array2< TheItemType >::RowLength ( void  ) const

RowLength.

Definition at line 145 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::myLowerCol, and SMESH_Array2< TheItemType >::myUpperCol.

Referenced by SMESH_Array2< TheItemType >::Length().

Here is the caller graph for this function:

◆ ColLength()

template<class TheItemType >
Standard_Integer SMESH_Array2< TheItemType >::ColLength ( void  ) const

ColLength.

Definition at line 148 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::myLowerRow, and SMESH_Array2< TheItemType >::myUpperRow.

Referenced by SMESH_Array2< TheItemType >::Length().

Here is the caller graph for this function:

◆ LowerRow()

template<class TheItemType >
Standard_Integer SMESH_Array2< TheItemType >::LowerRow ( void  ) const

LowerRow.

Definition at line 152 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::myLowerRow.

◆ UpperRow()

template<class TheItemType >
Standard_Integer SMESH_Array2< TheItemType >::UpperRow ( void  ) const

UpperRow.

Definition at line 155 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::myUpperRow.

◆ LowerCol()

template<class TheItemType >
Standard_Integer SMESH_Array2< TheItemType >::LowerCol ( void  ) const

LowerCol.

Definition at line 158 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::myLowerCol.

◆ UpperCol()

template<class TheItemType >
Standard_Integer SMESH_Array2< TheItemType >::UpperCol ( void  ) const

UpperCol.

Definition at line 161 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::myUpperCol.

◆ IsDeletable()

template<class TheItemType >
Standard_Boolean SMESH_Array2< TheItemType >::IsDeletable ( void  ) const

myDeletable flag

Definition at line 165 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::myDeletable.

◆ Assign()

template<class TheItemType >
virtual void SMESH_Array2< TheItemType >::Assign ( const NCollection_Array2< TheItemType > &  theOther)
virtual

Assign.

Definition at line 171 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::Length(), and SMESH_Array2< TheItemType >::myStart.

Here is the call graph for this function:

◆ operator=()

template<class TheItemType >
SMESH_Array2& SMESH_Array2< TheItemType >::operator= ( const SMESH_Array2< TheItemType > &  theOther)

operator= (array to array)

Definition at line 189 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::Length(), and SMESH_Array2< TheItemType >::myStart.

Here is the call graph for this function:

◆ Value()

template<class TheItemType >
const TheItemType& SMESH_Array2< TheItemType >::Value ( const Standard_Integer  theRow,
const Standard_Integer  theCol 
) const

◆ operator()() [1/2]

template<class TheItemType >
const TheItemType& SMESH_Array2< TheItemType >::operator() ( const Standard_Integer  theRow,
const Standard_Integer  theCol 
) const

operator() - alias to ChangeValue

Definition at line 218 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::Iterator::Value().

Here is the call graph for this function:

◆ ChangeValue()

template<class TheItemType >
TheItemType& SMESH_Array2< TheItemType >::ChangeValue ( const Standard_Integer  theRow,
const Standard_Integer  theCol 
)

◆ operator()() [2/2]

template<class TheItemType >
TheItemType& SMESH_Array2< TheItemType >::operator() ( const Standard_Integer  theRow,
const Standard_Integer  theCol 
)

operator() - alias to ChangeValue

Definition at line 235 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::Iterator::ChangeValue().

Here is the call graph for this function:

◆ SetValue()

template<class TheItemType >
void SMESH_Array2< TheItemType >::SetValue ( const Standard_Integer  theRow,
const Standard_Integer  theCol,
const TheItemType &  theItem 
)

◆ Allocate()

template<class TheItemType >
void SMESH_Array2< TheItemType >::Allocate ( void  )
private

◆ CreateIterator()

template<class TheItemType >
virtual TYPENAME NCollection_Array2<TheItemType>::Iterator& SMESH_Array2< TheItemType >::CreateIterator ( void  ) const
privatevirtual

Creates Iterator for use on BaseCollection.

Definition at line 300 of file SMESH_Array2.hxx.

References SMESH_Array2< TheItemType >::Iterator::Iterator().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ Iterator

template<class TheItemType >
friend class Iterator
friend

Definition at line 315 of file SMESH_Array2.hxx.

Field Documentation

◆ myLowerRow

template<class TheItemType >
Standard_Integer SMESH_Array2< TheItemType >::myLowerRow
protected

◆ myUpperRow

◆ myLowerCol

template<class TheItemType >
Standard_Integer SMESH_Array2< TheItemType >::myLowerCol
protected

◆ myUpperCol

◆ myData

template<class TheItemType >
TheItemType** SMESH_Array2< TheItemType >::myData
protected

◆ myStart

◆ myDeletable

template<class TheItemType >
Standard_Boolean SMESH_Array2< TheItemType >::myDeletable
protected