SheafSystem  0.0.0.0
biorder_iterator.cc
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // Implementation for class biorder_iterator
19 
20 #include "SheafSystem/biorder_iterator.h"
21 #include "SheafSystem/assert_contract.h"
22 
26 {
27 
28  // Preconditions:
29 
30  // Body:
31 
32  initialize_order(BIORDER);
33 
34  // Postconditions:
35 
36  ensure(invariant());
37  ensure(!is_initialized());
38 
39  // Exit
40 
41  return;
42 }
43 
47 {
48 
49  // Preconditions:
50 
51  // Body:
52 
53  // Postconditions:
54 
55  ensure(invariant());
56 
57  // Exit
58 
59  return;
60 }
61 
64 {
65  // Preconditions:
66 
67  // Body:
68 
69  // Postconditions:
70 
71 }
72 
73 
74 bool
76 is_ancestor_of(const any* xother) const
77 {
78  bool result;
79 
80  // Preconditions:
81 
82  // Body:
83 
84  result = dynamic_cast<const biorder_iterator*>(xother) != 0;
85 
86  // Postconditions:
87 
88  // Exit
89 
90  return result;
91 }
92 
95 clone() const
96 {
97  biorder_iterator* result;
98 
99  // Preconditions:
100 
101  // Body:
102 
103  result = new biorder_iterator;
104 
105  // Postconditions:
106 
107  ensure(result != 0);
108  ensure(!result->is_initialized());
109 
110  // Exit
111 
112  return result;
113 }
114 
115 bool
117 invariant() const
118 {
119  bool result = true;
120 
121  // Preconditions:
122 
123  // Body:
124 
126  invariance(order()==BIORDER);
127 
128  // Postconditions:
129 
130  // Exit
131 
132  return result;
133 }
134 
135 // OTHER CONSTRUCTORS
136 
137 
140  bool xdown,
141  bool xstrict)
142  : filtered_depth_first_iterator(xanchor, xdown, xstrict, BIORDER)
143 {
144 
145  // Preconditions:
146 
147  // Body:
148 
149  // Postconditions:
150 
151  ensure(invariant());
152 
153  // Exit:
154 
155  return;
156 }
157 
160  const subposet& xfilter,
161  bool xdown,
162  bool xstrict)
163  : filtered_depth_first_iterator(xanchor, xfilter, xdown, xstrict, BIORDER)
164 {
165 
166  // Preconditions:
167 
168  // Body:
169 
170  // Postconditions:
171 
172  ensure(invariant());
173 
174  // Exit:
175 
176  return;
177 }
178 
181  pod_index_type xfilter_index,
182  bool xdown,
183  bool xstrict)
184  : filtered_depth_first_iterator(xanchor, xfilter_index, xdown, xstrict, BIORDER)
185 {
186 
187  // Preconditions:
188 
189  // Body:
190 
191  // Postconditions:
192 
193  ensure(invariant());
194 
195  // Exit:
196 
197  return;
198 }
199 
202  const scoped_index& xfilter_index,
203  bool xdown,
204  bool xstrict)
205  : filtered_depth_first_iterator(xanchor, xfilter_index, xdown, xstrict, BIORDER)
206 {
207 
208  // Preconditions:
209 
210  // Body:
211 
212  // Postconditions:
213 
214  ensure(invariant());
215 
216  // Exit:
217 
218  return;
219 }
220 
223  const std::string& xfilter_name,
224  bool xdown,
225  bool xstrict)
226  : filtered_depth_first_iterator(xanchor, xfilter_name, xdown, xstrict, BIORDER)
227 {
228 
229  // Preconditions:
230 
231  // Body:
232 
233  // Postconditions:
234 
235  ensure(invariant());
236 
237  // Exit:
238 
239  return;
240 }
A client handle for a subposet.
Definition: subposet.h:86
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
virtual bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
biorder_iterator()
Default constructor; creates an unattached iterator, with and all-pass filter.
void initialize_order(order_type xorder)
Initializes _order and _transition_fcn.
~biorder_iterator()
Destructor.
Abstract base class with useful features for all objects.
Definition: any.h:39
order_type order() const
The order of the iteration. Determines which actions are exported to the client.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
Specialization of the filtered depth-first iterator which exposes the PREVISIT_ACTION and the POSTVIS...
bool invariant() const
The class invariant.
virtual biorder_iterator * clone() const
Make a new instance of the same type as this.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
An abstract client handle for a member of a poset.