SheafSystem  0.0.0.0
sheaf::poset_traverser Class Referenceabstract

Abstract traverser (internal iterator) for poset. More...

#include <poset_traverser.h>

Inheritance diagram for sheaf::poset_traverser:
sheaf::any sheaf::poset_dft sheaf::poset_orderer sheaf::poset_slicer

Public Member Functions

 poset_traverser (const poset_state_handle *xanchor)
 Constructor. More...
 
 ~poset_traverser ()
 Destructor. More...
 
virtual bool invariant () const
 Class invariant. More...
 
poset_state_handlehost ()
 The poset being traversed (mutable version). More...
 
const poset_state_handlehost () const
 The poset being traversed (const version). More...
 
bool has_same_host (const poset_component *other) const
 True if other is not void and is attached to the same host as this. More...
 
virtual abstract_poset_memberanchor ()
 The member which is the starting point of this traversal (mutable verison). More...
 
virtual const abstract_poset_memberanchor () const
 The member which is the starting point of this traversal (const version). More...
 
bool in_down_set () const
 True if traversing down from anchor(). More...
 
void traverse (const abstract_poset_member *xanchor, bool down, bool reset_markers=true)
 Traverse the down set (down == true) or up set (down == false) of xanchor. If reset_markers, reset all visited markers to false before begining. More...
 
- Public Member Functions inherited from sheaf::any
virtual bool is_ancestor_of (const any *other) const
 True if other conforms to this. More...
 
bool is_same_type (const any *other) const
 True if other is the same type as this. More...
 
virtual anyclone () const
 Virtual constructor, makes a new instance of 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

bool has_been_visited (const abstract_poset_member *xmbr) const
 True if xmbr has been previously visited. More...
 
bool has_been_visited (int xindex) const
 True if the member with index xindex has been previously visited. More...
 
scoped_index member_index_ub () const
 The upper bound on the member index. More...
 
bool no_members_visited () const
 True if no members have been visited. More...
 
bool all_members_visited () const
 True if all members have been visited. More...
 
void mark_members_not_visited ()
 Sets the visited markers false for all members. More...
 
void mark_visited (const abstract_poset_member *xmbr)
 Sets the visited marker true for xmbr. More...
 
void mark_visited (int xindex)
 Sets the visited markers true for the emebr with index xindex. More...
 
void mark_not_visited (int xindex)
 Sets the visited markers false for the emebr with index xindex. More...
 
virtual void private_traverse ()=0
 Implements the traversal. More...
 
void ensure_visited_ub ()
 Ensures the visited bit vector is large enough. More...
 
- Protected Member Functions inherited from sheaf::any
 any ()
 default constructor More...
 

Protected Attributes

poset_state_handle_host
 The poset being traversed. More...
 
zn_to_bool_visited
 The markers for previously visited members. More...
 
abstract_poset_member_anchor
 The member which is the starting point of this traversal. More...
 
bool _in_down_set
 True if traversing down from anchor(). More...
 

Detailed Description

Abstract traverser (internal iterator) for poset.

Definition at line 49 of file poset_traverser.h.

Constructor & Destructor Documentation

◆ poset_traverser()

sheaf::poset_traverser::poset_traverser ( const poset_state_handle xanchor)

Constructor.

Todo:
properly redefine features from any
Precondition
  • xhost != 0
  • xhost->state_is_read_accessible()
Postcondition

Definition at line 130 of file poset_traverser.cc.

References _anchor, _host, _in_down_set, _visited, invariant(), member_index_ub(), sheaf::read_write_monitor_handle::state_is_read_accessible(), and ~poset_traverser().

Referenced by anchor().

◆ ~poset_traverser()

sheaf::poset_traverser::~poset_traverser ( )

Destructor.

Definition at line 153 of file poset_traverser.cc.

References _visited, and traverse().

Referenced by poset_traverser().

Member Function Documentation

◆ all_members_visited()

bool sheaf::poset_traverser::all_members_visited ( ) const
protected

True if all members have been visited.

Postcondition
  • -unexecutable( result if and only if every member is marked visited )

Definition at line 273 of file poset_traverser.cc.

References _host, sheaf::index_iterator::index(), sheaf::index_iterator::is_done(), mark_members_not_visited(), sheaf::poset_state_handle::member_iterator(), sheaf::index_iterator::next(), and sheaf::scoped_index::pod().

Referenced by no_members_visited().

◆ anchor() [1/2]

sheaf::abstract_poset_member * sheaf::poset_traverser::anchor ( )
virtual

The member which is the starting point of this traversal (mutable verison).

Definition at line 89 of file poset_traverser.cc.

References _anchor.

Referenced by has_same_host(), sheaf::poset_dft::private_traverse(), and traverse().

◆ anchor() [2/2]

const sheaf::abstract_poset_member * sheaf::poset_traverser::anchor ( ) const
virtual

The member which is the starting point of this traversal (const version).

Definition at line 111 of file poset_traverser.cc.

References _anchor, and poset_traverser().

◆ ensure_visited_ub()

void sheaf::poset_traverser::ensure_visited_ub ( )
inlineprotected

Ensures the visited bit vector is large enough.

Definition at line 208 of file poset_traverser.h.

References sheaf::zn_to_bool::extend_to(), sheaf::scoped_index::pod(), and sheaf::zn_to_bool::ub().

Referenced by sheaf::poset_dft::recursive_dft(), and traverse().

◆ has_been_visited() [1/2]

bool sheaf::poset_traverser::has_been_visited ( const abstract_poset_member xmbr) const
protected

◆ has_been_visited() [2/2]

bool sheaf::poset_traverser::has_been_visited ( int  xindex) const
inlineprotected

True if the member with index xindex has been previously visited.

Definition at line 154 of file poset_traverser.h.

◆ has_same_host()

◆ host() [1/2]

◆ host() [2/2]

const poset_state_handle* sheaf::poset_traverser::host ( ) const
inline

The poset being traversed (const version).

Definition at line 86 of file poset_traverser.h.

◆ in_down_set()

bool sheaf::poset_traverser::in_down_set ( ) const
inline

True if traversing down from anchor().

Definition at line 111 of file poset_traverser.h.

◆ invariant()

◆ mark_members_not_visited()

void sheaf::poset_traverser::mark_members_not_visited ( )
protected

◆ mark_not_visited()

void sheaf::poset_traverser::mark_not_visited ( int  xindex)
inlineprotected

Sets the visited markers false for the emebr with index xindex.

Definition at line 195 of file poset_traverser.h.

References sheaf::zn_to_bool::force().

◆ mark_visited() [1/2]

void sheaf::poset_traverser::mark_visited ( const abstract_poset_member xmbr)
protected

Sets the visited marker true for xmbr.

Precondition
  • xmbr != 0
  • xmbr->is_attached()
Postcondition
  • has_been_visited(xmbr)

Definition at line 329 of file poset_traverser.cc.

References _anchor, _visited, sheaf::zn_to_bool::force(), has_been_visited(), sheaf::poset_component::host(), sheaf::poset_component::index(), sheaf::poset_component::is_attached(), and sheaf::scoped_index::pod().

Referenced by mark_members_not_visited(), and sheaf::poset_dft::recursive_dft().

◆ mark_visited() [2/2]

void sheaf::poset_traverser::mark_visited ( int  xindex)
inlineprotected

Sets the visited markers true for the emebr with index xindex.

Definition at line 187 of file poset_traverser.h.

References sheaf::zn_to_bool::force().

◆ member_index_ub()

sheaf::scoped_index sheaf::poset_traverser::member_index_ub ( ) const
protected

◆ no_members_visited()

bool sheaf::poset_traverser::no_members_visited ( ) const
protected

True if no members have been visited.

Postcondition
  • result == -unexecutable( no member is marked visited )

Definition at line 250 of file poset_traverser.cc.

References _visited, all_members_visited(), and sheaf::zn_to_bool::is_false().

Referenced by mark_members_not_visited(), and member_index_ub().

◆ private_traverse()

virtual void sheaf::poset_traverser::private_traverse ( )
protectedpure virtual

Implements the traversal.

Implemented in sheaf::poset_dft.

Referenced by traverse().

◆ traverse()

void sheaf::poset_traverser::traverse ( const abstract_poset_member xanchor,
bool  down,
bool  reset_markers = true 
)

Traverse the down set (down == true) or up set (down == false) of xanchor. If reset_markers, reset all visited markers to false before begining.

Precondition
  • has_same_host(xanchor)
  • xanchor->state_is_read_accessible()
Postcondition
  • postcondition_of(private_traverse())

Definition at line 165 of file poset_traverser.cc.

References _anchor, _in_down_set, anchor(), ensure_visited_ub(), has_been_visited(), has_same_host(), invariant(), mark_members_not_visited(), private_traverse(), and sheaf::read_write_monitor_handle::state_is_read_accessible().

Referenced by sheaf::poset_slicer::find_jims_pa(), sheaf::poset_slicer::find_pa(), sheaf::poset_orderer::restore_order(), sheaf::poset_slicer::up_set_pa(), and ~poset_traverser().

Member Data Documentation

◆ _anchor

◆ _host

◆ _in_down_set

bool sheaf::poset_traverser::_in_down_set
protected

◆ _visited

zn_to_bool* sheaf::poset_traverser::_visited
protected

The markers for previously visited members.

Definition at line 132 of file poset_traverser.h.

Referenced by invariant(), mark_members_not_visited(), mark_visited(), no_members_visited(), poset_traverser(), and ~poset_traverser().


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