blob: d5d15d651fdbc86154fc980a5982ab8d9f32c1fd (
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
98
99
100
101
102
103
|
// File: Poly_CoherentTriPtr.cxx
// Created: 08.12.07 12:33
// Author: Alexander GRIGORIEV
// Copyright: Open Cascade 2007
#include <Poly_CoherentTriPtr.hxx>
//=======================================================================
//function : Iterator::Next
//purpose :
//=======================================================================
void Poly_CoherentTriPtr::Iterator::Next ()
{
if (myCurrent)
{
myCurrent = myCurrent->myNext;
if (myCurrent == myFirst)
myCurrent = 0L;
}
}
//=======================================================================
//function : Append
//purpose :
//=======================================================================
void Poly_CoherentTriPtr::Append
(const Poly_CoherentTriangle * pTri,
const Handle_NCollection_BaseAllocator& theAlloc)
{
Handle(NCollection_BaseAllocator) anAlloc = theAlloc;
if (theAlloc.IsNull())
anAlloc = NCollection_BaseAllocator::CommonBaseAllocator();
Poly_CoherentTriPtr * aNewPtr = new (anAlloc) Poly_CoherentTriPtr(* pTri);
aNewPtr->myNext = myNext;
myNext->myPrevious = aNewPtr;
aNewPtr->myPrevious = this;
myNext = aNewPtr;
}
//=======================================================================
//function : Prepend
//purpose :
//=======================================================================
void Poly_CoherentTriPtr::Prepend
(const Poly_CoherentTriangle * pTri,
const Handle_NCollection_BaseAllocator& theAlloc)
{
Handle(NCollection_BaseAllocator) anAlloc = theAlloc;
if (theAlloc.IsNull())
anAlloc = NCollection_BaseAllocator::CommonBaseAllocator();
Poly_CoherentTriPtr * aNewPtr = new (anAlloc) Poly_CoherentTriPtr(* pTri);
aNewPtr->myPrevious = myPrevious;
myPrevious->myNext = aNewPtr;
aNewPtr->myNext = this;
myPrevious = aNewPtr;
}
//=======================================================================
//function : Remove
//purpose :
//=======================================================================
void Poly_CoherentTriPtr::Remove
(Poly_CoherentTriPtr * thePtr,
const Handle_NCollection_BaseAllocator& theAlloc)
{
Handle(NCollection_BaseAllocator) anAlloc = theAlloc;
if (theAlloc.IsNull())
anAlloc = NCollection_BaseAllocator::CommonBaseAllocator();
if (thePtr->myNext && thePtr->myPrevious) {
thePtr->myPrevious->myNext = thePtr->myNext;
thePtr->myNext->myPrevious = thePtr->myPrevious;
thePtr->myNext = thePtr;
thePtr->myPrevious = thePtr;
}
anAlloc->Free(thePtr);
}
//=======================================================================
//function : RemoveList
//purpose :
//=======================================================================
void Poly_CoherentTriPtr::RemoveList
(Poly_CoherentTriPtr * thePtr,
const Handle_NCollection_BaseAllocator& theAlloc)
{
Handle(NCollection_BaseAllocator) anAlloc = theAlloc;
if (theAlloc.IsNull())
anAlloc = NCollection_BaseAllocator::CommonBaseAllocator();
Poly_CoherentTriPtr * aPtr = thePtr;
do {
if (aPtr == 0L)
break;
Poly_CoherentTriPtr * aLostPtr = aPtr;
aPtr = aPtr->myNext;
anAlloc->Free(aLostPtr);
} while (aPtr != thePtr);
}
|