0024907: Compilation fails on vc12 (VS2013)
[occt.git] / src / PCollection / PCollection_HSingleList.gxx
CommitLineData
b311480e 1// Copyright (c) 1998-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 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
973c2be1 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.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15// ----------------------------------------------------------------------
7fd59977 16// HSingleList implementation:
7fd59977 17// Last Revision : Feb,10 1992 J.P Tirault
18// Implementation of ShallowCopy, ShallowDump
19// methods.
20// -------------------------------------------------------------------------
21
22#include <Standard_NoSuchObject.hxx>
23#include <Standard_NotImplemented.hxx>
24#include <Standard_ProgramError.hxx>
25#include <Standard_OStream.hxx>
26
27// -------------------------------------------------------------------------
28// -
29// Constructor Returns an empty list -
30// ---------- -
31// -
32// -------------------------------------------------------------------------
33PCollection_HSingleList::PCollection_HSingleList ()
34{
35 Next.Nullify();
36}
37
38
39// -------------------------------------------------------------------------
40// -
41// Construct : Add an item at the beginning of the list -
42// --------- -
43// -
44// -------------------------------------------------------------------------
45Handle(PCollection_HSingleList)
46 PCollection_HSingleList::Construct(const Item& T)const
47{
48
49
50 Handle(PCollection_HSingleList) me , L ;
51 me = this;
52#ifndef OBJS
53 L = new PCollection_HSingleList;
54#else
55 L = new (os_segment::of(this)) PCollection_HSingleList;
56#endif
57 L->ChangeForwardPointer ( me );
58 L->SetValue ( T );
59 return L;
60}
61
7fd59977 62/* Anciens INLINE */
63
64Item PCollection_HSingleList::Value() const {
65 Standard_NoSuchObject_Raise_if(IsEmpty(),
66 "Empty Element in HSingleList::Value");
67 return Data;
68}
69
70Handle(PCollection_HSingleList) PCollection_HSingleList::Tail() const {
71 Standard_NoSuchObject_Raise_if (IsEmpty(),
72 "Empty Element in HSingleList::Value");
73 return Next;
74}
75
76
77Standard_Boolean PCollection_HSingleList::IsEmpty()const
78{
79 return Next.IsNull();
80}
81
82
83void PCollection_HSingleList::SetValue(const Item& T)
84{
85 Standard_NoSuchObject_Raise_if (IsEmpty(),
86 "Empty Element in HSingleList::SetValue");
87 Data = T;
88}
89
90
91// -------------------------------------------------------------------------
92// -
93// SwapTail : Exchange the tail of the current list with an another list -
94// -------- -
95// -
96// -------------------------------------------------------------------------
97void PCollection_HSingleList::SwapTail(Handle(PCollection_HSingleList)&
98 WithList)
99{
100 Standard_NoSuchObject_Raise_if (IsEmpty(),
101 "Empty Element in HSingleList::SwapTail");
102 Handle(PCollection_HSingleList) L = Next;
103 Next = WithList;
104 WithList = L;
105}
106
107
108void PCollection_HSingleList::ChangeForwardPointer
109 (const Handle(PCollection_HSingleList)& L)
110{
111 Next = L;
112}
113
114