42cf5bc1 |
1 | // Created on: 1993-02-26 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _TopLoc_SListOfItemLocation_HeaderFile |
18 | #define _TopLoc_SListOfItemLocation_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | class TopLoc_SListNodeOfItemLocation; |
26 | class Standard_NoSuchObject; |
27 | class TopLoc_ItemLocation; |
28 | |
29 | |
30 | //! An SListOfItemLocation is a LISP like list of Items. |
31 | //! An SListOfItemLocation is : |
32 | //! . Empty. |
33 | //! . Or it has a Value and a Tail which is an other SListOfItemLocation. |
34 | //! |
35 | //! The Tail of an empty list is an empty list. |
36 | //! SListOfItemLocation are shared. It means that they can be |
37 | //! modified through other lists. |
38 | //! SListOfItemLocation may be used as Iterators. They have Next, |
39 | //! More, and value methods. To iterate on the content |
40 | //! of the list S just do. |
41 | //! |
42 | //! SListOfItemLocation Iterator; |
43 | //! for (Iterator = S; Iterator.More(); Iterator.Next()) |
44 | //! X = Iterator.Value(); |
45 | class TopLoc_SListOfItemLocation |
46 | { |
47 | public: |
48 | |
49 | DEFINE_STANDARD_ALLOC |
50 | |
51 | |
52 | //! Creates an empty List. |
53 | TopLoc_SListOfItemLocation(); |
54 | |
55 | //! Creates a List with <anItem> as value and <aTail> as tail. |
56 | Standard_EXPORT TopLoc_SListOfItemLocation(const TopLoc_ItemLocation& anItem, const TopLoc_SListOfItemLocation& aTail); |
57 | |
58 | //! Creates a list from an other one. The lists are shared. |
59 | TopLoc_SListOfItemLocation(const TopLoc_SListOfItemLocation& Other); |
60 | |
61 | //! Sets a list from an other one. The lists are |
62 | //! shared. The list itself is returned. |
63 | Standard_EXPORT TopLoc_SListOfItemLocation& Assign (const TopLoc_SListOfItemLocation& Other); |
64 | TopLoc_SListOfItemLocation& operator = (const TopLoc_SListOfItemLocation& Other) |
65 | { |
66 | return Assign(Other); |
67 | } |
68 | |
69 | Standard_Boolean IsEmpty() const; |
70 | |
71 | //! Sets the list to be empty. |
72 | void Clear(); |
73 | ~TopLoc_SListOfItemLocation() |
74 | { |
75 | Clear(); |
76 | } |
77 | |
78 | //! Returns the current value of the list. An error is |
79 | //! raised if the list is empty. |
80 | Standard_EXPORT const TopLoc_ItemLocation& Value() const; |
81 | |
82 | //! Returns the current tail of the list. On an empty |
83 | //! list the tail is the list itself. |
84 | Standard_EXPORT const TopLoc_SListOfItemLocation& Tail() const; |
85 | |
86 | //! Replaces the list by a list with <anItem> as Value |
87 | //! and the list <me> as tail. |
88 | void Construct (const TopLoc_ItemLocation& anItem); |
89 | |
90 | //! Replaces the list <me> by its tail. |
91 | void ToTail(); |
92 | |
93 | //! Returns True if the iterator has a current value. |
94 | //! This is !IsEmpty() |
95 | Standard_Boolean More() const; |
96 | |
97 | //! Moves the iterator to the next object in the list. |
98 | //! If the iterator is empty it will stay empty. This is ToTail() |
99 | void Next(); |
100 | |
101 | |
102 | |
103 | |
104 | protected: |
105 | |
106 | |
107 | |
108 | |
109 | |
110 | private: |
111 | |
112 | |
113 | |
114 | Handle(TopLoc_SListNodeOfItemLocation) myNode; |
115 | |
116 | |
117 | }; |
118 | |
119 | |
120 | #include <TopLoc_SListOfItemLocation.lxx> |
121 | |
122 | |
123 | |
124 | |
125 | |
126 | #endif // _TopLoc_SListOfItemLocation_HeaderFile |