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>

Classes

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

Public Member Functions

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

Protected Attributes

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

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 independent 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.

Constructor & Destructor Documentation

◆ SMESH_Array1() [1/3]

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

◆ SMESH_Array1() [2/3]

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

◆ 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.

References SMESH_Array1< TheItemType >::myData.

◆ ~SMESH_Array1()

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

Member Function Documentation

◆ Assign()

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

◆ ChangeValue()

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

◆ Init()

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

◆ IsAllocated()

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

IsAllocated flag - for naming compatibility.

References SMESH_Array1< TheItemType >::myDeletable.

◆ IsDeletable()

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

myDeletable flag

References SMESH_Array1< TheItemType >::myDeletable.

◆ Length()

◆ Lower()

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

◆ operator()() [1/2]

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

operator() - alias to ChangeValue

References SMESH_Array1< TheItemType >::ChangeValue().

◆ operator()() [2/2]

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

operator() - alias to Value

References SMESH_Array1< TheItemType >::Value().

◆ operator=()

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

◆ SetValue()

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

◆ Size()

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

Size query.

References SMESH_Array1< TheItemType >::Length().

◆ Upper()

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

◆ Value()

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

Member Data Documentation

◆ myData

◆ myDeletable

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

◆ myLowerBound

◆ myUpperBound


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