22 #include "SheafSystem/filtered_depth_first_member_iterator.h" 24 #include "SheafSystem/poset_state_handle.h" 25 #include "SheafSystem/assert_contract.h" 26 #include "SheafSystem/total_poset_member.h" 36 sheaf::filtered_depth_first_member_iterator::
58 ensure(unexecutable(
this is first member of iteration or
is_done()));
100 ensure(unexecutable(
this is first member of iteration or
is_done()));
165 invariance(
_item != 0 );
281 define_old_variable(
bool old_descending =
descending());
282 define_old_variable(
bool old_strict =
strict());
294 ensure(
anchor().is_same_state(xanchor));
299 ensure(
strict() == old_strict);
325 ensure(
anchor().index() == xanchor_hub_id);
348 ensure(
anchor().index() ==~ xanchor_id);
380 require(
anchor().host()->includes_subposet(&xfilter));
384 define_old_variable(
bool old_descending =
descending());
385 define_old_variable(
bool old_strict =
strict());
397 ensure(
filter().is_same_state(&xfilter));
399 ensure(
strict() == old_strict);
415 define_old_variable(
bool old_descending =
descending());
416 define_old_variable(
bool old_strict =
strict());
428 ensure(!xfilter_name.empty() ?
432 ensure(
strict() == old_strict);
444 require(
anchor().host()->includes_subposet(xfilter_hub_id));
448 define_old_variable(
bool old_descending =
descending());
449 define_old_variable(
bool old_strict =
strict());
461 ensure(
filter().index() == xfilter_hub_id);
463 ensure(
strict() == old_strict);
475 require(
anchor().host()->includes_subposet(xfilter_id));
479 define_old_variable(
bool old_descending =
descending());
480 define_old_variable(
bool old_strict =
strict());
489 ensure(
filter().index() ==~ xfilter_id);
491 ensure(
strict() == old_strict);
567 ensure(
strict() == xstrict);
632 require(
anchor().state_is_read_accessible());
636 define_old_variable(
int old_anchor_version =
anchor().version());
637 define_old_variable(
bool old_descending =
descending());
638 define_old_variable(
bool old_strict =
strict());
647 ensure(
anchor().version() == old_anchor_version);
648 ensure(
filter().is_attached());
650 ensure(
strict() == old_strict);
668 require(xreset ?
anchor().state_is_read_accessible():
true);
694 require(
anchor().state_is_read_accessible());
695 require(
anchor().host()->contains_member(xhub_id));
717 require(
anchor().state_is_read_accessible());
718 require(
anchor().host()->contains_member(xid));
734 require(
anchor().state_is_read_accessible());
736 require(
anchor().host()->is_same_state(xmbr.
host()));
757 require(
anchor().state_is_read_accessible());
758 require(
anchor().host()->contains_member(xhub_id));
781 require(
anchor().state_is_read_accessible());
782 require(
anchor().host()->contains_member(xid));
830 ensure(result ==
item().index());
930 sheaf::filtered_depth_first_member_iterator::
949 ensure(
_item == xitem);
986 sheaf::filtered_depth_first_member_iterator::
987 filtered_depth_first_member_iterator()
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
const scoped_index & lesser_index() const
The index of the lesser member of the current link lesser_index() == index()
const scoped_index & greater_index() const
The index of the greater member of the current link.
virtual abstract_poset_member & anchor()
The poset member whose downset is being iterated over; the top member of the domain of iteration (mut...
poset_state_handle * host() const
The poset which this is a handle to a component of.
A client handle for a subposet.
bool invariant() const
The class invariant.
abstract_poset_member & item()
The the current member of the iteration (mutable version).
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.
filtered_depth_first_iterator * _iterator
The index iterator used to implement the iteration.
virtual ~filtered_depth_first_member_iterator()
Destructor.
virtual void reset(bool xreset_markers=RESET)
Restarts the iteration.
depth_first_iterator::order_type order()
Iteration directions.
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.
void put_strict(bool xstrict)
Set strict() to xstrict.
virtual void update_item()
Attaches the item handle to the current index, or detaches the item handle if is_done.
virtual filtered_depth_first_member_iterator & operator=(const filtered_depth_first_member_iterator &xother)
Assignment operator.
order_type
The types of order in which the iterator will visit the members of the poset. Determines which action...
virtual bool item_is_ancestor_of(const abstract_poset_member &xmbr) const
True if xmbr conforms to the type of item of this.
void put_descending(bool xdescending)
Set descending() to xdescending.
Abstract base class with useful features for all objects.
bool is_done() const
True if iteration finished.
bool has_visited(pod_index_type xhub_id) const
True if this has already visited member with hub id xhub_id.
bool descending() const
True if iterating over down set of anchor.
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.
virtual bool is_attached() const
True if this handle is attached to a non-void state.
const subposet & filter() const
The subposet which is the filter; Defines what is passed, not what is blocked.
bool descending() const
True if iterating over down set of anchor.
bool has_visited(pod_index_type xhub_id) const
True if this has already visited member with hub id xhub_id.
void next()
Makes this the next member of the subset.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
const scoped_index & lesser_index() const
The index of the lesser member of the current link.
const scoped_index & greater_index() const
The index of the greater member of the current link.
abstract_poset_member * clone(bool xnew_state, bool xauto_access=true) const
Virtual constructor; makes a new handle of the same type as this, attached to a new state (xnew_state...
abstract_poset_member * _item
The member handle for the current item in the iteration.
virtual bool anchor_is_ancestor_of(const abstract_poset_member &xmbr) const
True if xmbr conforms to the type of anchor of this.
virtual void put_anchor(const abstract_poset_member *xanchor)
Set anchor() to *xanchor.
bool is_done() const
True if iteration finished.
bool strict() const
True if iterating over xstrict up/down set of anchor.
virtual void detach_from_state()
Detach this handle from its state, if any.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
void put_has_visited(pod_index_type xhub_id, bool xvalue)
Set the visited marker for hub id xhub_id to xvalue. Intended for use reseting iterator without havin...
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.
virtual void next()
Makes this the next member of the iteration.
int ct(bool xreset=false)
The number of members of the iteration set, from the current member to the end, inclusive. If xreset, reset before computing the count.
int_type pod_index_type
The plain old data index type.
int ct(bool xreset=false)
The number of members of the iteration set, from the current member to the end, inclusive. If xreset, reset before computing the count.
virtual void put_anchor(const abstract_poset_member *xanchor)
Set anchor() to xanchor.
void attach_to_state(const namespace_poset *xns, const poset_path &xpath, bool xauto_access=true)
Attach to the state specified by path xpath in the namespace xns.
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.
void put_descending(bool xdescending)
Set descending() to xdescending.
subposet & filter()
The subposet which is the filter; Defines what is passed, not what is blocked.
std::string version_name() const
The subposet name for the filter associated with version().
bool is_same_type(const any *other) const
True if other is the same type as this.
void put_filter(const subposet &filter)
Sets the subposet which is the filter.
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.
bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
void put_has_visited(pod_index_type xhub_id, bool xvalue)
Set the visited marker for hub id xhub_id to xvalue. Intended for use reseting iterator without havin...
const scoped_index & index() const
The index of the current member of the iteration.