SheafSystem  0.0.0.0
postorder_itr.impl.h
Go to the documentation of this file.
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 
20 
21 #ifndef POSTORDER_ITR_IMPL_H
22 #define POSTORDER_ITR_IMPL_H
23 
24 #ifndef POSTORDER_ITR_H
25 #include "SheafSystem/postorder_itr.h"
26 #endif
27 
28 #ifndef ASSERT_CONTRACT_H
29 #include "SheafSystem/assert_contract.h"
30 #endif
31 
32 
33 namespace sheaf
34 {
35 
36 // ===========================================================
37 // POSTORDER_ITR FACET
38 // ===========================================================
39 
40 // PUBLIC MEMBER FUNCTIONS
41 
42 template <typename T>
46 {
47  // Preconditions:
48 
49  // Body:
50 
52 
53  // Postconditions:
54 
55  ensure(invariant());
56  ensure(!this->is_initialized());
57 
58  // Exit
59 
60  return;
61 }
62 
63 template <typename T>
67 {
68 
69  // Preconditions:
70 
71  // Body:
72 
73  // Postconditions:
74 
75  ensure(invariant());
76 
77  // Exit
78 
79  return;
80 }
81 
82 template <typename T>
85 {
86  // Preconditions:
87 
88  // Body:
89 
90  // Postconditions:
91 
92 }
93 
94 // OTHER CONSTRUCTORS
95 
96 template <typename T>
99  bool xdown,
100  bool xstrict)
101  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xdown, xstrict, depth_first_itr<T>::POSTORDER)
102 {
103  // Preconditions:
104 
105  // Body:
106 
107  // Postconditions:
108 
109  ensure(invariant());
110 
111  // Exit:
112 
113  return;
114 }
115 
116 template <typename T>
119  const subposet& xfilter,
120  bool xdown,
121  bool xstrict)
122  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter, xdown, xstrict, depth_first_itr<T>::POSTORDER)
123 {
124  // Preconditions:
125 
126  // Body:
127 
128  // Postconditions:
129 
130  ensure(invariant());
131 
132  // Exit:
133 
134  return;
135 }
136 
137 template <typename T>
140  pod_index_type xfilter_index,
141  bool xdown,
142  bool xstrict)
143  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter_index, xdown, xstrict, depth_first_itr<T>::POSTORDER)
144 {
145  // Preconditions:
146 
147  // Body:
148 
149  // Postconditions:
150 
151  ensure(invariant());
152 
153  // Exit:
154 
155  return;
156 }
157 
158 template <typename T>
161  const scoped_index& xfilter_index,
162  bool xdown,
163  bool xstrict)
164  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter_index.hub_pod(), xdown, xstrict, depth_first_itr<T>::POSTORDER)
165 {
166  // Preconditions:
167 
168  // Body:
169 
170  // Postconditions:
171 
172  ensure(invariant());
173 
174  // Exit:
175 
176  return;
177 }
178 
179 template <typename T>
182  const std::string& xfilter_name,
183  bool xdown,
184  bool xstrict)
185  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter_name, xdown, xstrict, depth_first_itr<T>::POSTORDER)
186 {
187  // Preconditions:
188 
189  // Body:
190 
191  // Postconditions:
192 
193  ensure(invariant());
194 
195  // Exit:
196 
197  return;
198 }
199 
200 // PROTECTED MEMBER FUNCTIONS
201 
202 // PRIVATE MEMBER FUNCTIONS
203 
204 
205 // ===========================================================
206 // ANY FACET
207 // ===========================================================
208 
209 // PUBLIC MEMBER FUNCTIONS
210 
211 template <typename T>
212 bool
214 is_ancestor_of(const any* xother) const
215 {
216  bool result;
217 
218  // Preconditions:
219 
220  // Body:
221 
222  result = dynamic_cast<const postorder_itr*>(xother) != 0;
223 
224  // Postconditions:
225 
226  // Exit
227 
228  return result;
229 }
230 
231 template <typename T>
234 clone() const
235 {
236  postorder_itr* result;
237 
238  // Preconditions:
239 
240  // Body:
241 
242  result = new postorder_itr;
243 
244  // Postconditions:
245 
246  ensure(result != 0);
247  ensure(this->is_same_type(result));
248  ensure(!result->is_initialized());
249 
250  // Exit
251 
252  return result;
253 }
254 
255 template <typename T>
256 bool
258 invariant() const
259 {
260  bool result = true;
261 
262  // Preconditions:
263 
264  // Body:
265 
267  invariance(this->order() == depth_first_itr<T>::POSTORDER);
268 
269  // Postconditions:
270 
271  // Exit
272 
273  return result;
274 }
275 
276 // PROTECTED MEMBER FUNCTIONS
277 
278 // PRIVATE MEMBER FUNCTIONS
279 
280 
281 } // namespace sheaf
282 
283 #endif // ifndef POSTORDER_ITR_IMPL_H
A client handle for a subposet.
Definition: subposet.h:86
void initialize_order(order_type xorder)
Initializes _order and _transition_fcn.
virtual postorder_itr * clone() const
Make a new instance of the same type as this.
order_type order() const
The order of the iteration. Determines which actions are exported to the client.
The general depth-first iterator over the intersection of a subposet filter with a directional (up or...
Specialization of the filtered depth-first iterator which exposes the POSTVISIT_ACTION to the client...
Definition: postorder_itr.h:40
~postorder_itr()
Destructor.
Abstract base class with useful features for all objects.
Definition: any.h:39
The general depth-first iterator over the intersection of a poset member anchor&#39;s whole with its down...
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
bool invariant() const
The class invariant.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
Namespace for the sheaves component of the sheaf system.
postorder_itr()
Default constructor; creates an unattached iterator, with and all-pass filter.
An abstract client handle for a member of a poset.
virtual bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
bool is_same_type(const any *other) const
True if other is the same type as this.
Definition: any.cc:79