File: PCollection_HArray1.gxx

package info (click to toggle)
opencascade 6.2-7
  • links: PTS
  • area: non-free
  • in suites: lenny
  • size: 444,652 kB
  • ctags: 256,750
  • sloc: cpp: 1,150,123; ansic: 225,762; tcl: 30,130; makefile: 12,619; sh: 7,958; xml: 3,981; lisp: 283; java: 212; csh: 203; perl: 15
file content (124 lines) | stat: -rw-r--r-- 3,777 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include <Standard_OutOfRange.hxx>
#include <Standard_RangeError.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_ProgramError.hxx>

// ----------------------------------------------------------------------
// 
// HArray1 implementation:
// 
// Last Revision : Feb,10 1992 J.P Tirault
//                 Implementation of ShallowCopy, ShallowDump
//                 methods.
// ----------------------------------------------------------------------
//                 Constructor
// ----------------------------------------------------------------------

PCollection_HArray1::PCollection_HArray1 
           (const Standard_Integer First, 
            const Standard_Integer Last) : Data (Last-First+1)
{
	Standard_Integer Size = Last-First+1;
	if( Size <= 0 ) Standard_RangeError::Raise();
	LowerBound = First ;
	UpperBound = Last ;
}


// ----------------------------------------------------------------------
//                 datas
// ----------------------------------------------------------------------

Standard_Address PCollection_HArray1::Datas() const
{
  return ((Standard_Address)Data.Lock());
}

// ----------------------------------------------------------------------
//                 Constructor
// ----------------------------------------------------------------------

PCollection_HArray1::PCollection_HArray1 
           (const Standard_Integer First, 
            const Standard_Integer Last, 
            const Item& V) :Data (Last-First+1) {

	Standard_Integer Size = Last-First+1;
	if( Size <= 0 ) Standard_RangeError::Raise();
	LowerBound = First ;
	UpperBound = Last ;
	for(Standard_Integer I = 0 ; I < Size ; I++) Data.SetValue(I, V);
}


// ----------------------------------------------------------------------
//                  Destructor
// ----------------------------------------------------------------------

/*
void PCollection_HArray1::~PCollection_HArray1 () 
{
	delete Data ;
}
*/



// ----------------------------------------------------------------------
//                      ShallowCopy
// ----------------------------------------------------------------------

Handle(Standard_Persistent) PCollection_HArray1::ShallowCopy() const
{
  PCollection_HArray1* TheCopy = new PCollection_HArray1(*this);
//  PCollection_FieldOfHArray1 DataCopy (Data);
//  TheCopy->Data = DataCopy;
  return TheCopy;
}

// ----------------------------------------------------------------------
//                      ShallowDump
// ----------------------------------------------------------------------

void PCollection_HArray1::ShallowDump(Standard_OStream& S) const
{
  ::ShallowDump(Data,S);
}



/* Anciens INLINE */

// ----------------------------------------------------------------------
//                   SetValue
// ----------------------------------------------------------------------
void PCollection_HArray1::SetValue
            ( const Standard_Integer Index, const Item& Value)
{
  Standard_OutOfRange_Raise_if((Index < LowerBound || Index > UpperBound),
        "Index out of range in HArray1::SetValue");
  Data.SetValue(Index-LowerBound, Value) ;
}


// ----------------------------------------------------------------------
//                      Value
// ----------------------------------------------------------------------
Item PCollection_HArray1::Value
            ( const Standard_Integer Index) const
{
  Standard_OutOfRange_Raise_if((Index < LowerBound || Index > UpperBound),
        "Index out of range in HArray1::operator()");

  return Data(Index-LowerBound);

}

// ------------------------------------------------------------------
//
// ------------------------------------------------------------------
PCollection_FieldOfHArray1 PCollection_HArray1::Field () const
{
  return Data ;
}