blob: bfdc818ded40937eb7a839dc1376eea2a6dc08e6 (
plain)
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
|
// File: IntPolyh_ArrayOfEdges.cxx
// Created: Mon Mar 8 09:32:00 1999
// Author: Fabrice SERVANT
// <fst@cleox.paris1.matra-dtv.fr>
#include <IntPolyh_ArrayOfEdges.ixx>
#include <stdio.h>
#include <Standard_Stream.hxx>
IntPolyh_ArrayOfEdges::IntPolyh_ArrayOfEdges() : n(0),finte(0),ptr(0) { }
IntPolyh_ArrayOfEdges::IntPolyh_ArrayOfEdges(const Standard_Integer N) : n(N),finte(0) {
Init(N);
}
void IntPolyh_ArrayOfEdges::Init(const Standard_Integer N) {
Destroy();
n=N;
ptr = (void*) (new IntPolyh_Edge [n]);
}
const Standard_Integer IntPolyh_ArrayOfEdges::GetN() const {
return(n);
}
const Standard_Integer IntPolyh_ArrayOfEdges::NbEdges() const {
return(finte);
}
void IntPolyh_ArrayOfEdges::SetNbEdges(const Standard_Integer endaoe) {
finte = endaoe;
}
void IntPolyh_ArrayOfEdges::IncNbEdges(){
finte++;
}
# ifdef DEB
#define BORNES 1
# endif
const IntPolyh_Edge& IntPolyh_ArrayOfEdges::Value(const Standard_Integer Index) const {
IntPolyh_Edge* ptredge = (IntPolyh_Edge*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur2 value"<<endl;
printf("Value() from IntPolyh_ArrayOfEdges : ERROR value outside of the array\n");
}
#endif
return(ptredge[Index]);
}
IntPolyh_Edge& IntPolyh_ArrayOfEdges::ChangeValue(const Standard_Integer Index) {
IntPolyh_Edge* ptredge = (IntPolyh_Edge*) ptr;
#if BORNES
if(Index<0 || Index>=n) {
cerr<<" Erreur2 chgVal"<<endl;
printf("ChangeValue() from IntPolyh_ArrayOfEdges : ERROR value outside of the array\n");
}
#endif
return(ptredge[Index]);
}
void IntPolyh_ArrayOfEdges::Destroy() {
if(n) {
if(ptr) {
IntPolyh_Edge* ptredge = (IntPolyh_Edge*) ptr;
delete [] ptredge;
ptredge=0;
ptr=0;
n=0;
}
}
}
IntPolyh_ArrayOfEdges & IntPolyh_ArrayOfEdges::Copy(const IntPolyh_ArrayOfEdges& Other) {
if(ptr==Other.ptr) return(*this);
Destroy();
n=Other.n;
ptr = (void*) (new IntPolyh_Edge[n]);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i]=Other[i];
}
return(*this);
}
void IntPolyh_ArrayOfEdges::Dump() const{
printf("\n ArrayOfEdges 0-> %d",n-1);
for(Standard_Integer i=0;i<n;i++) {
(*this)[i].Dump(i);
}
printf("\n");
}
|