SheafSystem  0.0.0.0
sheaf::poset_dof_iterator Class Reference

Iterates in postorder over dofs of a schema member anchor. Attaches a handle of type schema_poset_member to the current member of the iteration. More...

#include <poset_dof_iterator.h>

Inheritance diagram for sheaf::poset_dof_iterator:
sheaf::any fiber_bundle::section_dof_iterator fiber_bundle::section_dof_iterator fiber_bundle::binary_section_dof_iterator fiber_bundle::product_section_dof_iterator fiber_bundle::binary_section_dof_iterator fiber_bundle::product_section_dof_iterator

Public Types

enum  anchor_version_index { ANCHOR_VERSION = CURRENT_MEMBER_VERSION, ANCHOR_HOST_VERSION = CURRENT_HOST_VERSION }
 Identifiers for anchor version. More...
 

Public Member Functions

 poset_dof_iterator ()
 Default constructor; creates an unattached iterator, with and all-pass filter. More...
 
 poset_dof_iterator (const poset_dof_iterator &xother)
 Copy constructor. More...
 
virtual poset_dof_iteratoroperator= (const poset_dof_iterator &xother)
 Assignment operator. More...
 
virtual ~poset_dof_iterator ()
 Destructor. More...
 
virtual bool is_ancestor_of (const any *other) const
 True if other conforms to this. More...
 
virtual poset_dof_iteratorclone () const
 Make a new instance of the same type as this. More...
 
virtual bool invariant () const
 The class invariant. More...
 
 poset_dof_iterator (const schema_poset_member &xanchor, bool xis_table_dof=false, int xversion=ANCHOR_VERSION)
 Creates an iterator over the table dofs (is_table_dof true) or row dofs (xis_table_dof false) of version xversion in schema xanchor. "Explicit" prevents interpretation as conversion from schema_poset_member. More...
 
virtual bool is_initialized () const
 True if this has been initialized for iteration with respect to a specific anchor. More...
 
schema_poset_memberanchor ()
 The schema member whose downset is being iterated over; the top member of the domain of iteration (mutable version). More...
 
const schema_poset_memberanchor () const
 The schema member whose downset is being iterated over; the top member of the domain of iteration (const version). More...
 
virtual void put_anchor (const schema_poset_member *xanchor, int xversion)
 Set anchor() to xversion of *xanchor. Forces reset of markers, since the host may be different. More...
 
virtual void put_anchor (pod_index_type xindex)
 Set anchor() to the member with hub id xhub_id in host(). Does not change version; does not force reset of markers. More...
 
void put_anchor (const scoped_index &xid)
 Set anchor() to the member with id xid in host(). Does not change version; does not force reset of markers. More...
 
virtual bool is_done () const
 True if iteration finished. More...
 
virtual void force_is_done ()
 Force the iterator to be done. More...
 
virtual void next ()
 Makes this the next member of the subset. More...
 
virtual void reset (bool xreset_markers=RESET)
 Restarts the iteration over the down set of anchor() If xreset_markers, set !has_visited for all members. More...
 
virtual 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. More...
 
virtual bool has_visited (pod_index_type xhub_id) const
 True if this has already visited hub id xhub_id. More...
 
bool has_visited (const scoped_index &xindex) const
 True if this has already visited id xid. More...
 
virtual bool has_visited (const schema_poset_member &xmbr) const
 True if this has already visited xmbr. More...
 
virtual void put_has_visited (pod_index_type xhub_id, bool xvalue)
 Set the visisted marker for hub id xhub_id to xvalue. Intended for use reseting iterator without having to reset entire collection of markers. More...
 
void put_has_visited (const scoped_index &xid, bool xvalue)
 Set the visisted marker for id xid to xvalue. Intended for use reseting iterator without having to reset entire collection of markers. More...
 
schema_poset_memberitem ()
 The current member of the iteration (mutable version). More...
 
const schema_poset_memberitem () const
 The current member of the iteration (const version). More...
 
virtual bool item_is_ancestor_of (const schema_poset_member &xmbr) const
 True if xmbr conforms to the type of item of this. More...
 
virtual const scoped_indexindex ()
 The index of the current member of the iteration. More...
 
bool is_table_dof () const
 True if iterating over table dofs. More...
 
- Public Member Functions inherited from sheaf::any
bool is_same_type (const any *other) const
 True if other is the same type as this. More...
 
virtual ~any ()
 Destructor. More...
 
bool invariant_check () const
 True if invariant checking is enabled. More...
 
void enable_invariant_check () const
 Enable invariant checking. More...
 
void disable_invariant_check () const
 Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing invariant checking during multi-phase initialization. More...
 
int disable_invariance_check_request_depth () const
 Number of times disable_invariant_check has been called without matching call to enable_invariant_check. More...
 

Protected Member Functions

virtual void reset_item ()
 Creates item if needed and attaches it to the current index. More...
 
virtual void update_item ()
 Attaches the item handle to the current index, or detaches the item handle if is_done. More...
 
- Protected Member Functions inherited from sheaf::any
 any ()
 default constructor More...
 

Protected Attributes

schema_poset_member_anchor
 The schema member whose downset is being iterated over; the top member of the domain of iteration. More...
 
schema_poset_member_item
 The member handle for the current item in the iteration. More...
 
postorder_iterator _itr
 The index iterator used to implement the iteration. More...
 
bool _is_table_dof
 True if iterating over table dofs. More...
 

Detailed Description

Iterates in postorder over dofs of a schema member anchor. Attaches a handle of type schema_poset_member to the current member of the iteration.

Definition at line 35 of file poset_dof_iterator.h.

Member Enumeration Documentation

◆ anchor_version_index

Identifiers for anchor version.

Definition at line 84 of file poset_dof_iterator.h.

Constructor & Destructor Documentation

◆ poset_dof_iterator() [1/3]

sheaf::poset_dof_iterator::poset_dof_iterator ( )

Default constructor; creates an unattached iterator, with and all-pass filter.

Postcondition
  • !is_initialized()

Definition at line 31 of file poset_dof_iterator.cc.

Referenced by invariant().

◆ poset_dof_iterator() [2/3]

sheaf::poset_dof_iterator::poset_dof_iterator ( const poset_dof_iterator xother)

Copy constructor.

Precondition
  • is_ancestor_of(&xother)
Postcondition

Definition at line 55 of file poset_dof_iterator.cc.

References _anchor, _is_table_dof, _item, _itr, anchor(), sheaf::schema_poset_member::clone(), is_initialized(), is_table_dof(), item(), operator=(), and sheaf::poset_component::version().

◆ ~poset_dof_iterator()

sheaf::poset_dof_iterator::~poset_dof_iterator ( )
virtual

Destructor.

Definition at line 146 of file poset_dof_iterator.cc.

References is_ancestor_of().

Referenced by operator=().

◆ poset_dof_iterator() [3/3]

sheaf::poset_dof_iterator::poset_dof_iterator ( const schema_poset_member xanchor,
bool  xis_table_dof = false,
int  xversion = ANCHOR_VERSION 
)
explicit

Creates an iterator over the table dofs (is_table_dof true) or row dofs (xis_table_dof false) of version xversion in schema xanchor. "Explicit" prevents interpretation as conversion from schema_poset_member.

Precondition
  • item_is_ancestor_of(xanchor)
  • xanchor.state_is_read_accessible()
  • xanchor.has_version(xversion)
Postcondition
  • -unexecutable( postorder - have visited all children of this )
  • -unexecutable( !is_done() implies this is first member )
  • item().is_attached() == !is_done()
  • anchor().version() == xanchor.unaliased_version(xversion)

Definition at line 250 of file poset_dof_iterator.cc.

References sheaf::poset_component::has_version(), is_initialized(), sheaf::read_write_monitor_handle::state_is_read_accessible(), and sheaf::poset_component::unaliased_version().

Member Function Documentation

◆ anchor() [1/2]

sheaf::schema_poset_member & sheaf::poset_dof_iterator::anchor ( )

The schema member whose downset is being iterated over; the top member of the domain of iteration (mutable version).

Precondition

Definition at line 317 of file poset_dof_iterator.cc.

Referenced by is_initialized(), operator=(), fiber_bundle::section_dof_iterator::operator=(), fiber_bundle::binary_section_dof_iterator::operator=(), fiber_bundle::product_section_dof_iterator::operator=(), and poset_dof_iterator().

◆ anchor() [2/2]

const sheaf::schema_poset_member & sheaf::poset_dof_iterator::anchor ( ) const

The schema member whose downset is being iterated over; the top member of the domain of iteration (const version).

Precondition

Definition at line 338 of file poset_dof_iterator.cc.

References put_anchor().

◆ clone()

sheaf::poset_dof_iterator * sheaf::poset_dof_iterator::clone ( ) const
virtual

Make a new instance of the same type as this.

Postcondition
  • result != 0

Reimplemented from sheaf::any.

Reimplemented in fiber_bundle::binary_section_dof_iterator, fiber_bundle::product_section_dof_iterator, fiber_bundle::section_dof_iterator, and fiber_bundle::section_dof_iterator.

Definition at line 196 of file poset_dof_iterator.cc.

References invariant().

Referenced by is_ancestor_of().

◆ ct()

int sheaf::poset_dof_iterator::ct ( bool  xreset = false)
virtual

The number of members of the iteration set, from the current member to the end, inclusive. If xreset, reset before computing the count.

Precondition
  • xreset ? anchor().state_is_read_accessible(): true
Postcondition
  • result >= 0

Reimplemented in fiber_bundle::section_dof_iterator.

Definition at line 582 of file poset_dof_iterator.cc.

References has_visited().

Referenced by sheaf::arg_list::conforms_to_extension(), and reset().

◆ force_is_done()

void sheaf::poset_dof_iterator::force_is_done ( )
virtual

Force the iterator to be done.

Precondition
Postcondition

Reimplemented in fiber_bundle::section_dof_iterator.

Definition at line 506 of file poset_dof_iterator.cc.

References next().

Referenced by sheaf::arg_list::conforms_to(), sheaf::schema_poset_member::conforms_to(), sheaf::schema_poset_member::dof_tuple_type(), and is_done().

◆ has_visited() [1/3]

bool sheaf::poset_dof_iterator::has_visited ( pod_index_type  xhub_id) const
virtual

True if this has already visited hub id xhub_id.

Precondition
  • anchor().host()->contains_member(xhub_id)

Reimplemented in fiber_bundle::section_dof_iterator.

Definition at line 608 of file poset_dof_iterator.cc.

Referenced by ct(), and has_visited().

◆ has_visited() [2/3]

bool sheaf::poset_dof_iterator::has_visited ( const scoped_index xindex) const

True if this has already visited id xid.

Precondition

Definition at line 632 of file poset_dof_iterator.cc.

References has_visited(), and sheaf::scoped_index::hub_pod().

◆ has_visited() [3/3]

bool sheaf::poset_dof_iterator::has_visited ( const schema_poset_member xmbr) const
virtual

True if this has already visited xmbr.

Precondition
  • item_is_ancestor_of(xmbr)
  • xmbr.is_attached()
  • anchor().host()->is_same_state(xmbr.host())

Reimplemented in fiber_bundle::section_dof_iterator.

Definition at line 649 of file poset_dof_iterator.cc.

References sheaf::poset_component::host(), sheaf::poset_component::is_attached(), and put_has_visited().

◆ index()

◆ invariant()

bool sheaf::poset_dof_iterator::invariant ( ) const
virtual

The class invariant.

Invariant

Reimplemented from sheaf::any.

Reimplemented in fiber_bundle::binary_section_dof_iterator, fiber_bundle::product_section_dof_iterator, fiber_bundle::section_dof_iterator, and fiber_bundle::section_dof_iterator.

Definition at line 217 of file poset_dof_iterator.cc.

References poset_dof_iterator().

Referenced by clone().

◆ is_ancestor_of()

bool sheaf::poset_dof_iterator::is_ancestor_of ( const any other) const
virtual

True if other conforms to this.

Reimplemented from sheaf::any.

Reimplemented in fiber_bundle::binary_section_dof_iterator, fiber_bundle::product_section_dof_iterator, fiber_bundle::section_dof_iterator, and fiber_bundle::section_dof_iterator.

Definition at line 176 of file poset_dof_iterator.cc.

References clone().

Referenced by ~poset_dof_iterator().

◆ is_done()

◆ is_initialized()

bool sheaf::poset_dof_iterator::is_initialized ( ) const
virtual

True if this has been initialized for iteration with respect to a specific anchor.

Reimplemented in fiber_bundle::section_dof_iterator.

Definition at line 294 of file poset_dof_iterator.cc.

References anchor().

Referenced by operator=(), fiber_bundle::section_dof_iterator::operator=(), fiber_bundle::product_section_dof_iterator::operator=(), fiber_bundle::binary_section_dof_iterator::operator=(), and poset_dof_iterator().

◆ is_table_dof()

bool sheaf::poset_dof_iterator::is_table_dof ( ) const

◆ item() [1/2]

◆ item() [2/2]

const sheaf::schema_poset_member & sheaf::poset_dof_iterator::item ( ) const

The current member of the iteration (const version).

Precondition

Definition at line 746 of file poset_dof_iterator.cc.

References item_is_ancestor_of().

◆ item_is_ancestor_of()

bool sheaf::poset_dof_iterator::item_is_ancestor_of ( const schema_poset_member xmbr) const
virtual

True if xmbr conforms to the type of item of this.

Reimplemented in fiber_bundle::section_dof_iterator, fiber_bundle::binary_section_dof_iterator, fiber_bundle::product_section_dof_iterator, and fiber_bundle::section_dof_iterator.

Definition at line 769 of file poset_dof_iterator.cc.

References index().

Referenced by item().

◆ next()

◆ operator=()

sheaf::poset_dof_iterator & sheaf::poset_dof_iterator::operator= ( const poset_dof_iterator xother)
virtual

Assignment operator.

Precondition
  • is_ancestor_of(&xother)
  • xother.is_done()
Postcondition

Reimplemented in fiber_bundle::binary_section_dof_iterator, fiber_bundle::product_section_dof_iterator, fiber_bundle::section_dof_iterator, and fiber_bundle::section_dof_iterator.

Definition at line 96 of file poset_dof_iterator.cc.

References _item, anchor(), sheaf::abstract_poset_member::attach_to_state(), sheaf::schema_poset_member::clone(), is_done(), is_initialized(), is_table_dof(), item(), sheaf::poset_component::version(), and ~poset_dof_iterator().

Referenced by poset_dof_iterator().

◆ put_anchor() [1/3]

void sheaf::poset_dof_iterator::put_anchor ( const schema_poset_member xanchor,
int  xversion 
)
virtual

Set anchor() to xversion of *xanchor. Forces reset of markers, since the host may be different.

Precondition
  • xanchor != 0
  • item_is_ancestor_of(*xanchor)
  • xanchor->state_is_read_accessible()
  • xanchor->host()->is_schematized(false)
  • xanchor->has_version(xversion)
Postcondition
  • anchor().version() == xanchor->unaliased_version(xversion)

Reimplemented in fiber_bundle::section_dof_iterator.

Definition at line 359 of file poset_dof_iterator.cc.

References sheaf::abstract_poset_member::attach_to_state(), sheaf::schema_poset_member::clone(), sheaf::poset_component::has_version(), sheaf::poset_component::host(), sheaf::poset_state_handle::is_schematized(), sheaf::read_write_monitor_handle::state_is_read_accessible(), and sheaf::poset_component::unaliased_version().

Referenced by anchor(), and put_anchor().

◆ put_anchor() [2/3]

void sheaf::poset_dof_iterator::put_anchor ( pod_index_type  xindex)
virtual

Set anchor() to the member with hub id xhub_id in host(). Does not change version; does not force reset of markers.

Precondition
  • anchor().host()->contains_member(xhub_id)
Postcondition
  • anchor().version() == old_anchor_version

Definition at line 417 of file poset_dof_iterator.cc.

References put_anchor().

◆ put_anchor() [3/3]

void sheaf::poset_dof_iterator::put_anchor ( const scoped_index xid)

Set anchor() to the member with id xid in host(). Does not change version; does not force reset of markers.

Precondition
Postcondition
  • anchor().version() == old_anchor_version

Definition at line 458 of file poset_dof_iterator.cc.

References sheaf::scoped_index::hub_pod(), and is_done().

◆ put_has_visited() [1/2]

void sheaf::poset_dof_iterator::put_has_visited ( pod_index_type  xhub_id,
bool  xvalue 
)
virtual

Set the visisted marker for hub id xhub_id to xvalue. Intended for use reseting iterator without having to reset entire collection of markers.

Precondition
  • anchor().host()->contains_member(xhub_id)
Postcondition
  • has_visited(xhub_id) == xvalue

Reimplemented in fiber_bundle::section_dof_iterator.

Definition at line 675 of file poset_dof_iterator.cc.

Referenced by has_visited().

◆ put_has_visited() [2/2]

void sheaf::poset_dof_iterator::put_has_visited ( const scoped_index xid,
bool  xvalue 
)

Set the visisted marker for id xid to xvalue. Intended for use reseting iterator without having to reset entire collection of markers.

Precondition
Postcondition
  • has_visited(xid) == xvalue

Definition at line 699 of file poset_dof_iterator.cc.

References sheaf::scoped_index::hub_pod(), and item().

◆ reset()

void sheaf::poset_dof_iterator::reset ( bool  xreset_markers = RESET)
virtual

Restarts the iteration over the down set of anchor() If xreset_markers, set !has_visited for all members.

Precondition
Postcondition
  • item().is_attached() == !is_done()
  • anchor().version() == old_anchor_version

Reimplemented in fiber_bundle::section_dof_iterator.

Definition at line 554 of file poset_dof_iterator.cc.

References ct().

Referenced by sheaf::poset_table_state::invariant(), and next().

◆ reset_item()

void sheaf::poset_dof_iterator::reset_item ( )
protectedvirtual

Creates item if needed and attaches it to the current index.

Postcondition
  • item().is_attached() == !is_done()

Reimplemented in fiber_bundle::section_dof_iterator, fiber_bundle::binary_section_dof_iterator, fiber_bundle::product_section_dof_iterator, and fiber_bundle::section_dof_iterator.

Definition at line 833 of file poset_dof_iterator.cc.

References update_item().

Referenced by is_table_dof().

◆ update_item()

void sheaf::poset_dof_iterator::update_item ( )
protectedvirtual

Attaches the item handle to the current index, or detaches the item handle if is_done.

Precondition
Postcondition
  • item().is_attached() == !is_done()

Reimplemented in fiber_bundle::section_dof_iterator, and fiber_bundle::binary_section_dof_iterator.

Definition at line 861 of file poset_dof_iterator.cc.

Referenced by reset_item().

Member Data Documentation

◆ _anchor

schema_poset_member* sheaf::poset_dof_iterator::_anchor
protected

The schema member whose downset is being iterated over; the top member of the domain of iteration.

Definition at line 235 of file poset_dof_iterator.h.

Referenced by fiber_bundle::binary_section_dof_iterator::invariant(), fiber_bundle::product_section_dof_iterator::invariant(), poset_dof_iterator(), and fiber_bundle::product_section_dof_iterator::product_section_dof_iterator().

◆ _is_table_dof

bool sheaf::poset_dof_iterator::_is_table_dof
protected

◆ _item

◆ _itr

postorder_iterator sheaf::poset_dof_iterator::_itr
protected

The documentation for this class was generated from the following files: