SALOME - SMESH
SMESH_Array1< TheItemType > Class Template Reference

Purpose: The class Array1 represents unidimensional arrays of fixed size known at run time. More...

#include <SMESH_Array1.hxx>

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

Data Structures

class  Iterator
 Implementation of the Iterator interface. More...
 

Public Member Functions

 SMESH_Array1 (const Standard_Integer theLower, const Standard_Integer theUpper)
 Constructor. More...
 
 SMESH_Array1 (const SMESH_Array1 &theOther)
 Copy constructor. More...
 
 SMESH_Array1 (const TheItemType &theBegin, const Standard_Integer theLower, const Standard_Integer theUpper)
 C array-based constructor. More...
 
void Init (const TheItemType &theValue)
 Initialise the items with theValue. More...
 
virtual Standard_Integer Size (void) const
 Size query. More...
 
Standard_Integer Length (void) const
 Length query (the same) More...
 
Standard_Integer Lower (void) const
 Lower bound. More...
 
Standard_Integer Upper (void) const
 Upper bound. More...
 
Standard_Boolean IsDeletable (void) const
 myDeletable flag More...
 
Standard_Boolean IsAllocated (void) const
 IsAllocated flag - for naming compatibility. More...
 
virtual void Assign (const NCollection_Array1< TheItemType > &theOther)
 Assign (any collection to this array) More...
 
SMESH_Array1operator= (const SMESH_Array1 &theOther)
 operator= (array to array) More...
 
const TheItemType & Value (const Standard_Integer theIndex) const
 Constant value access. More...
 
const TheItemType & operator() (const Standard_Integer theIndex) const
 operator() - alias to Value More...
 
TheItemType & ChangeValue (const Standard_Integer theIndex)
 Variable value access. More...
 
TheItemType & operator() (const Standard_Integer theIndex)
 operator() - alias to ChangeValue More...
 
void SetValue (const Standard_Integer theIndex, const TheItemType &theItem)
 Set value. More...
 
 ~SMESH_Array1 (void)
 Destructor - releases the memory. More...
 

Protected Attributes

Standard_Integer myLowerBound
 
Standard_Integer myUpperBound
 
Standard_Boolean myDeletable
 Flag showing who allocated the array. More...
 
TheItemType * myData
 Pointer to '0'th array item. More...
 

Private Member Functions

virtual TYPENAME NCollection_Array1< TheItemType >::IteratorCreateIterator (void) const
 

Detailed Description

template<class TheItemType>
class SMESH_Array1< TheItemType >

Purpose: The class Array1 represents unidimensional arrays of fixed size known at run time.

The range of the index is user defined. An array1 can be constructed with a "C array". This functionality is useful to call methods expecting an Array1. It allows to carry the bounds inside the arrays.

Examples: Item tab[100]; // An example with a C array Array1OfItem ttab (tab[0],1,100);

Array1OfItem tttab (ttab(10),10,20); // a slice of ttab

If you want to reindex an array from 1 to Length do :

Array1 tab1(tab(tab.Lower()),1,tab.Length());

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

for (i = A.Lower(); i <= A.Upper(); i++)

Changes: In comparison to TCollection the flag isAllocated was renamed into myDeletable (alike in the Array2). For naming compatibility the method IsAllocated remained in class along with IsDeletable.

Definition at line 54 of file SMESH_Array1.hxx.

Constructor & Destructor Documentation

◆ SMESH_Array1() [1/3]

template<class TheItemType >
SMESH_Array1< TheItemType >::SMESH_Array1 ( const Standard_Integer  theLower,
const Standard_Integer  theUpper 
)

Constructor.

Definition at line 102 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::Length(), and SMESH_Array1< TheItemType >::myData.

Here is the call graph for this function:

◆ SMESH_Array1() [2/3]

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

Copy constructor.

Definition at line 123 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::Length(), SMESH_Array1< TheItemType >::myData, and SMESH_Array1< TheItemType >::myLowerBound.

Here is the call graph for this function:

◆ SMESH_Array1() [3/3]

template<class TheItemType >
SMESH_Array1< TheItemType >::SMESH_Array1 ( const TheItemType &  theBegin,
const Standard_Integer  theLower,
const Standard_Integer  theUpper 
)

C array-based constructor.

Definition at line 140 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::myData.

◆ ~SMESH_Array1()

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

Member Function Documentation

◆ Init()

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

◆ Size()

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

Size query.

Definition at line 164 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::Length().

Here is the call graph for this function:

◆ Length()

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

◆ Lower()

template<class TheItemType >
Standard_Integer SMESH_Array1< TheItemType >::Lower ( void  ) const

Lower bound.

Definition at line 171 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::myLowerBound.

Referenced by SMESH_Array1< TheItemType >::Iterator::Init().

Here is the caller graph for this function:

◆ Upper()

template<class TheItemType >
Standard_Integer SMESH_Array1< TheItemType >::Upper ( void  ) const

Upper bound.

Definition at line 174 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::myUpperBound.

Referenced by SMESH_Array1< TheItemType >::Iterator::More().

Here is the caller graph for this function:

◆ IsDeletable()

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

myDeletable flag

Definition at line 178 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::myDeletable.

◆ IsAllocated()

template<class TheItemType >
Standard_Boolean SMESH_Array1< TheItemType >::IsAllocated ( void  ) const

IsAllocated flag - for naming compatibility.

Definition at line 182 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::myDeletable.

◆ Assign()

template<class TheItemType >
virtual void SMESH_Array1< TheItemType >::Assign ( const NCollection_Array1< TheItemType > &  theOther)
virtual

Assign (any collection to this array)

Definition at line 188 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::Length(), SMESH_Array1< TheItemType >::myData, SMESH_Array1< TheItemType >::myLowerBound, and SMESH_Array1< TheItemType >::myUpperBound.

Here is the call graph for this function:

◆ operator=()

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

operator= (array to array)

Definition at line 205 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::Length(), SMESH_Array1< TheItemType >::myData, SMESH_Array1< TheItemType >::myLowerBound, and SMESH_Array1< TheItemType >::myUpperBound.

Here is the call graph for this function:

◆ Value()

template<class TheItemType >
const TheItemType& SMESH_Array1< TheItemType >::Value ( const Standard_Integer  theIndex) const

Constant value access.

Definition at line 221 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::myData, and SMESH_Array1< TheItemType >::myUpperBound.

Referenced by SMESH_Array1< TheItemType >::operator()(), and SMESH_Array1< TheItemType >::Iterator::Value().

Here is the caller graph for this function:

◆ operator()() [1/2]

template<class TheItemType >
const TheItemType& SMESH_Array1< TheItemType >::operator() ( const Standard_Integer  theIndex) const

operator() - alias to Value

Definition at line 231 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::Value().

Here is the call graph for this function:

◆ ChangeValue()

template<class TheItemType >
TheItemType& SMESH_Array1< TheItemType >::ChangeValue ( const Standard_Integer  theIndex)

Variable value access.

Definition at line 235 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::myData, and SMESH_Array1< TheItemType >::myUpperBound.

Referenced by SMESH_Array1< TheItemType >::Iterator::ChangeValue(), and SMESH_Array1< TheItemType >::operator()().

Here is the caller graph for this function:

◆ operator()() [2/2]

template<class TheItemType >
TheItemType& SMESH_Array1< TheItemType >::operator() ( const Standard_Integer  theIndex)

operator() - alias to ChangeValue

Definition at line 245 of file SMESH_Array1.hxx.

References SMESH_Array1< TheItemType >::ChangeValue().

Here is the call graph for this function:

◆ SetValue()

template<class TheItemType >
void SMESH_Array1< TheItemType >::SetValue ( const Standard_Integer  theIndex,
const TheItemType &  theItem 
)

◆ CreateIterator()

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

Definition at line 269 of file SMESH_Array1.hxx.

Field Documentation

◆ myLowerBound

◆ myUpperBound

◆ myDeletable

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

◆ myData