b311480e |
1 | // Created on: 1993-02-26 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | #include <Standard_NoSuchObject.hxx> |
23 | |
24 | //======================================================================= |
25 | //function : TCollection_SList |
26 | //purpose : |
27 | //======================================================================= |
28 | |
29 | TCollection_SList::TCollection_SList() |
30 | {} |
31 | |
32 | //======================================================================= |
33 | //function : TCollection_SList |
34 | //purpose : |
35 | //======================================================================= |
36 | |
37 | TCollection_SList::TCollection_SList(const Item& anItem, |
38 | const TCollection_SList& aTail) : |
39 | myNode(new TCollection_SListNode(anItem,aTail)) |
40 | {} |
41 | |
42 | //======================================================================= |
43 | //function : TCollection_SList |
44 | //purpose : |
45 | //======================================================================= |
46 | |
47 | TCollection_SList::TCollection_SList(const TCollection_SList& Other) : |
48 | myNode(Other.myNode) |
49 | { |
50 | } |
51 | |
52 | //======================================================================= |
53 | //function : Assign |
54 | //purpose : |
55 | //======================================================================= |
56 | |
57 | TCollection_SList& TCollection_SList::Assign(const TCollection_SList& Other) |
58 | { |
59 | if (this == &Other) return *this; |
60 | Clear(); |
61 | myNode = Other.myNode; |
62 | |
63 | return *this; |
64 | } |
65 | |
66 | //======================================================================= |
67 | //function : Clear |
68 | //purpose : |
69 | //======================================================================= |
70 | |
71 | void TCollection_SList::Clear() |
72 | { |
73 | if (!myNode.IsNull()) { |
74 | myNode.Nullify(); |
75 | } |
76 | } |
77 | |
78 | //======================================================================= |
79 | //function : Value |
80 | //purpose : |
81 | //======================================================================= |
82 | |
83 | const Item& TCollection_SList::Value() const |
84 | { |
85 | Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TCollection_SList::Value"); |
86 | return myNode->Value(); |
87 | } |
88 | |
89 | //======================================================================= |
90 | //function : ChangeValue |
91 | //purpose : |
92 | //======================================================================= |
93 | |
94 | Item& TCollection_SList::ChangeValue() |
95 | { |
96 | Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TCollection_SList::Value"); |
97 | return myNode->Value(); |
98 | } |
99 | |
100 | //======================================================================= |
101 | //function : SetValue |
102 | //purpose : |
103 | //======================================================================= |
104 | |
105 | void TCollection_SList::SetValue(const Item& anItem) |
106 | { |
107 | Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TCollection_SList::Value"); |
108 | myNode->Value() = anItem; |
109 | } |
110 | |
111 | //======================================================================= |
112 | //function : Tail |
113 | //purpose : |
114 | //======================================================================= |
115 | |
116 | const TCollection_SList& TCollection_SList::Tail() const |
117 | { |
118 | if (!myNode.IsNull()) |
119 | return myNode->Tail(); |
120 | else |
121 | return *this; |
122 | } |
123 | |
124 | //======================================================================= |
125 | //function : ChangeTail |
126 | //purpose : |
127 | //======================================================================= |
128 | |
129 | TCollection_SList& TCollection_SList::ChangeTail() |
130 | { |
131 | if (!myNode.IsNull()) |
132 | return myNode->Tail(); |
133 | else |
134 | return *this; |
135 | } |
136 | |
137 | //======================================================================= |
138 | //function : SetTail |
139 | //purpose : |
140 | //======================================================================= |
141 | |
142 | void TCollection_SList::SetTail(const TCollection_SList& aList) |
143 | { |
144 | if (!myNode.IsNull()) |
145 | myNode->Tail() = aList; |
146 | else |
147 | Assign(aList); |
148 | } |