0024805: Eliminate unused static functions and methods: ShallowDump(), ShallowCopy...
[occt.git] / src / PCollection / PCollection_HArray1.gxx
1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #include <Standard_OutOfRange.hxx>
16 #include <Standard_RangeError.hxx>
17 #include <Standard_NotImplemented.hxx>
18 #include <Standard_ProgramError.hxx>
19
20 // ----------------------------------------------------------------------
21 // HArray1 implementation:
22 // Last Revision : Feb,10 1992 J.P Tirault
23 //                 Implementation of ShallowCopy, ShallowDump
24 //                 methods.
25 // ----------------------------------------------------------------------
26 //                 Constructor
27 // ----------------------------------------------------------------------
28
29 PCollection_HArray1::PCollection_HArray1 
30            (const Standard_Integer First, 
31             const Standard_Integer Last) : Data (Last-First+1)
32 {
33         Standard_Integer Size = Last-First+1;
34         if( Size <= 0 ) Standard_RangeError::Raise();
35         LowerBound = First ;
36         UpperBound = Last ;
37 }
38
39
40 // ----------------------------------------------------------------------
41 //                 datas
42 // ----------------------------------------------------------------------
43
44 Standard_Address PCollection_HArray1::Datas() const
45 {
46   return ((Standard_Address)Data.Lock());
47 }
48
49 // ----------------------------------------------------------------------
50 //                 Constructor
51 // ----------------------------------------------------------------------
52
53 PCollection_HArray1::PCollection_HArray1 
54            (const Standard_Integer First, 
55             const Standard_Integer Last, 
56             const Item& V) :Data (Last-First+1) {
57
58         Standard_Integer Size = Last-First+1;
59         if( Size <= 0 ) Standard_RangeError::Raise();
60         LowerBound = First ;
61         UpperBound = Last ;
62         for(Standard_Integer I = 0 ; I < Size ; I++) Data.SetValue(I, V);
63 }
64
65
66 // ----------------------------------------------------------------------
67 //                  Destructor
68 // ----------------------------------------------------------------------
69
70 /*
71 void PCollection_HArray1::~PCollection_HArray1 () 
72 {
73         delete Data ;
74 }
75 */
76
77
78 /* Anciens INLINE */
79
80 // ----------------------------------------------------------------------
81 //                   SetValue
82 // ----------------------------------------------------------------------
83 void PCollection_HArray1::SetValue
84             ( const Standard_Integer Index, const Item& Value)
85 {
86   Standard_OutOfRange_Raise_if((Index < LowerBound || Index > UpperBound),
87         "Index out of range in HArray1::SetValue");
88   Data.SetValue(Index-LowerBound, Value) ;
89 }
90
91
92 // ----------------------------------------------------------------------
93 //                      Value
94 // ----------------------------------------------------------------------
95 Item PCollection_HArray1::Value
96             ( const Standard_Integer Index) const
97 {
98   Standard_OutOfRange_Raise_if((Index < LowerBound || Index > UpperBound),
99         "Index out of range in HArray1::operator()");
100
101   return Data(Index-LowerBound);
102
103 }
104
105 // ------------------------------------------------------------------
106 //
107 // ------------------------------------------------------------------
108 PCollection_FieldOfHArray1 PCollection_HArray1::Field () const
109 {
110   return Data ;
111 }
112