Open CASCADE Technology 7.8.2.dev
NCollection_Array2< TheItemType > Class Template Reference

#include <NCollection_Array2.hxx>

Inheritance diagram for NCollection_Array2< TheItemType >:

Public Types

typedef NCollection_Allocator< TheItemType > allocator_type
 Memory allocation.
 
using value_type = typename NCollection_Array1<TheItemType>::value_type
 
using size_type = typename NCollection_Array1<TheItemType>::size_type
 
using difference_type = typename NCollection_Array1<TheItemType>::difference_type
 
using pointer = typename NCollection_Array1<TheItemType>::pointer
 
using const_pointer = typename NCollection_Array1<TheItemType>::const_pointer
 
using reference = typename NCollection_Array1<TheItemType>::reference
 
using const_reference = typename NCollection_Array1<TheItemType>::const_reference
 
using iterator = typename NCollection_Array1<TheItemType>::iterator
 
using const_iterator = typename NCollection_Array1<TheItemType>::const_iterator
 
- Public Types inherited from NCollection_Array1< TheItemType >
typedef NCollection_Allocator< TheItemType > allocator_type
 Memory allocation.
 
using value_type = TheItemType
 
using size_type = size_t
 
using difference_type = size_t
 
using pointer = TheItemType*
 
using const_pointer = const TheItemType*
 
using reference = TheItemType&
 
using const_reference = const TheItemType&
 
using iterator = NCollection_IndexedIterator<std::random_access_iterator_tag, NCollection_Array1, value_type, false>
 
using const_iterator = NCollection_IndexedIterator<std::random_access_iterator_tag, NCollection_Array1, value_type, true>
 
using Iterator = NCollection_Iterator<NCollection_Array1<TheItemType>>
 

Public Member Functions

 NCollection_Array2 ()
 Empty constructor; should be used with caution.
 
 NCollection_Array2 (const Standard_Integer theRowLower, const Standard_Integer theRowUpper, const Standard_Integer theColLower, const Standard_Integer theColUpper)
 Constructor.
 
 NCollection_Array2 (const allocator_type &theAlloc, const Standard_Integer theRowLower, const Standard_Integer theRowUpper, const Standard_Integer theColLower, const Standard_Integer theColUpper)
 Constructor.
 
 NCollection_Array2 (const NCollection_Array2 &theOther)
 Copy constructor.
 
 NCollection_Array2 (NCollection_Array2 &&theOther) noexcept
 Move constructor.
 
 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.
 
Standard_Integer Size () const
 Size (number of items)
 
Standard_Integer Length () const
 Length (number of items)
 
Standard_Integer NbRows () const
 Returns number of rows.
 
Standard_Integer NbColumns () const
 Returns number of columns.
 
Standard_Integer RowLength () const
 Returns length of the row, i.e. number of columns.
 
Standard_Integer ColLength () const
 Returns length of the column, i.e. number of rows.
 
Standard_Integer LowerRow () const
 LowerRow.
 
Standard_Integer UpperRow () const
 UpperRow.
 
Standard_Integer LowerCol () const
 LowerCol.
 
Standard_Integer UpperCol () const
 UpperCol.
 
NCollection_Array2Assign (const NCollection_Array2 &theOther)
 Assignment.
 
NCollection_Array2Move (NCollection_Array2 &&theOther)
 Move assignment. This array will borrow all the data from theOther. The moved object will be left uninitialized and should not be used anymore.
 
NCollection_Array2Move (NCollection_Array2 &theOther)
 Move assignment. This array will borrow all the data from theOther. The moved object will be left uninitialized and should not be used anymore.
 
NCollection_Array2operator= (const NCollection_Array2 &theOther)
 Assignment operator.
 
NCollection_Array2operator= (NCollection_Array2 &&theOther)
 Move assignment operator;.
 
const_reference Value (const Standard_Integer theRow, const Standard_Integer theCol) const
 Constant value access.
 
const_reference operator() (const Standard_Integer theRow, const Standard_Integer theCol) const
 operator() - alias to ChangeValue
 
reference ChangeValue (const Standard_Integer theRow, const Standard_Integer theCol)
 Variable value access.
 
reference operator() (const Standard_Integer theRow, const Standard_Integer theCol)
 operator() - alias to ChangeValue
 
void SetValue (const Standard_Integer theRow, const Standard_Integer theCol, const TheItemType &theItem)
 SetValue.
 
void SetValue (const Standard_Integer theRow, const Standard_Integer theCol, TheItemType &&theItem)
 SetValue.
 
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.
 
- Public Member Functions inherited from NCollection_Array1< TheItemType >
const_iterator begin () const
 
iterator begin ()
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
 NCollection_Array1 ()
 
 NCollection_Array1 (const Standard_Integer theLower, const Standard_Integer theUpper)
 
 NCollection_Array1 (const allocator_type &theAlloc, const Standard_Integer theLower, const Standard_Integer theUpper)
 
 NCollection_Array1 (const_reference theBegin, const Standard_Integer theLower, const Standard_Integer theUpper, const bool theUseBuffer=true)
 
 NCollection_Array1 (const NCollection_Array1 &theOther)
 Copy constructor.
 
 NCollection_Array1 (NCollection_Array1 &&theOther) noexcept
 Move constructor.
 
virtual ~NCollection_Array1 ()
 
void Init (const_reference theValue)
 Initialise the items with theValue.
 
Standard_Integer Size () const
 Size query.
 
Standard_Integer Length () const
 Length query (the same)
 
Standard_Boolean IsEmpty () const
 Return TRUE if array has zero length.
 
Standard_Integer Lower () const
 Lower bound.
 
Standard_Integer Upper () const
 Upper bound.
 
NCollection_Array1Assign (const NCollection_Array1 &theOther)
 Copies data of theOther array to this. This array should be pre-allocated and have the same length as theOther; otherwise exception Standard_DimensionMismatch is thrown.
 
NCollection_Array1Move (NCollection_Array1 &&theOther) noexcept
 Move assignment. This array will borrow all the data from theOther. The moved object will keep pointer to the memory buffer and range, but it will not free the buffer on destruction.
 
NCollection_Array1Move (NCollection_Array1 &theOther)
 
NCollection_Array1operator= (const NCollection_Array1 &theOther)
 Assignment operator;.
 
NCollection_Array1operator= (NCollection_Array1 &&theOther) noexcept
 Move assignment operator;.
 
const_reference First () const
 
reference ChangeFirst ()
 
const_reference Last () const
 
reference ChangeLast ()
 
const_reference Value (const Standard_Integer theIndex) const
 Constant value access.
 
const_reference operator() (const Standard_Integer theIndex) const
 operator() - alias to Value
 
const_reference operator[] (const Standard_Integer theIndex) const
 operator[] - alias to Value
 
reference ChangeValue (const Standard_Integer theIndex)
 Variable value access.
 
reference operator() (const Standard_Integer theIndex)
 operator() - alias to ChangeValue
 
reference operator[] (const Standard_Integer theIndex)
 operator[] - alias to ChangeValue
 
void SetValue (const Standard_Integer theIndex, const value_type &theItem)
 Set value.
 
void SetValue (const Standard_Integer theIndex, value_type &&theItem)
 Set value.
 
void UpdateLowerBound (const Standard_Integer theLower)
 Changes the lowest bound. Do not move data.
 
void UpdateUpperBound (const Standard_Integer theUpper)
 Changes the upper bound. Do not move data.
 
void Resize (const Standard_Integer theLower, const Standard_Integer theUpper, const 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.
 
bool IsDeletable () const
 

Static Public Member Functions

static int BeginPosition (Standard_Integer theRowLower, Standard_Integer, Standard_Integer theColLower, Standard_Integer theColUpper)
 
static int LastPosition (Standard_Integer theRowLower, Standard_Integer theRowUpper, Standard_Integer theColLower, Standard_Integer theColUpper)
 

Protected Attributes

Standard_Integer myLowerRow
 
size_t mySizeRow
 
Standard_Integer myLowerCol
 
size_t mySizeCol
 
friend iterator
 
friend const_iterator
 
- Protected Attributes inherited from NCollection_Array1< TheItemType >
Standard_Integer myLowerBound
 
size_t mySize
 
pointer myPointer = nullptr
 
bool myIsOwner = false
 
allocator_type myAllocator
 

Additional Inherited Members

- Data Fields inherited from NCollection_Array1< TheItemType >
friend iterator
 
friend const_iterator
 
- Protected Member Functions inherited from NCollection_Array1< TheItemType >
const_reference at (const size_t theIndex) const
 
reference at (const size_t theIndex)
 
template<typename U = TheItemType>
std::enable_if< std::is_arithmetic< U >::value, void >::type construct ()
 
template<typename U = TheItemType>
std::enable_if<!std::is_arithmetic< U >::value, void >::type construct ()
 
template<typename U = TheItemType>
std::enable_if< std::is_arithmetic< U >::value, void >::type construct (const size_t, const size_t)
 
template<typename U = TheItemType>
std::enable_if<!std::is_arithmetic< U >::value, void >::type construct (const size_t theFrom, const size_t theTo)
 
template<typename U = TheItemType>
std::enable_if< std::is_arithmetic< U >::value, void >::type destroy ()
 
template<typename U = TheItemType>
std::enable_if<!std::is_arithmetic< U >::value, void >::type destroy ()
 
template<typename U = TheItemType>
std::enable_if< std::is_arithmetic< U >::value, void >::type destroy (pointer, const size_t, const size_t)
 
template<typename U = TheItemType>
std::enable_if<!std::is_arithmetic< U >::value, void >::type destroy (pointer theWhat, const size_t theFrom, const size_t theTo)
 
void copyConstruct (const pointer theFrom, const size_t theCount)
 

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

◆ allocator_type

template<class TheItemType >
NCollection_Allocator<TheItemType> NCollection_Array2< TheItemType >::allocator_type

Memory allocation.

◆ const_iterator

template<class TheItemType >
using NCollection_Array2< TheItemType >::const_iterator = typename NCollection_Array1<TheItemType>::const_iterator

◆ const_pointer

template<class TheItemType >
using NCollection_Array2< TheItemType >::const_pointer = typename NCollection_Array1<TheItemType>::const_pointer

◆ const_reference

template<class TheItemType >
using NCollection_Array2< TheItemType >::const_reference = typename NCollection_Array1<TheItemType>::const_reference

◆ difference_type

template<class TheItemType >
using NCollection_Array2< TheItemType >::difference_type = typename NCollection_Array1<TheItemType>::difference_type

◆ iterator

template<class TheItemType >
using NCollection_Array2< TheItemType >::iterator = typename NCollection_Array1<TheItemType>::iterator

◆ pointer

template<class TheItemType >
using NCollection_Array2< TheItemType >::pointer = typename NCollection_Array1<TheItemType>::pointer

◆ reference

template<class TheItemType >
using NCollection_Array2< TheItemType >::reference = typename NCollection_Array1<TheItemType>::reference

◆ size_type

template<class TheItemType >
using NCollection_Array2< TheItemType >::size_type = typename NCollection_Array1<TheItemType>::size_type

◆ value_type

template<class TheItemType >
using NCollection_Array2< TheItemType >::value_type = typename NCollection_Array1<TheItemType>::value_type

Constructor & Destructor Documentation

◆ NCollection_Array2() [1/6]

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/6]

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/6]

template<class TheItemType >
NCollection_Array2< TheItemType >::NCollection_Array2 ( const allocator_type & theAlloc,
const Standard_Integer theRowLower,
const Standard_Integer theRowUpper,
const Standard_Integer theColLower,
const Standard_Integer theColUpper )
inlineexplicit

Constructor.

◆ NCollection_Array2() [4/6]

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

Copy constructor.

◆ NCollection_Array2() [5/6]

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

Move constructor.

◆ NCollection_Array2() [6/6]

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 )
inlineexplicit

C array-based constructor.

Member Function Documentation

◆ Assign()

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

Assignment.

◆ BeginPosition()

template<class TheItemType >
static int NCollection_Array2< TheItemType >::BeginPosition ( Standard_Integer theRowLower,
Standard_Integer ,
Standard_Integer theColLower,
Standard_Integer theColUpper )
inlinestatic

◆ ChangeValue()

template<class TheItemType >
reference 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.

◆ LastPosition()

template<class TheItemType >
static int NCollection_Array2< TheItemType >::LastPosition ( Standard_Integer theRowLower,
Standard_Integer theRowUpper,
Standard_Integer theColLower,
Standard_Integer theColUpper )
inlinestatic

◆ Length()

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

Length (number of items)

◆ LowerCol()

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

LowerCol.

◆ LowerRow()

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

LowerRow.

◆ Move() [1/2]

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 uninitialized and should not be used anymore.

◆ Move() [2/2]

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 uninitialized 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 >
reference NCollection_Array2< TheItemType >::operator() ( const Standard_Integer theRow,
const Standard_Integer theCol )
inline

operator() - alias to ChangeValue

◆ operator()() [2/2]

template<class TheItemType >
const_reference NCollection_Array2< TheItemType >::operator() ( const Standard_Integer theRow,
const Standard_Integer theCol ) const
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() [1/2]

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

SetValue.

◆ SetValue() [2/2]

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

SetValue.

◆ Size()

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

Size (number of items)

◆ UpperCol()

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

UpperCol.

◆ UpperRow()

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

UpperRow.

◆ Value()

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

Constant value access.

Field Documentation

◆ const_iterator

template<class TheItemType >
friend NCollection_Array2< TheItemType >::const_iterator
protected

◆ iterator

template<class TheItemType >
friend NCollection_Array2< TheItemType >::iterator
protected

◆ myLowerCol

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

◆ myLowerRow

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

◆ mySizeCol

template<class TheItemType >
size_t NCollection_Array2< TheItemType >::mySizeCol
protected

◆ mySizeRow

template<class TheItemType >
size_t NCollection_Array2< TheItemType >::mySizeRow
protected

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