0024907: Compilation fails on vc12 (VS2013)
[occt.git] / src / PCollection / PCollection_HDoubleList.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 // -----------------------------------------------------------------------
16 // -                                                                     -
17 // -                      HDoubleList                                     -
18 // -                                                                     -
19 // -----------------------------------------------------------------------
20
21
22
23 #include <Standard_NoSuchObject.hxx>
24 #include <Standard_NotImplemented.hxx>
25
26 // -----------------------------------------------------------------------
27 // -                                                                     -
28 // -                                                                     -
29 // -                                                                     -
30 // -----------------------------------------------------------------------
31 PCollection_HDoubleList::PCollection_HDoubleList ( ){
32 }
33
34
35 // -----------------------------------------------------------------------
36 // -                                                                     -
37 // -                                                                     -
38 // -                                                                     -
39 // -----------------------------------------------------------------------
40 Handle(PCollection_HDoubleList) 
41    PCollection_HDoubleList::Construct(const Item& T)
42 {
43
44  Handle(PCollection_HDoubleList) me , L ;
45  me = this;
46  L  = new PCollection_HDoubleList;
47  L->ChangeForwardPointer ( me );  // Pointeur avant de L sur me.
48  Before = L;                      // Pointer arriere de me sur L.
49  L->SetValue ( T );               // Mettre la valeur de l'item.
50  return L;                        // C'est L qui est retourne.
51 }
52
53 /* Anciens INLINE */
54
55
56 void PCollection_HDoubleList::ChangeForwardPointer
57    (const Handle(PCollection_HDoubleList)& L)
58 {
59      Next = L;
60 }
61
62 void PCollection_HDoubleList::ChangeBackPointer
63    (const Handle(PCollection_HDoubleList)& L)
64 {
65     Before  = L;
66 }
67
68
69 void PCollection_HDoubleList::SetValue(const Item& T)
70 {
71   Standard_NoSuchObject_Raise_if (IsEmpty(),
72                                   "Empty Element in HDoubleList::SetValue");
73   Data = T;
74 }
75
76
77 Item PCollection_HDoubleList::Value() const {
78   Standard_NoSuchObject_Raise_if(IsEmpty(),
79                                     "Empty Element in HDoubleList::Value");
80   return Data;
81 }
82
83 Handle(PCollection_HDoubleList) PCollection_HDoubleList::Previous() const {
84   Standard_NoSuchObject_Raise_if((IsEmpty() && Before.IsNull()),
85                                  "Empty Element in HDoubleList::Previous");
86   return Before;
87 }
88
89
90 Standard_Boolean PCollection_HDoubleList::IsEmpty()const
91 {
92   return Next.IsNull();
93 }
94
95
96 Handle(PCollection_HDoubleList) PCollection_HDoubleList::Tail() const {
97   Standard_NoSuchObject_Raise_if(IsEmpty(),
98                                  "Empty Element in HDoubleList::Previous");
99   return Next;
100 }
101
102 // -----------------------------------------------------------------------
103 // -                                                                     -
104 // -                                                                     -
105 // -                                                                     -
106 // -----------------------------------------------------------------------
107 void PCollection_HDoubleList::SwapTail(Handle(PCollection_HDoubleList)&
108                                             WithList)
109 {
110  // Exception si liste vide
111   Standard_NoSuchObject_Raise_if(IsEmpty(),
112                                  "Empty Element in HDoubleList::SwapTail") ;
113
114   Handle(PCollection_HDoubleList) L  = Next;
115   Handle(PCollection_HDoubleList) me ;
116   me = this;
117   WithList->ChangeBackPointer(me);
118   Next = WithList;
119   WithList = L;
120 }
121
122 void PCollection_HDoubleList::Destroy()
123 {
124 #ifdef CSFDB 
125   Next.Nullify();
126 #endif
127 }