SALOME - SMESH
|
Purpose: The class Array1 represents unidimensional arrays of fixed size known at run time. More...
#include <SMESH_Array1.hxx>
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_Array1 & | operator= (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 >::Iterator & | CreateIterator (void) const |
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.
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.
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.
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< TheItemType >::~SMESH_Array1 | ( | void | ) |
Destructor - releases the memory.
Definition at line 260 of file SMESH_Array1.hxx.
References SMESH_Array1< TheItemType >::myData, SMESH_Array1< TheItemType >::myDeletable, and SMESH_Array1< TheItemType >::myLowerBound.
void SMESH_Array1< TheItemType >::Init | ( | const TheItemType & | theValue | ) |
Initialise the items with theValue.
Definition at line 156 of file SMESH_Array1.hxx.
References SMESH_Array1< TheItemType >::myData, SMESH_Array1< TheItemType >::myLowerBound, and SMESH_Array1< TheItemType >::myUpperBound.
|
virtual |
Size query.
Definition at line 164 of file SMESH_Array1.hxx.
References SMESH_Array1< TheItemType >::Length().
Standard_Integer SMESH_Array1< TheItemType >::Length | ( | void | ) | const |
Length query (the same)
Definition at line 167 of file SMESH_Array1.hxx.
References SMESH_Array1< TheItemType >::myLowerBound, and SMESH_Array1< TheItemType >::myUpperBound.
Referenced by SMESH_Array1< TheItemType >::Assign(), SMESH_Array1< TheItemType >::operator=(), SMESH_Array1< TheItemType >::Size(), and SMESH_Array1< TheItemType >::SMESH_Array1().
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().
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().
Standard_Boolean SMESH_Array1< TheItemType >::IsDeletable | ( | void | ) | const |
myDeletable flag
Definition at line 178 of file SMESH_Array1.hxx.
References SMESH_Array1< TheItemType >::myDeletable.
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.
|
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.
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.
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().
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().
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()().
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().
void SMESH_Array1< TheItemType >::SetValue | ( | const Standard_Integer | theIndex, |
const TheItemType & | theItem | ||
) |
Set value.
Definition at line 249 of file SMESH_Array1.hxx.
References SMESH_Array1< TheItemType >::myData, and SMESH_Array1< TheItemType >::myUpperBound.
|
privatevirtual |
Definition at line 269 of file SMESH_Array1.hxx.
|
protected |
Definition at line 274 of file SMESH_Array1.hxx.
Referenced by SMESH_Array1< TheItemType >::Assign(), SMESH_Array1< TheItemType >::Init(), SMESH_Array1< TheItemType >::Length(), SMESH_Array1< TheItemType >::Lower(), SMESH_Array1< TheItemType >::operator=(), SMESH_Array1< TheItemType >::SMESH_Array1(), and SMESH_Array1< TheItemType >::~SMESH_Array1().
|
protected |
Definition at line 275 of file SMESH_Array1.hxx.
Referenced by SMESH_Array1< TheItemType >::Assign(), SMESH_Array1< TheItemType >::ChangeValue(), SMESH_Array1< TheItemType >::Init(), SMESH_Array1< TheItemType >::Length(), SMESH_Array1< TheItemType >::operator=(), SMESH_Array1< TheItemType >::SetValue(), SMESH_Array1< TheItemType >::Upper(), and SMESH_Array1< TheItemType >::Value().
|
protected |
Flag showing who allocated the array.
Definition at line 276 of file SMESH_Array1.hxx.
Referenced by SMESH_Array1< TheItemType >::IsAllocated(), SMESH_Array1< TheItemType >::IsDeletable(), and SMESH_Array1< TheItemType >::~SMESH_Array1().
|
protected |
Pointer to '0'th array item.
Definition at line 277 of file SMESH_Array1.hxx.
Referenced by SMESH_Array1< TheItemType >::Assign(), SMESH_Array1< TheItemType >::ChangeValue(), SMESH_Array1< TheItemType >::Init(), SMESH_Array1< TheItemType >::operator=(), SMESH_Array1< TheItemType >::SetValue(), SMESH_Array1< TheItemType >::SMESH_Array1(), SMESH_Array1< TheItemType >::Value(), and SMESH_Array1< TheItemType >::~SMESH_Array1().