Open CASCADE Technology  7.5.0
Data Structures | Public Types | Public Member Functions | Protected Attributes
NCollection_Array2< TheItemType > Class Template Reference

#include <NCollection_Array2.hxx>

Data Structures

class  Iterator
 

Public Types

typedef TheItemType value_type
 STL-compliant typedef for value type. More...
 

Public Member Functions

 NCollection_Array2 ()
 Empty constructor; should be used with caution. More...
 
 NCollection_Array2 (const Standard_Integer theRowLower, const Standard_Integer theRowUpper, const Standard_Integer theColLower, const Standard_Integer theColUpper)
 Constructor. More...
 
 NCollection_Array2 (const NCollection_Array2 &theOther)
 Copy constructor. More...
 
 NCollection_Array2 (NCollection_Array2 &&theOther)
 Move constructor. More...
 
 NCollection_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...
 
Standard_Integer Size (void) const
 Size (number of items) More...
 
Standard_Integer Length (void) const
 Length (number of items) More...
 
Standard_Integer NbRows () const
 Returns number of rows. More...
 
Standard_Integer NbColumns () const
 Returns number of columns. More...
 
Standard_Integer RowLength () const
 Returns length of the row, i.e. number of columns. More...
 
Standard_Integer ColLength () const
 Returns length of the column, i.e. number of rows. 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...
 
NCollection_Array2Assign (const NCollection_Array2 &theOther)
 Assignment. More...
 
NCollection_Array2Move (NCollection_Array2 &theOther)
 Move assignment. This array will borrow all the data from theOther. The moved object will be left unitialized and should not be used anymore. More...
 
NCollection_Array2operator= (const NCollection_Array2 &theOther)
 Assignment operator. More...
 
NCollection_Array2operator= (NCollection_Array2 &&theOther)
 Move assignment operator;. 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...
 
void Resize (Standard_Integer theRowLower, Standard_Integer theRowUpper, Standard_Integer theColLower, Standard_Integer theColUpper, Standard_Boolean theToCopyData)
 Resizes the array to specified bounds. No re-allocation will be done if length of array does not change, but existing values will not be discarded if theToCopyData set to FALSE. More...
 
 ~NCollection_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...
 

Detailed Description

template<class TheItemType>
class NCollection_Array2< TheItemType >

Purpose: The class Array2 represents bi-dimensional arrays of fixed size known at run time. The ranges of indices are user defined.

Class allocates one 1D array storing full data (all Rows and Columns) and extra 1D array storing pointers to each Row.

Warning: Programs clients of such class must be independent 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++)

Member Typedef Documentation

◆ value_type

template<class TheItemType>
typedef TheItemType NCollection_Array2< TheItemType >::value_type

STL-compliant typedef for value type.

Constructor & Destructor Documentation

◆ NCollection_Array2() [1/5]

template<class TheItemType>
NCollection_Array2< TheItemType >::NCollection_Array2 ( )
inline

Empty constructor; should be used with caution.

See also
methods Resize() and Move().

◆ NCollection_Array2() [2/5]

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

Constructor.

◆ NCollection_Array2() [3/5]

template<class TheItemType>
NCollection_Array2< TheItemType >::NCollection_Array2 ( const NCollection_Array2< TheItemType > &  theOther)
inline

Copy constructor.

◆ NCollection_Array2() [4/5]

template<class TheItemType>
NCollection_Array2< TheItemType >::NCollection_Array2 ( NCollection_Array2< TheItemType > &&  theOther)
inline

Move constructor.

◆ NCollection_Array2() [5/5]

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

C array-based constructor.

◆ ~NCollection_Array2()

template<class TheItemType>
NCollection_Array2< TheItemType >::~NCollection_Array2 ( void  )
inline

Destructor - releases the memory.

Member Function Documentation

◆ Assign()

template<class TheItemType>
NCollection_Array2& NCollection_Array2< TheItemType >::Assign ( const NCollection_Array2< TheItemType > &  theOther)
inline

Assignment.

◆ ChangeValue()

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

Variable value access.

◆ ColLength()

template<class TheItemType>
Standard_Integer NCollection_Array2< TheItemType >::ColLength ( ) const
inline

Returns length of the column, i.e. number of rows.

◆ Init()

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

Initialise the values.

◆ IsDeletable()

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

myDeletable flag

◆ Length()

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

Length (number of items)

◆ LowerCol()

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

LowerCol.

◆ LowerRow()

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

LowerRow.

◆ Move()

template<class TheItemType>
NCollection_Array2& NCollection_Array2< TheItemType >::Move ( NCollection_Array2< TheItemType > &  theOther)
inline

Move assignment. This array will borrow all the data from theOther. The moved object will be left unitialized and should not be used anymore.

◆ NbColumns()

template<class TheItemType>
Standard_Integer NCollection_Array2< TheItemType >::NbColumns ( ) const
inline

Returns number of columns.

◆ NbRows()

template<class TheItemType>
Standard_Integer NCollection_Array2< TheItemType >::NbRows ( ) const
inline

Returns number of rows.

◆ operator()() [1/2]

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

operator() - alias to ChangeValue

◆ operator()() [2/2]

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

operator() - alias to ChangeValue

◆ operator=() [1/2]

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

Assignment operator.

◆ operator=() [2/2]

template<class TheItemType>
NCollection_Array2& NCollection_Array2< TheItemType >::operator= ( NCollection_Array2< TheItemType > &&  theOther)
inline

Move assignment operator;.

See also
Move()

◆ Resize()

template<class TheItemType>
void NCollection_Array2< TheItemType >::Resize ( Standard_Integer  theRowLower,
Standard_Integer  theRowUpper,
Standard_Integer  theColLower,
Standard_Integer  theColUpper,
Standard_Boolean  theToCopyData 
)
inline

Resizes the array to specified bounds. No re-allocation will be done if length of array does not change, but existing values will not be discarded if theToCopyData set to FALSE.

Parameters
theRowLowernew lower Row of array
theRowUppernew upper Row of array
theColLowernew lower Column of array
theColUppernew upper Column of array
theToCopyDataflag to copy existing data into new array

◆ RowLength()

template<class TheItemType>
Standard_Integer NCollection_Array2< TheItemType >::RowLength ( ) const
inline

Returns length of the row, i.e. number of columns.

◆ SetValue()

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

SetValue.

◆ Size()

template<class TheItemType>
Standard_Integer NCollection_Array2< TheItemType >::Size ( void  ) const
inline

Size (number of items)

◆ UpperCol()

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

UpperCol.

◆ UpperRow()

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

UpperRow.

◆ Value()

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

Constant value access.

Field Documentation

◆ myData

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

Pointer to the row pointers table.

◆ myDeletable

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

Flag showing who allocated the array.

◆ myLowerCol

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

◆ myLowerRow

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

◆ myStart

template<class TheItemType>
TheItemType* NCollection_Array2< TheItemType >::myStart
protected

Pointer to the memory array.

◆ myUpperCol

template<class TheItemType>
Standard_Integer NCollection_Array2< TheItemType >::myUpperCol
protected

◆ myUpperRow

template<class TheItemType>
Standard_Integer NCollection_Array2< TheItemType >::myUpperRow
protected

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