SheafSystem  0.0.0.0
triorder_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 TRIORDER_ITR_IMPL_H
22 #define TRIORDER_ITR_IMPL_H
23 
24 #ifndef TRIORDER_ITR_H
25 #include "SheafSystem/triorder_itr.h"
26 #endif
27 
28 #ifndef ASSERT_CONTRACT_H
29 #include "SheafSystem/assert_contract.h"
30 #endif
31 
32 namespace sheaf
33 {
34 
35 // ===========================================================
36 // TRIORDER_ITR FACET
37 // ===========================================================
38 
39 // PUBLIC MEMBER FUNCTIONS
40 
41 template <typename T>
45 {
46  // Preconditions:
47 
48  // Body:
49 
51 
52  // Postconditions:
53 
54  ensure(invariant());
55  ensure(!this->is_initialized());
56 
57  // Exit
58 
59  return;
60 }
61 
62 template <typename T>
64 triorder_itr(const triorder_itr& xother)
66 {
67  // Preconditions:
68 
69  // Body:
70 
71  // Postconditions:
72 
73  ensure(invariant());
74 
75  // Exit
76 
77  return;
78 }
79 
80 template <typename T>
83 {
84  // Preconditions:
85 
86  // Body:
87 
88  // Postconditions:
89 
90 }
91 
92 // OTHER CONSTRUCTORS
93 
94 template <typename T>
97  bool xdown,
98  bool xstrict)
99  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xdown, xstrict, depth_first_itr<T>::TRIORDER)
100 {
101  // Preconditions:
102 
103  // Body:
104 
105  // Postconditions:
106 
107  ensure(invariant());
108 
109  // Exit:
110 
111  return;
112 }
113 
114 template <typename T>
117  const subposet& xfilter,
118  bool xdown,
119  bool xstrict)
120  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter, xdown, xstrict, depth_first_itr<T>::TRIORDER)
121 {
122  // Preconditions:
123 
124  // Body:
125 
126  // Postconditions:
127 
128  ensure(invariant());
129 
130  // Exit:
131 
132  return;
133 }
134 
135 template <typename T>
138  pod_index_type xfilter_index,
139  bool xdown,
140  bool xstrict)
141  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter_index, xdown, xstrict, depth_first_itr<T>::TRIORDER)
142 {
143  // Preconditions:
144 
145  // Body:
146 
147  // Postconditions:
148 
149  ensure(invariant());
150 
151  // Exit:
152 
153  return;
154 }
155 
156 template <typename T>
159  const scoped_index& xfilter_index,
160  bool xdown,
161  bool xstrict)
162  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter_index.hub_pod(), xdown, xstrict, depth_first_itr<T>::TRIORDER)
163 {
164  // Preconditions:
165 
166  // Body:
167 
168  // Postconditions:
169 
170  ensure(invariant());
171 
172  // Exit:
173 
174  return;
175 }
176 
177 template <typename T>
180  const std::string& xfilter_name,
181  bool xdown,
182  bool xstrict)
183  :filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter_name, xdown, xstrict, depth_first_itr<T>::TRIORDER)
184 {
185  // Preconditions:
186 
187  // Body:
188 
189  // Postconditions:
190 
191  ensure(invariant());
192 
193  // Exit:
194 
195  return;
196 }
197 
198 // PROTECTED MEMBER FUNCTIONS
199 
200 // PRIVATE MEMBER FUNCTIONS
201 
202 
203 // ===========================================================
204 // ANY FACET
205 // ===========================================================
206 
207 // PUBLIC MEMBER FUNCTIONS
208 
209 template <typename T>
210 bool
212 is_ancestor_of(const any* xother) const
213 {
214  bool result;
215 
216  // Preconditions:
217 
218  // Body:
219 
220  result = dynamic_cast<const triorder_itr*>(xother) != 0;
221 
222  // Postconditions:
223 
224  // Exit
225 
226  return result;
227 }
228 
229 template <typename T>
232 clone() const
233 {
234  triorder_itr* result;
235 
236  // Preconditions:
237 
238  // Body:
239 
240  result = new triorder_itr;
241 
242  // Postconditions:
243 
244  ensure(result != 0);
245  ensure(this->is_same_type(result));
246  ensure(!result->is_initialized());
247 
248  // Exit
249 
250  return result;
251 }
252 
253 template <typename T>
254 bool
256 invariant() const
257 {
258  bool result = true;
259 
260  // Preconditions:
261 
262  // Body:
263 
265  invariance(this->order() == depth_first_itr<T>::TRIORDER);
266 
267  // Postconditions:
268 
269  // Exit
270 
271  return result;
272 }
273 
274 // PROTECTED MEMBER FUNCTIONS
275 
276 // PRIVATE MEMBER FUNCTIONS
277 
278 
279 } // namespace sheaf
280 
281 #endif // ifndef PREORDER_ITR_IMPL_H
A client handle for a subposet.
Definition: subposet.h:86
void initialize_order(order_type xorder)
Initializes _order and _transition_fcn.
bool invariant() const
The class invariant.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to 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...
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...
Specialization of the filtered depth-first iterator which exposes all three actions to the client; th...
Definition: triorder_itr.h:42
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual triorder_itr * 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
Namespace for the sheaves component of the sheaf system.
~triorder_itr()
Destructor.
An abstract client handle for a member of a poset.
triorder_itr()
Default constructor; creates an unattached iterator, with and all-pass filter.
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