20 #include "SheafSystem/filtered_depth_first_iterator.h" 21 #include "SheafSystem/poset_state_handle.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/subposet.h" 24 #include "SheafSystem/zn_to_bool.h" 40 ensure(
order() == NOT_AN_ORDER);
73 ensure(unexecutable(
this is
first member of iteration or
is_done()));
102 ensure(unexecutable(
this is
first member of iteration or
is_done()));
211 require(xorder != NOT_AN_ORDER);
234 ensure(
anchor().is_same_state(&xanchor));
237 ensure(
filter().is_attached());
239 ensure(
strict() == xstrict);
242 ensure(unexecutable(!
is_done() implies
this is
first member));
259 require(xorder != NOT_AN_ORDER);
282 ensure(
anchor().is_same_state(&xanchor));
285 ensure(
filter().is_attached());
287 ensure(
strict() == xstrict);
290 ensure(unexecutable(!
is_done() implies
this is
first member));
307 require(xorder != NOT_AN_ORDER);
330 ensure(
anchor().is_same_state(&xanchor));
333 ensure(
filter().is_attached());
334 ensure(
strict() == xstrict);
337 ensure(unexecutable(!
is_done() implies
this is
first member));
354 require(xorder != NOT_AN_ORDER);
377 ensure(
anchor().is_same_state(&xanchor));
380 ensure(
filter().is_attached());
381 ensure(
strict() == xstrict);
384 ensure(unexecutable(!
is_done() implies
this is
first member));
392 const std::string& xfilter_name,
402 require(xorder != NOT_AN_ORDER);
425 ensure(
anchor().is_same_state(&xanchor));
428 ensure(
filter().is_attached());
431 ensure(!xfilter_name.empty() ?
435 ensure(
strict() == xstrict);
438 ensure(unexecutable(!
is_done() implies
this is
first member));
454 require(xanchor != 0);
460 define_old_variable(
bool old_descending =
_descending);
461 define_old_variable(
bool old_strict =
_strict);
477 ensure(
anchor().is_same_state(xanchor));
482 ensure(
strict() == old_strict);
495 require(
anchor().state_is_read_accessible());
496 require(
anchor().host()->contains_member(xanchor_index));
500 define_old_variable(
bool old_descending =
_descending);
501 define_old_variable(
bool old_strict =
_strict);
503 define_old_variable(
int old_anchor_version =
anchor().version());
520 ensure(
anchor().version() == old_anchor_version);
523 ensure(
strict() == old_strict);
536 require(
anchor().state_is_read_accessible());
537 require(
anchor().host()->contains_member(xanchor_index));
541 define_old_variable(
bool old_descending =
_descending);
542 define_old_variable(
bool old_strict =
_strict);
544 define_old_variable(
int old_anchor_version =
anchor().version());
554 ensure(
anchor().version() == old_anchor_version);
557 ensure(
strict() == old_strict);
594 ensure(
strict() == xstrict);
609 require(
anchor().state_is_read_accessible());
610 require(
anchor().host()->includes_subposet(&xfilter));
614 define_old_variable(
bool old_descending =
_descending);
615 define_old_variable(
bool old_strict =
_strict);
630 ensure(
filter().is_same_state(&xfilter));
632 ensure(
strict() == old_strict);
646 require(
anchor().state_is_read_accessible());
651 define_old_variable(
bool old_descending =
_descending);
652 define_old_variable(
bool old_strict =
_strict);
671 ensure(!xfilter_name.empty() ?
675 ensure(
strict() == old_strict);
688 require(
anchor().state_is_read_accessible());
689 require(
anchor().host()->includes_subposet(xfilter_index));
693 define_old_variable(
bool old_descending =
_descending);
694 define_old_variable(
bool old_strict =
_strict);
712 ensure(
strict() == old_strict);
725 require(
anchor().state_is_read_accessible());
726 require(
anchor().host()->includes_subposet(xfilter_index));
730 define_old_variable(
bool old_descending =
_descending);
731 define_old_variable(
bool old_strict =
_strict);
742 ensure(
strict() == old_strict);
virtual bool has_name(const std::string &xname, bool xauto_access=false) const
True if xname is a name for this.
poset_state_handle * host() const
The poset which this is a handle to a component of.
virtual void force_is_done()
Force the iterator to be done.
A client handle for a subposet.
int version(bool xunalias=true) const
The (possibly aliased) version of this component. The version of the host used when evaluating proper...
virtual bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
void put_filter(const subposet &xfilter)
Sets the subposet which is the filter.
bool visit_once() const
True if traversal should only visit a member once; that is, it should not revisit members it has alre...
void initialize_order(order_type xorder)
Initializes _order and _transition_fcn.
pod_index_type version_index() const
The subposet index for the filter associated with version().
void initialize_filter()
Initializes the filter subposet from the client filter.
abstract_poset_member * _anchor
The top member of the down set being iterated over.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
virtual bool includes_subposet(pod_index_type xsubposet_hub_id, bool xauto_access=true) const
True if this poset includes subposet with hub id xsubposet_hub_id.
virtual bool anchor_is_ancestor_of(const abstract_poset_member &xmbr) const
True if xmbr conforms to the type of anchor of this.
order_type
The types of order in which the iterator will visit the members of the poset. Determines which action...
subposet _client_filter
The filter specified by the client.
void put_descending(bool xdescending)
Set descending() to xdescending.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
Abstract base class with useful features for all objects.
virtual abstract_poset_member & anchor()
The poset member whose downset is being iterated over; the top member of the domain of iteration (mut...
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.
bool descending() const
True if iterating over down set of anchor.
bool _new_filter
True if this allocated a new filter;.
depth_first_iterator & operator=(const depth_first_iterator &xother)
Assignment operator.
filtered_depth_first_iterator & operator=(const filtered_depth_first_iterator &xother)
Assignment operator.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
~filtered_depth_first_iterator()
Destructor.
bool is_done() const
True if iteration finished.
void first()
Moves this to the first member of the iteration.
bool _descending
True if iterating over the up/down set of anchor.
virtual void reset(bool xreset_markers=true)
Restarts the iteration over the down set of anchor().
bool invariant_check() const
True if invariant checking is enabled.
void initialize_traversal(const abstract_poset_member &xanchor)
Initializes the anchor, has_visited markers and filter.
int_type pod_index_type
The plain old data index type.
bool invariant() const
The class invariant.
bool invariant() const
The class invariant.
bool _strict
True if iterating over the strict up/down set of anchor.
virtual void put_anchor(const abstract_poset_member *xanchor)
Set anchor() to xanchor.
An abstract client handle for a member of a poset.
virtual filtered_depth_first_iterator * clone() const
Make a new instance of the same type as this.
subposet & filter()
The subposet which is the filter; Defines what is passed, not what is blocked.
bool is_same_type(const any *other) const
True if other is the same type as this.
void enable_invariant_check() const
Enable invariant checking.
void put_strict(bool xstrict)
Set strict() to xstrict.
bool strict() const
True if iterating over xstrict up/down set of anchor.
filtered_depth_first_iterator()
Default constructor; creates an unattached iterator, with and all-pass filter.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
const scoped_index & index() const
The index of the current member of the iteration.