7 #ifndef SMESH_Array2_HeaderFile
8 #define SMESH_Array2_HeaderFile
11 #include <Standard_DimensionMismatch.hxx>
12 #include <Standard_OutOfMemory.hxx>
13 #include <Standard_OutOfRange.hxx>
16 #include <NCollection_BaseCollection.hxx>
20 #pragma warning (disable:4291)
62 virtual Standard_Boolean
More (
void)
const
68 virtual const TheItemType&
Value (
void)
const
74 void*
operator new(
size_t theSize,
75 const Handle(NCollection_BaseAllocator)& theAllocator)
76 {
return theAllocator->Allocate(theSize); }
88 const Standard_Integer theRowUpper,
89 const Standard_Integer theColLower,
90 const Standard_Integer theColUpper) :
114 const Standard_Integer theRowLower,
115 const Standard_Integer theRowUpper,
116 const Standard_Integer theColLower,
117 const Standard_Integer theColUpper) :
125 myStart = (TheItemType *) &theBegin;
130 void Init (
const TheItemType& theValue)
133 for(pCur =
myStart; pCur<pEnd; pCur++)
138 virtual Standard_Integer
Size (
void)
const
173 if (&theOther ==
this)
175 #if !defined No_Exception && !defined No_Standard_DimensionMismatch
176 if (
Length() != theOther.Size())
177 Standard_DimensionMismatch::Raise (
"SMESH_Array2::Assign");
180 theOther.CreateIterator();
182 for (TheItemType* pItem=
myStart;
184 pItem++, anIter2.Next())
185 *pItem = anIter2.Value();
191 if (&theOther ==
this)
193 #if !defined No_Exception && !defined No_Standard_DimensionMismatch
195 Standard_DimensionMismatch::Raise (
"SMESH_Array2::operator=");
197 TheItemType * pMyItem =
myStart;
198 TheItemType * pItem = theOther.
myStart;
199 const Standard_Integer iSize =
Length();
200 for (Standard_Integer i=0; i < iSize; i++, pItem++, pMyItem++)
206 const TheItemType&
Value (
const Standard_Integer theRow,
207 const Standard_Integer theCol)
const
209 #if !defined No_Exception && !defined No_Standard_OutOfRange
210 if (theRow < myLowerRow || theRow >
myUpperRow ||
212 Standard_OutOfRange::Raise (
"SMESH_Array2::Value");
214 return myData[theRow][theCol];
218 const TheItemType&
operator() (
const Standard_Integer theRow,
219 const Standard_Integer theCol)
const
220 {
return Value (theRow,theCol); }
224 const Standard_Integer theCol)
226 #if !defined No_Exception && !defined No_Standard_OutOfRange
227 if (theRow < myLowerRow || theRow >
myUpperRow ||
229 Standard_OutOfRange::Raise (
"SMESH_Array2::ChangeValue");
231 return myData[theRow][theCol];
236 const Standard_Integer theCol)
241 const Standard_Integer theCol,
242 const TheItemType& theItem)
244 #if !defined No_Exception && !defined No_Standard_OutOfRange
245 if (theRow < myLowerRow || theRow >
myUpperRow ||
247 Standard_OutOfRange::Raise (
"SMESH_Array2::SetValue");
249 myData[theRow][theCol] = theItem;
267 #if !defined No_Exception && !defined No_Standard_RangeError
268 if (iRowSize <= 0 || iColSize <= 0)
269 Standard_RangeError::Raise (
"SMESH_Array2::Allocate");
273 myStart =
new TheItemType[iRowSize * iColSize];
274 #if !defined No_Exception && !defined No_Standard_OutOfMemory
276 Standard_OutOfMemory::Raise (
"SMESH_Array2 : Allocation failed");
280 TheItemType** pTable =
new TheItemType* [iColSize];
281 #if !defined No_Exception && !defined No_Standard_OutOfMemory
283 Standard_OutOfMemory::Raise (
"SMESH_Array2 : Allocation failed");
288 for (Standard_Integer i = 0; i < iColSize; i++)
301 {
return *(
new (this->IterAllocator())
Iterator(*
this)); }
320 #pragma warning (default:4291)