SheafSystem  0.0.0.0
fiber_bundle::section_component_iterator Class Referenceabstract

Iterates in postorder over components of a section_space_schema_member anchor. The components of a section_space_schema_member m are those members m' <= m such that m'.base_space().is_same_state(m.base_space()) and m'.fiber_schema().is_component(). Attaches an a handle of type section_space_schema_member to the current member of the iteration. More...

#include <section_component_iterator.h>

Inheritance diagram for fiber_bundle::section_component_iterator:
sheaf::any fiber_bundle::binary_section_component_iterator

Public Member Functions

 section_component_iterator ()
 Default constructor; creates an unattached iterator, with and all-pass filter. More...
 
 section_component_iterator (const section_component_iterator &xother)
 Copy constructor. More...
 
virtual section_component_iteratoroperator= (const section_component_iterator &xother)
 Assignment operator. More...
 
virtual ~section_component_iterator ()
 Destructor. More...
 
virtual bool is_ancestor_of (const any *other) const
 True if other conforms to this. More...
 
virtual section_component_iteratorclone () const =0
 Make a new instance of the same type as this. More...
 
bool invariant () const
 The class invariant. More...
 
 section_component_iterator (const section_space_schema_member &xanchor)
 Creates an iterator anchored at xanchor. More...
 
bool is_initialized () const
 True if this has been initialized for iteration with respect to a specific anchor. More...
 
section_space_schema_memberanchor ()
 The schema member whose downset is being iterated over; the top member of the domain of iteration (mutable version). More...
 
const section_space_schema_memberanchor () const
 The schema member whose downset is being iterated over; the top member of the domain of iteration (const version). More...
 
void put_anchor (const section_space_schema_member *xanchor)
 Sets anchor to member xanchor. More...
 
bool is_done () const
 True if iteration finished. 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 &xid) const
 True if this has already visited id xid. More...
 
virtual bool has_visited (const section_space_schema_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 visited 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...
 
section_space_schema_memberitem ()
 The the current member of the iteration (mutable version). More...
 
const section_space_schema_memberitem () const
 The the current member of the iteration (const version). More...
 
virtual bool item_is_ancestor_of (const section_space_schema_member &xmbr) const
 True if xmbr conforms to the type of item of this. More...
 
virtual const scoped_indexindex () const
 The index of the current member of the iteration. 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_anchor (const section_space_schema_member &xanchor)
 Creates anchor if needed and attaches it to xanchor. Abstract in this class; intended to be redefined in descendants. More...
 
virtual void reset_item ()=0
 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

section_space_schema_member_anchor
 The schema member whose downset is being iterated over; the top member of the domain of iteration. More...
 
section_space_schema_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...
 

Detailed Description

Iterates in postorder over components of a section_space_schema_member anchor. The components of a section_space_schema_member m are those members m' <= m such that m'.base_space().is_same_state(m.base_space()) and m'.fiber_schema().is_component(). Attaches an a handle of type section_space_schema_member to the current member of the iteration.

Definition at line 59 of file section_component_iterator.h.

Constructor & Destructor Documentation

◆ section_component_iterator() [1/3]

fiber_bundle::section_component_iterator::section_component_iterator ( )

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

Postcondition
  • !is_initialized()

Definition at line 31 of file section_component_iterator.cc.

Referenced by invariant().

◆ section_component_iterator() [2/3]

fiber_bundle::section_component_iterator::section_component_iterator ( const section_component_iterator xother)

Copy constructor.

Precondition
  • is_ancestor_of(&xother)
Postcondition
  • -unexecutable( this is first member of iteration or is_done() )

Definition at line 54 of file section_component_iterator.cc.

References _anchor, _item, _itr, anchor(), fiber_bundle::section_space_schema_member::clone(), is_initialized(), item(), and operator=().

◆ ~section_component_iterator()

fiber_bundle::section_component_iterator::~section_component_iterator ( )
virtual

Destructor.

Definition at line 140 of file section_component_iterator.cc.

References is_ancestor_of().

Referenced by operator=().

◆ section_component_iterator() [3/3]

fiber_bundle::section_component_iterator::section_component_iterator ( const section_space_schema_member xanchor)
explicit

Creates an iterator anchored at xanchor.

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

Definition at line 223 of file section_component_iterator.cc.

References is_initialized(), and sheaf::read_write_monitor_handle::state_is_read_accessible().

Member Function Documentation

◆ anchor() [1/2]

fiber_bundle::section_space_schema_member & fiber_bundle::section_component_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 284 of file section_component_iterator.cc.

Referenced by is_initialized(), fiber_bundle::binary_section_component_iterator::operator=(), operator=(), and section_component_iterator().

◆ anchor() [2/2]

const fiber_bundle::section_space_schema_member & fiber_bundle::section_component_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 303 of file section_component_iterator.cc.

References is_done().

◆ clone()

virtual section_component_iterator* fiber_bundle::section_component_iterator::clone ( ) const
pure virtual

Make a new instance of the same type as this.

Reimplemented from sheaf::any.

Implemented in fiber_bundle::binary_section_component_iterator.

◆ ct()

int fiber_bundle::section_component_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

Definition at line 434 of file section_component_iterator.cc.

References has_visited().

Referenced by put_anchor().

◆ has_visited() [1/3]

bool fiber_bundle::section_component_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)

Definition at line 460 of file section_component_iterator.cc.

Referenced by ct(), and has_visited().

◆ has_visited() [2/3]

bool fiber_bundle::section_component_iterator::has_visited ( const scoped_index xid) const

True if this has already visited id xid.

Precondition

Definition at line 486 of file section_component_iterator.cc.

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

◆ has_visited() [3/3]

bool fiber_bundle::section_component_iterator::has_visited ( const section_space_schema_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())

Definition at line 504 of file section_component_iterator.cc.

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

◆ index()

const sheaf::scoped_index & fiber_bundle::section_component_iterator::index ( ) const
virtual

The index of the current member of the iteration.

Precondition
Postcondition

Definition at line 645 of file section_component_iterator.cc.

References reset_anchor().

Referenced by item_is_ancestor_of().

◆ invariant()

bool fiber_bundle::section_component_iterator::invariant ( ) const
virtual

The class invariant.

Reimplemented from sheaf::any.

Definition at line 190 of file section_component_iterator.cc.

References section_component_iterator().

Referenced by fiber_bundle::binary_section_component_iterator::invariant(), and is_ancestor_of().

◆ is_ancestor_of()

bool fiber_bundle::section_component_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_component_iterator.

Definition at line 170 of file section_component_iterator.cc.

References invariant().

Referenced by ~section_component_iterator().

◆ is_done()

◆ is_initialized()

◆ item() [1/2]

fiber_bundle::section_space_schema_member & fiber_bundle::section_component_iterator::item ( )

The the current member of the iteration (mutable version).

Precondition

Definition at line 583 of file section_component_iterator.cc.

Referenced by fiber_bundle::binary_section_component_iterator::operator=(), operator=(), put_has_visited(), and section_component_iterator().

◆ item() [2/2]

const fiber_bundle::section_space_schema_member & fiber_bundle::section_component_iterator::item ( ) const

The the current member of the iteration (const version).

Precondition

Definition at line 602 of file section_component_iterator.cc.

References item_is_ancestor_of().

◆ item_is_ancestor_of()

bool fiber_bundle::section_component_iterator::item_is_ancestor_of ( const section_space_schema_member xmbr) const
virtual

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

Reimplemented in fiber_bundle::binary_section_component_iterator.

Definition at line 623 of file section_component_iterator.cc.

References index().

Referenced by item().

◆ next()

void fiber_bundle::section_component_iterator::next ( )
virtual

Makes this the next member of the subset.

Precondition
  • !is_done()
Postcondition
  • !is_done() == item().is_attached()
  • -unexecutable( postorder - have visited all of the members of the strict down set of item() )

Definition at line 346 of file section_component_iterator.cc.

References reset().

Referenced by is_done().

◆ operator=()

fiber_bundle::section_component_iterator & fiber_bundle::section_component_iterator::operator= ( const section_component_iterator xother)
virtual

Assignment operator.

Precondition
  • is_ancestor_of(&xother)
Postcondition
  • -unexecutable( this is first member of iteration or is_done() )

Reimplemented in fiber_bundle::binary_section_component_iterator.

Definition at line 93 of file section_component_iterator.cc.

References _anchor, _item, _itr, anchor(), fiber_bundle::section_space_schema_member::attach_to_state(), fiber_bundle::section_space_schema_member::clone(), is_initialized(), item(), and ~section_component_iterator().

Referenced by section_component_iterator().

◆ put_anchor()

void fiber_bundle::section_component_iterator::put_anchor ( const section_space_schema_member xanchor)

Sets anchor to member xanchor.

Precondition
  • item_is_ancestor_of(*xanchor)
  • xanchor->state_is_read_accessible()
  • xanchor->host()->is_schematized(false)
Postcondition
  • item().is_attached() == !is_done()

Definition at line 399 of file section_component_iterator.cc.

References ct(), fiber_bundle::section_space_schema_member::fiber_schema(), fiber_bundle::section_space_schema_member::host(), fiber_bundle::section_space_schema_poset::is_schematized(), and sheaf::read_write_monitor_handle::state_is_read_accessible().

Referenced by fiber_bundle::binary_section_component_iterator::binary_section_component_iterator(), and reset().

◆ put_has_visited() [1/2]

void fiber_bundle::section_component_iterator::put_has_visited ( pod_index_type  xhub_id,
bool  xvalue 
)
virtual

Set the visited 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)
  • anchor().base_space_id() == anchor().host()->get_base_space_id_from_index(xhub_id)
Postcondition
  • has_visited(xhub_id) == xvalue

Definition at line 531 of file section_component_iterator.cc.

Referenced by has_visited().

◆ put_has_visited() [2/2]

void fiber_bundle::section_component_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
  • anchor().base_space_id() == anchor().host()->get_base_space_id_from_index(xid.hub_pod())
Postcondition
  • has_visited(xid) == xvalue

Definition at line 556 of file section_component_iterator.cc.

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

◆ reset()

void fiber_bundle::section_component_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()

Definition at line 374 of file section_component_iterator.cc.

References put_anchor().

Referenced by fiber_bundle::binary_section_component_iterator::binary_section_component_iterator(), and next().

◆ reset_anchor()

void fiber_bundle::section_component_iterator::reset_anchor ( const section_space_schema_member xanchor)
protectedvirtual

Creates anchor if needed and attaches it to xanchor. Abstract in this class; intended to be redefined in descendants.

Precondition
  • item_is_ancestor_of(xanchor)
  • xanchor.state_is_read_accessible()
Postcondition
  • _anchor != 0
  • _anchor->is_attached()
  • _anchor->is_same_state(&xanchor)
  • _anchor->is_same_type(&xanchor)

Definition at line 668 of file section_component_iterator.cc.

References fiber_bundle::section_space_schema_member::attach_to_state(), fiber_bundle::section_space_schema_member::clone(), sheaf::read_write_monitor_handle::state_is_read_accessible(), and update_item().

Referenced by index().

◆ reset_item()

virtual void fiber_bundle::section_component_iterator::reset_item ( )
protectedpure virtual

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

Implemented in fiber_bundle::binary_section_component_iterator.

◆ update_item()

void fiber_bundle::section_component_iterator::update_item ( )
protectedvirtual

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

Precondition
Issue:
resets host, which is unnecessary except when called from reset_item. Would be more efficient to just reset indices; avoids call to _item.init_handle_data_members
Postcondition
  • item().is_attached() == !is_done()

Definition at line 705 of file section_component_iterator.cc.

Referenced by reset_anchor(), and fiber_bundle::binary_section_component_iterator::reset_item().

Member Data Documentation

◆ _anchor

section_space_schema_member* fiber_bundle::section_component_iterator::_anchor
protected

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

Definition at line 226 of file section_component_iterator.h.

Referenced by fiber_bundle::binary_section_component_iterator::invariant(), operator=(), and section_component_iterator().

◆ _item

section_space_schema_member* fiber_bundle::section_component_iterator::_item
protected

The member handle for the current item in the iteration.

Definition at line 242 of file section_component_iterator.h.

Referenced by operator=(), fiber_bundle::binary_section_component_iterator::reset_item(), and section_component_iterator().

◆ _itr

postorder_iterator fiber_bundle::section_component_iterator::_itr
protected

The index iterator used to implement the iteration.

Definition at line 247 of file section_component_iterator.h.

Referenced by operator=(), and section_component_iterator().


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