SheafSystem  0.0.0.0
linkorder_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 LINKORDER_ITR_IMPL_H
22 #define LINKORDER_ITR_IMPL_H
23 
24 #ifndef LINKORDER_ITR_H
25 #include "SheafSystem/linkorder_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 // LINKORDER_ITR FACET
38 // ===========================================================
39 
40 // PUBLIC MEMBER FUNCTIONS
41 
42 template <typename T>
46 {
47 
48  // Preconditions:
49 
50  // Body:
51 
53 
54  // Postconditions:
55 
56  ensure(invariant());
57  ensure(!this->is_initialized());
58 
59  // Exit
60 
61  return;
62 }
63 
64 template <typename T>
68 {
69 
70  // Preconditions:
71 
72  // Body:
73 
74  // Postconditions:
75 
76  ensure(invariant());
77 
78  // Exit
79 
80  return;
81 }
82 
83 template <typename T>
86 {
87  // Preconditions:
88 
89  // Body:
90 
91  // Postconditions:
92 
93 }
94 
95 // OTHER CONSTRUCTORS
96 
97 template <typename T>
100  bool xdown,
101  bool xstrict)
102  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xdown, xstrict, depth_first_itr<T>::LINKORDER)
103 {
104  // Preconditions:
105 
106  // Body:
107 
108  // Postconditions:
109 
110  ensure(invariant());
111 
112  // Exit:
113 
114  return;
115 }
116 
117 template <typename T>
120  const subposet& xfilter,
121  bool xdown,
122  bool xstrict)
123  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter, xdown, xstrict, depth_first_itr<T>::LINKORDER)
124 {
125  // Preconditions:
126 
127  // Body:
128 
129  // Postconditions:
130 
131  ensure(invariant());
132 
133  // Exit:
134 
135  return;
136 }
137 
138 template <typename T>
141  pod_index_type xfilter_index,
142  bool xdown,
143  bool xstrict)
144  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter_index, xdown, xstrict, depth_first_itr<T>::LINKORDER)
145 {
146  // Preconditions:
147 
148  // Body:
149 
150  // Postconditions:
151 
152  ensure(invariant());
153 
154  // Exit:
155 
156  return;
157 }
158 
159 template <typename T>
162  const scoped_index& xfilter_index,
163  bool xdown,
164  bool xstrict)
165  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter_index.hub_pod(), xdown, xstrict, depth_first_itr<T>::LINKORDER)
166 {
167  // Preconditions:
168 
169  // Body:
170 
171  // Postconditions:
172 
173  ensure(invariant());
174 
175  // Exit:
176 
177  return;
178 }
179 
180 template <typename T>
183  const std::string& xfilter_name,
184  bool xdown,
185  bool xstrict)
186  : filtered_depth_first_itr<T>::filtered_depth_first_itr(xanchor, xfilter_name, xdown, xstrict, depth_first_itr<T>::LINKORDER)
187 {
188  // Preconditions:
189 
190  // Body:
191 
192  // Postconditions:
193 
194  ensure(invariant());
195 
196  // Exit:
197 
198  return;
199 }
200 
201 // PROTECTED MEMBER FUNCTIONS
202 
203 // PRIVATE MEMBER FUNCTIONS
204 
205 
206 // ===========================================================
207 // ANY FACET
208 // ===========================================================
209 
210 // PUBLIC MEMBER FUNCTIONS
211 
212 template <typename T>
213 bool
215 is_ancestor_of(const any* xother) const
216 {
217  bool result;
218 
219  // Preconditions:
220 
221  // Body:
222 
223  result = dynamic_cast<const linkorder_itr*>(xother) != 0;
224 
225  // Postconditions:
226 
227  // Exit
228 
229  return result;
230 }
231 
232 template <typename T>
235 clone() const
236 {
237  linkorder_itr* result;
238 
239  // Preconditions:
240 
241  // Body:
242 
243  result = new linkorder_itr;
244 
245  // Postconditions:
246 
247  ensure(result != 0);
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>::LINKORDER);
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 LINKORDER_ITR_IMPL_H
A client handle for a subposet.
Definition: subposet.h:86
void initialize_order(order_type xorder)
Initializes _order and _transition_fcn.
~linkorder_itr()
Destructor.
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...
virtual linkorder_itr * clone() const
Make a new instance of the same type as this.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
bool invariant() const
The class invariant.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
Specialization of the general depth-first iterator which exposes the LINK_ACTION to the client...
Definition: linkorder_itr.h:40
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.
linkorder_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.