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. | |
SMESH_Array1 (const SMESH_Array1 &theOther) | |
Copy constructor. | |
SMESH_Array1 (const TheItemType &theBegin, const Standard_Integer theLower, const Standard_Integer theUpper) | |
C array-based constructor. | |
void | Init (const TheItemType &theValue) |
Initialise the items with theValue. | |
virtual Standard_Integer | Size (void) const |
Size query. | |
Standard_Integer | Length (void) const |
Length query (the same) | |
Standard_Integer | Lower (void) const |
Lower bound. | |
Standard_Integer | Upper (void) const |
Upper bound. | |
Standard_Boolean | IsDeletable (void) const |
myDeletable flag | |
Standard_Boolean | IsAllocated (void) const |
IsAllocated flag - for naming compatibility. | |
virtual void | Assign (const NCollection_BaseCollection< TheItemType > &theOther) |
Assign (any collection to this array) | |
SMESH_Array1 & | operator= (const SMESH_Array1 &theOther) |
operator= (array to array) | |
const TheItemType & | Value (const Standard_Integer theIndex) const |
Constant value access. | |
const TheItemType & | operator() (const Standard_Integer theIndex) const |
operator() - alias to Value | |
TheItemType & | ChangeValue (const Standard_Integer theIndex) |
Variable value access. | |
TheItemType & | operator() (const Standard_Integer theIndex) |
operator() - alias to ChangeValue | |
void | SetValue (const Standard_Integer theIndex, const TheItemType &theItem) |
Set value. | |
~SMESH_Array1 (void) | |
Destructor - releases the memory. | |
Protected Attributes | |
Standard_Integer | myLowerBound |
Standard_Integer | myUpperBound |
Standard_Boolean | myDeletable |
Flag showing who allocated the array. | |
TheItemType * | myData |
Pointer to '0'th array item. | |
Private Member Functions | |
virtual TYPENAME NCollection_BaseCollection < 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.
SMESH_Array1::SMESH_Array1 | ( | const Standard_Integer | theLower, |
const Standard_Integer | theUpper | ||
) |
Constructor.
Definition at line 102 of file SMESH_Array1.hxx.
References Length(), and myData.
SMESH_Array1::SMESH_Array1 | ( | const SMESH_Array1 & | theOther | ) |
Copy constructor.
Definition at line 123 of file SMESH_Array1.hxx.
References Length(), myData, and myLowerBound.
SMESH_Array1::SMESH_Array1 | ( | const TheItemType & | theBegin, |
const Standard_Integer | theLower, | ||
const Standard_Integer | theUpper | ||
) |
SMESH_Array1::~SMESH_Array1 | ( | void | ) |
Destructor - releases the memory.
Definition at line 260 of file SMESH_Array1.hxx.
References myDeletable, myData, and myLowerBound.
void SMESH_Array1::Init | ( | const TheItemType & | theValue | ) |
Initialise the items with theValue.
Definition at line 156 of file SMESH_Array1.hxx.
References myData, myLowerBound, and myUpperBound.
virtual Standard_Integer SMESH_Array1::Size | ( | void | ) | const [virtual] |
Size query.
Definition at line 164 of file SMESH_Array1.hxx.
References Length().
Standard_Integer SMESH_Array1::Length | ( | void | ) | const |
Length query (the same)
Definition at line 167 of file SMESH_Array1.hxx.
References myUpperBound, and myLowerBound.
Referenced by SMESH_Array1(), Size(), Assign(), and operator=().
Standard_Integer SMESH_Array1::Lower | ( | void | ) | const |
Lower bound.
Definition at line 171 of file SMESH_Array1.hxx.
References myLowerBound.
Referenced by SMESH_Array1::Iterator::Init().
Standard_Integer SMESH_Array1::Upper | ( | void | ) | const |
Upper bound.
Definition at line 174 of file SMESH_Array1.hxx.
References myUpperBound.
Referenced by SMESH_Array1::Iterator::More().
Standard_Boolean SMESH_Array1::IsDeletable | ( | void | ) | const |
Standard_Boolean SMESH_Array1::IsAllocated | ( | void | ) | const |
IsAllocated flag - for naming compatibility.
Definition at line 182 of file SMESH_Array1.hxx.
References myDeletable.
virtual void SMESH_Array1::Assign | ( | const NCollection_BaseCollection< TheItemType > & | theOther | ) | [virtual] |
Assign (any collection to this array)
Definition at line 188 of file SMESH_Array1.hxx.
References Length(), myData, myUpperBound, and myLowerBound.
SMESH_Array1& SMESH_Array1::operator= | ( | const SMESH_Array1 & | theOther | ) |
operator= (array to array)
Definition at line 205 of file SMESH_Array1.hxx.
References Length(), myData, myLowerBound, and myUpperBound.
const TheItemType& SMESH_Array1::Value | ( | const Standard_Integer | theIndex | ) | const |
Constant value access.
Definition at line 221 of file SMESH_Array1.hxx.
References myUpperBound, and myData.
Referenced by SMESH_Array1::Iterator::Value(), and operator()().
const TheItemType& SMESH_Array1::operator() | ( | const Standard_Integer | theIndex | ) | const |
operator() - alias to Value
Definition at line 231 of file SMESH_Array1.hxx.
References Value().
TheItemType& SMESH_Array1::ChangeValue | ( | const Standard_Integer | theIndex | ) |
Variable value access.
Definition at line 235 of file SMESH_Array1.hxx.
References myUpperBound, and myData.
Referenced by SMESH_Array1::Iterator::ChangeValue(), and operator()().
TheItemType& SMESH_Array1::operator() | ( | const Standard_Integer | theIndex | ) |
operator() - alias to ChangeValue
Definition at line 245 of file SMESH_Array1.hxx.
References ChangeValue().
void SMESH_Array1::SetValue | ( | const Standard_Integer | theIndex, |
const TheItemType & | theItem | ||
) |
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& SMESH_Array1::CreateIterator | ( | void | ) | const [private, virtual] |
Definition at line 269 of file SMESH_Array1.hxx.
Standard_Integer SMESH_Array1::myLowerBound [protected] |
Definition at line 274 of file SMESH_Array1.hxx.
Referenced by SMESH_Array1(), Init(), Length(), Lower(), Assign(), operator=(), and ~SMESH_Array1().
Standard_Integer SMESH_Array1::myUpperBound [protected] |
Definition at line 275 of file SMESH_Array1.hxx.
Referenced by Init(), Length(), Upper(), Assign(), operator=(), Value(), ChangeValue(), and SetValue().
Standard_Boolean SMESH_Array1::myDeletable [protected] |
Flag showing who allocated the array.
Definition at line 276 of file SMESH_Array1.hxx.
Referenced by IsDeletable(), IsAllocated(), and ~SMESH_Array1().
TheItemType* SMESH_Array1::myData [protected] |
Pointer to '0'th array item.
Definition at line 277 of file SMESH_Array1.hxx.
Referenced by SMESH_Array1(), Init(), Assign(), operator=(), Value(), ChangeValue(), SetValue(), and ~SMESH_Array1().