1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <Standard_OutOfRange.hxx>
16 #include <Standard_RangeError.hxx>
17 #include <Standard_NotImplemented.hxx>
18 #include <Standard_ProgramError.hxx>
20 // ----------------------------------------------------------------------
21 // HArray1 implementation:
22 // Last Revision : Feb,10 1992 J.P Tirault
23 // Implementation of ShallowCopy, ShallowDump
25 // ----------------------------------------------------------------------
27 // ----------------------------------------------------------------------
29 PCollection_HArray1::PCollection_HArray1
30 (const Standard_Integer First,
31 const Standard_Integer Last) : Data (Last-First+1)
33 Standard_Integer Size = Last-First+1;
34 if( Size <= 0 ) Standard_RangeError::Raise();
40 // ----------------------------------------------------------------------
42 // ----------------------------------------------------------------------
44 Standard_Address PCollection_HArray1::Datas() const
46 return ((Standard_Address)Data.Lock());
49 // ----------------------------------------------------------------------
51 // ----------------------------------------------------------------------
53 PCollection_HArray1::PCollection_HArray1
54 (const Standard_Integer First,
55 const Standard_Integer Last,
56 const Item& V) :Data (Last-First+1) {
58 Standard_Integer Size = Last-First+1;
59 if( Size <= 0 ) Standard_RangeError::Raise();
62 for(Standard_Integer I = 0 ; I < Size ; I++) Data.SetValue(I, V);
66 // ----------------------------------------------------------------------
68 // ----------------------------------------------------------------------
71 void PCollection_HArray1::~PCollection_HArray1 ()
80 // ----------------------------------------------------------------------
82 // ----------------------------------------------------------------------
83 void PCollection_HArray1::SetValue
84 ( const Standard_Integer Index, const Item& Value)
86 Standard_OutOfRange_Raise_if((Index < LowerBound || Index > UpperBound),
87 "Index out of range in HArray1::SetValue");
88 Data.SetValue(Index-LowerBound, Value) ;
92 // ----------------------------------------------------------------------
94 // ----------------------------------------------------------------------
95 Item PCollection_HArray1::Value
96 ( const Standard_Integer Index) const
98 Standard_OutOfRange_Raise_if((Index < LowerBound || Index > UpperBound),
99 "Index out of range in HArray1::operator()");
101 return Data(Index-LowerBound);
105 // ------------------------------------------------------------------
107 // ------------------------------------------------------------------
108 PCollection_FieldOfHArray1 PCollection_HArray1::Field () const