0025418: Debug output to be limited to OCC development environment
[occt.git] / src / TDataStd / TDataStd_RealList.cxx
1 // Created on: 2007-05-29
2 // Created by: Vlad Romashko
3 // Copyright (c) 2007-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <TDataStd_RealList.ixx>
17 #include <TColStd_ListIteratorOfListOfReal.hxx>
18
19 //=======================================================================
20 //function : GetID
21 //purpose  : 
22 //=======================================================================
23 const Standard_GUID& TDataStd_RealList::GetID() 
24
25   static Standard_GUID TDataStd_RealListID ("349ACE18-7CD6-4525-9938-FBBF22AA54D3");
26   return TDataStd_RealListID; 
27 }
28
29 //=======================================================================
30 //function : TDataStd_RealList
31 //purpose  : Empty Constructor
32 //=======================================================================
33 TDataStd_RealList::TDataStd_RealList() 
34 {
35
36 }
37
38 //=======================================================================
39 //function : Set
40 //purpose  : 
41 //=======================================================================
42 Handle(TDataStd_RealList) TDataStd_RealList::Set(const TDF_Label& label) 
43 {
44   Handle(TDataStd_RealList) A;
45   if (!label.FindAttribute (TDataStd_RealList::GetID(), A)) 
46   {
47     A = new TDataStd_RealList;
48     label.AddAttribute(A);
49   }
50   return A;
51 }
52
53 //=======================================================================
54 //function : IsEmpty
55 //purpose  : 
56 //=======================================================================
57 Standard_Boolean TDataStd_RealList::IsEmpty() const
58 {
59   return myList.IsEmpty();
60 }
61
62 //=======================================================================
63 //function : Extent
64 //purpose  : 
65 //=======================================================================
66 Standard_Integer TDataStd_RealList::Extent() const
67 {
68   return myList.Extent();
69 }
70
71 //=======================================================================
72 //function : Prepend
73 //purpose  : 
74 //=======================================================================
75 void TDataStd_RealList::Prepend(const Standard_Real value)
76 {
77   Backup();
78   myList.Prepend(value);
79 }
80
81 //=======================================================================
82 //function : Append
83 //purpose  : 
84 //=======================================================================
85 void TDataStd_RealList::Append(const Standard_Real value)
86 {
87   Backup();
88   myList.Append(value);
89 }
90
91 //=======================================================================
92 //function : InsertBefore
93 //purpose  : 
94 //=======================================================================
95 Standard_Boolean TDataStd_RealList::InsertBefore(const Standard_Real value,
96                                                  const Standard_Real before_value)
97 {
98   TColStd_ListIteratorOfListOfReal itr(myList);
99   for (; itr.More(); itr.Next())
100   {
101     if (itr.Value() == before_value)
102     {
103       Backup();
104       myList.InsertBefore(value, itr);
105       return Standard_True;
106     }
107   }
108   return Standard_False;
109 }
110
111 //=======================================================================
112 //function : InsertAfter
113 //purpose  : 
114 //=======================================================================
115 Standard_Boolean TDataStd_RealList::InsertAfter(const Standard_Real value,
116                                                 const Standard_Real after_value)
117 {
118   TColStd_ListIteratorOfListOfReal itr(myList);
119   for (; itr.More(); itr.Next())
120   {
121     if (itr.Value() == after_value)
122     {
123       Backup();
124       myList.InsertAfter(value, itr);
125       return Standard_True;
126     }
127   }
128   return Standard_False;
129 }
130
131 //=======================================================================
132 //function : Remove
133 //purpose  : 
134 //=======================================================================
135 Standard_Boolean TDataStd_RealList::Remove(const Standard_Real value)
136 {
137   TColStd_ListIteratorOfListOfReal itr(myList);
138   for (; itr.More(); itr.Next())
139   {
140     if (itr.Value() == value)
141     {
142       Backup();
143       myList.Remove(itr);
144       return Standard_True;
145     }
146   }
147   return Standard_False;
148 }
149
150 //=======================================================================
151 //function : Clear
152 //purpose  : 
153 //=======================================================================
154 void TDataStd_RealList::Clear()
155 {
156   Backup();
157   myList.Clear();
158 }
159
160 //=======================================================================
161 //function : First
162 //purpose  : 
163 //=======================================================================
164 Standard_Real TDataStd_RealList::First() const
165 {
166   return myList.First();
167 }
168
169 //=======================================================================
170 //function : Last
171 //purpose  : 
172 //=======================================================================
173 Standard_Real TDataStd_RealList::Last() const
174 {
175   return myList.Last();
176 }
177
178 //=======================================================================
179 //function : List
180 //purpose  : 
181 //=======================================================================
182 const TColStd_ListOfReal& TDataStd_RealList::List() const
183 {
184   return myList;
185 }
186
187 //=======================================================================
188 //function : ID
189 //purpose  : 
190 //=======================================================================
191 const Standard_GUID& TDataStd_RealList::ID () const 
192
193   return GetID(); 
194 }
195
196 //=======================================================================
197 //function : NewEmpty
198 //purpose  : 
199 //=======================================================================
200 Handle(TDF_Attribute) TDataStd_RealList::NewEmpty () const
201 {  
202   return new TDataStd_RealList(); 
203 }
204
205 //=======================================================================
206 //function : Restore
207 //purpose  : 
208 //=======================================================================
209 void TDataStd_RealList::Restore(const Handle(TDF_Attribute)& With) 
210 {
211   myList.Clear();
212   Handle(TDataStd_RealList) aList = Handle(TDataStd_RealList)::DownCast(With);
213   TColStd_ListIteratorOfListOfReal itr(aList->List());
214   for (; itr.More(); itr.Next())
215   {
216     myList.Append(itr.Value());
217   }
218 }
219
220 //=======================================================================
221 //function : Paste
222 //purpose  : 
223 //=======================================================================
224 void TDataStd_RealList::Paste (const Handle(TDF_Attribute)& Into,
225                                   const Handle(TDF_RelocationTable)& ) const
226 {
227   Handle(TDataStd_RealList) aList = Handle(TDataStd_RealList)::DownCast(Into);
228   aList->Clear();
229   TColStd_ListIteratorOfListOfReal itr(myList);
230   for (; itr.More(); itr.Next())
231   {
232     aList->Append(itr.Value());
233   }
234 }
235
236 //=======================================================================
237 //function : Dump
238 //purpose  : 
239 //=======================================================================
240 Standard_OStream& TDataStd_RealList::Dump (Standard_OStream& anOS) const
241 {  
242   anOS << "RealList";
243   return anOS;
244 }