7 #ifndef SMESH_Array1_HeaderFile 8 #define SMESH_Array1_HeaderFile 11 #include <Standard_DimensionMismatch.hxx> 12 #include <Standard_OutOfMemory.hxx> 13 #include <Standard_OutOfRange.hxx> 16 #include <NCollection_Array1.hxx> 20 #pragma warning (push) 21 #pragma warning (disable:4291) 78 virtual Standard_Boolean
More (
void)
const 79 {
return (myCurrent<=myArray->
Upper()); }
84 virtual const TheItemType&
Value (
void)
const 90 void*
operator new(
size_t theSize,
91 const Handle(NCollection_BaseAllocator)& theAllocator)
92 {
return theAllocator->Allocate(theSize); }
103 const Standard_Integer theUpper) :
109 #if !defined No_Exception && !defined No_Standard_RangeError 110 if (theUpper < theLower)
111 Standard_RangeError::Raise (
"SMESH_Array1::Create");
113 TheItemType* pBegin =
new TheItemType[
Length()];
114 #if !defined No_Exception && !defined No_Standard_OutOfMemory 116 Standard_OutOfMemory::Raise (
"SMESH_Array1 : Allocation failed");
119 myData = pBegin - theLower;
129 TheItemType* pBegin =
new TheItemType[
Length()];
130 #if !defined No_Exception && !defined No_Standard_OutOfMemory 132 Standard_OutOfMemory::Raise (
"SMESH_Array1 : Allocation failed");
141 const Standard_Integer theLower,
142 const Standard_Integer theUpper) :
148 #if !defined No_Exception && !defined No_Standard_RangeError 149 if (theUpper < theLower)
150 Standard_RangeError::Raise (
"SMESH_Array1::Array1");
152 myData = (TheItemType *) &theBegin - theLower;
156 void Init (
const TheItemType& theValue)
159 for(; pCur <= pEnd; pCur++)
160 *pCur = (TheItemType&) theValue;
164 virtual Standard_Integer
Size (
void)
const 190 if (&theOther ==
this)
192 #if !defined No_Exception && !defined No_Standard_DimensionMismatch 193 if (
Length() != theOther.Size())
194 Standard_DimensionMismatch::Raise (
"SMESH_Array1::Assign");
197 theOther.CreateIterator();
200 pItem <= pEndItem; anIter2.Next())
201 * pItem ++ = anIter2.Value();
207 if (&theOther ==
this)
209 #if !defined No_Exception && !defined No_Standard_DimensionMismatch 211 Standard_DimensionMismatch::Raise (
"SMESH_Array1::operator=");
216 while (pItem <= pEndItem) * pMyItem ++ = * pItem ++;
221 const TheItemType&
Value (
const Standard_Integer theIndex)
const 223 #if !defined No_Exception && !defined No_Standard_OutOfRange 225 Standard_OutOfRange::Raise (
"SMESH_Array1::Value");
231 const TheItemType&
operator() (
const Standard_Integer theIndex)
const 232 {
return Value (theIndex); }
237 #if !defined No_Exception && !defined No_Standard_OutOfRange 239 Standard_OutOfRange::Raise (
"SMESH_Array1::ChangeValue");
250 const TheItemType& theItem)
252 #if !defined No_Exception && !defined No_Standard_OutOfRange 254 Standard_OutOfRange::Raise (
"SMESH_Array1::SetValue");
256 myData[theIndex] = theItem;
270 {
return *(
new (this->IterAllocator())
Iterator(*
this)); }
281 #pragma warning (pop) Standard_Integer myUpperBound
class Handle(MeshVS_DataSource3D)
void Init(const TheItemType &theValue)
Initialise the items with theValue.
Standard_Boolean myDeletable
Flag showing who allocated the array.
Iterator(void)
Empty constructor - for later Init.
virtual TYPENAME NCollection_Array1< TheItemType >::Iterator & CreateIterator(void) const
Iterator(const SMESH_Array1 &theArray)
Constructor with initialisation.
Standard_Boolean IsDeletable(void) const
myDeletable flag
virtual void Assign(const NCollection_Array1< TheItemType > &theOther)
Assign (any collection to this array)
Standard_Boolean IsAllocated(void) const
IsAllocated flag - for naming compatibility.
virtual TheItemType & ChangeValue(void) const
Variable value access.
Purpose: The class Array1 represents unidimensional arrays of fixed size known at run time...
SMESH_Array1(const TheItemType &theBegin, const Standard_Integer theLower, const Standard_Integer theUpper)
C array-based constructor.
virtual void Next(void)
Make step.
Implementation of the Iterator interface.
virtual const TheItemType & Value(void) const
Constant value access.
void Init(const SMESH_Array1 &theArray)
Initialisation.
~SMESH_Array1(void)
Destructor - releases the memory.
const TheItemType & operator()(const Standard_Integer theIndex) const
operator() - alias to Value
const TheItemType & Value(const Standard_Integer theIndex) const
Constant value access.
Standard_Integer myCurrent
Index of the current item.
virtual Standard_Integer Size(void) const
Size query.
SMESH_Array1 * myArray
Pointer to the array being iterated.
Standard_Integer myLowerBound
void SetValue(const Standard_Integer theIndex, const TheItemType &theItem)
Set value.
SMESH_Array1(const SMESH_Array1 &theOther)
Copy constructor.
SMESH_Array1(const Standard_Integer theLower, const Standard_Integer theUpper)
Constructor.
Standard_Integer Length(void) const
Length query (the same)
Standard_Integer Lower(void) const
Lower bound.
Standard_Integer Upper(void) const
Upper bound.
virtual Standard_Boolean More(void) const
Check end.
SMESH_Array1 & operator=(const SMESH_Array1 &theOther)
operator= (array to array)
TheItemType & ChangeValue(const Standard_Integer theIndex)
Variable value access.
TheItemType * myData
Pointer to '0'th array item.