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_Array1 & | operator= (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 |
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.
SMESH_Array1< TheItemType >::SMESH_Array1 | ( | const Standard_Integer | theLower, |
const Standard_Integer | theUpper | ||
) |
Constructor.
References SMESH_Array1< TheItemType >::Length(), and SMESH_Array1< TheItemType >::myData.
SMESH_Array1< TheItemType >::SMESH_Array1 | ( | const SMESH_Array1< TheItemType > & | theOther | ) |
Copy constructor.
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.
References SMESH_Array1< TheItemType >::myData.
SMESH_Array1< TheItemType >::~SMESH_Array1 | ( | void | ) |
Destructor - releases the memory.
References SMESH_Array1< TheItemType >::myData, SMESH_Array1< TheItemType >::myDeletable, and SMESH_Array1< TheItemType >::myLowerBound.
|
virtual |
Assign (any collection to this array)
References SMESH_Array1< TheItemType >::Length(), SMESH_Array1< TheItemType >::myData, SMESH_Array1< TheItemType >::myLowerBound, and SMESH_Array1< TheItemType >::myUpperBound.
TheItemType & SMESH_Array1< TheItemType >::ChangeValue | ( | const Standard_Integer | theIndex | ) |
Variable value access.
References SMESH_Array1< TheItemType >::myData, and SMESH_Array1< TheItemType >::myUpperBound.
Referenced by SMESH_Array1< TheItemType >::Iterator::ChangeValue(), and SMESH_Array1< TheItemType >::operator()().
void SMESH_Array1< TheItemType >::Init | ( | const TheItemType & | theValue | ) |
Initialise the items with theValue.
References SMESH_Array1< TheItemType >::myData, SMESH_Array1< TheItemType >::myLowerBound, and SMESH_Array1< TheItemType >::myUpperBound.
Standard_Boolean SMESH_Array1< TheItemType >::IsAllocated | ( | void | ) | const |
IsAllocated flag - for naming compatibility.
References SMESH_Array1< TheItemType >::myDeletable.
Standard_Boolean SMESH_Array1< TheItemType >::IsDeletable | ( | void | ) | const |
myDeletable flag
References SMESH_Array1< TheItemType >::myDeletable.
Standard_Integer SMESH_Array1< TheItemType >::Length | ( | void | ) | const |
Length query (the same)
References SMESH_Array1< TheItemType >::myLowerBound, and SMESH_Array1< TheItemType >::myUpperBound.
Referenced by ArchStructure.CommandStructuralSystem::Activated(), SMESH_Array1< TheItemType >::Assign(), ArchPanel.CommandPanel::getPoint(), SMESH_Array1< TheItemType >::operator=(), ArchPanel.CommandPanel::setLength(), SMESH_Array1< TheItemType >::Size(), SMESH_Array1< TheItemType >::SMESH_Array1(), and ArchPanel.CommandPanel::update().
Standard_Integer SMESH_Array1< TheItemType >::Lower | ( | void | ) | const |
Lower bound.
References SMESH_Array1< TheItemType >::myLowerBound.
Referenced by SMESH_Array1< TheItemType >::Iterator::Init().
TheItemType & SMESH_Array1< TheItemType >::operator() | ( | const Standard_Integer | theIndex | ) |
operator() - alias to ChangeValue
References SMESH_Array1< TheItemType >::ChangeValue().
const TheItemType & SMESH_Array1< TheItemType >::operator() | ( | const Standard_Integer | theIndex | ) | const |
operator() - alias to Value
References SMESH_Array1< TheItemType >::Value().
SMESH_Array1 & SMESH_Array1< TheItemType >::operator= | ( | const SMESH_Array1< TheItemType > & | theOther | ) |
operator= (array to array)
References SMESH_Array1< TheItemType >::Length(), SMESH_Array1< TheItemType >::myData, SMESH_Array1< TheItemType >::myLowerBound, and SMESH_Array1< TheItemType >::myUpperBound.
void SMESH_Array1< TheItemType >::SetValue | ( | const Standard_Integer | theIndex, |
const TheItemType & | theItem | ||
) |
Set value.
References SMESH_Array1< TheItemType >::myData, and SMESH_Array1< TheItemType >::myUpperBound.
|
virtual |
Size query.
References SMESH_Array1< TheItemType >::Length().
Standard_Integer SMESH_Array1< TheItemType >::Upper | ( | void | ) | const |
Upper bound.
References SMESH_Array1< TheItemType >::myUpperBound.
Referenced by SMESH_Array1< TheItemType >::Iterator::More().
const TheItemType & SMESH_Array1< TheItemType >::Value | ( | const Standard_Integer | theIndex | ) | const |
Constant value access.
References SMESH_Array1< TheItemType >::myData, and SMESH_Array1< TheItemType >::myUpperBound.
Referenced by SMESH_Array1< TheItemType >::operator()(), and SMESH_Array1< TheItemType >::Iterator::Value().
|
protected |
Pointer to '0'th array item.
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().
|
protected |
Flag showing who allocated the array.
Referenced by SMESH_Array1< TheItemType >::IsAllocated(), SMESH_Array1< TheItemType >::IsDeletable(), and SMESH_Array1< TheItemType >::~SMESH_Array1().
|
protected |
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 |
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().