21 #include "SheafSystem/poset_bounds_descriptor.h" 22 #include "SheafSystem/assert_contract.h" 42 ensure(
mode() == NOT_A_MODE);
63 ensure(*
this == xother);
76 _lb_id = xother._lb_id;
77 _ub_id = xother._ub_id;
82 ensure(*
this == xother);
100 (_mode == xother._mode) &&
101 (_lb_id == xother._lb_id) &&
102 (_ub_id == xother._ub_id);
228 case MEMBER_SUBPOSET:
231 case SUBPOSET_MEMBER:
234 case SUBPOSET_SUBPOSET:
238 post_fatal_error_message(
"unrecognized specification mode");
257 require((0 <= xmode) && (xmode <= 3));
264 result = MEMBER_MEMBER;
267 result = MEMBER_SUBPOSET;
270 result = SUBPOSET_MEMBER;
273 result = SUBPOSET_SUBPOSET;
299 ensure(
mode() == xmode);
300 ensure(
lb_id() == xlb_id);
301 ensure(
ub_id() == xub_id);
313 _lb_id(xlb_id.hub_pod()),
314 _ub_id(xub_id.hub_pod())
323 ensure(
mode() == xmode);
364 result = ((
mode() == MEMBER_MEMBER) || (
mode() == MEMBER_SUBPOSET));
370 ensure(result == ((
mode() == MEMBER_MEMBER) || (
mode() == MEMBER_SUBPOSET)));
387 result = ((
mode() == MEMBER_MEMBER) || (
mode() == SUBPOSET_MEMBER));
393 ensure(result == ((
mode() == MEMBER_MEMBER) || (
mode() == SUBPOSET_MEMBER)));
419 ensure(
lb_id() == xlb_id);
464 ensure(
ub_id() == xub_id);
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
static specification_mode int_to_mode(int xmode)
Converts int xmode to a mode.
virtual poset_bounds_descriptor * clone() const
Virtual constructor; makes a new instance of the same type as this.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
bool ub_is_member() const
True if mode == MEMBER_MEMBER or SUBPOSET_MEMBER.
A client handle for a general, abstract partially order set.
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.
pod_index_type ub_id() const
The index of the upper bound member, if the upper bound contains a single member. ...
void put_lb_id(pod_index_type xlb_id)
Sets the index of the lower bound to xlb_id.
virtual ~poset_bounds_descriptor()
Destructor.
Abstract base class with useful features for all objects.
specification_mode
Enumeration for mode of specifying the lower and upper bounds.
static int mode_to_int(specification_mode xmode)
Converts mode xmode to an int.
bool ub_member_is_not_top() const
True if ub_is_member() and ub_id() is not sheaf_constants::TOP_INDEX.
An index within the external ("client") scope of a given id space.
pod_index_type lb_id() const
The index of the lower bound.
virtual bool contains_member(pod_index_type xmbr_hub_id, bool xauto_access=true) const
True if some version of this poset contains poset member with hub id xmbr_hub_id. ...
static const poset_bounds_descriptor & BOTTOM_TOP
An instance with lb() == {bottom} and ub() == {top}.
bool is_valid_for(const poset_state_handle &xposet) const
True if the members and/or subposets mentioned in this descriptor exist in xposet.
bool operator==(const poset_bounds_descriptor &xother) const
Comparison operator.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
static const poset_bounds_descriptor & BOTTOM_BOTTOM
An instance with lb() == {bottom} and ub() == {bottom}.
bool lb_member_is_bottom() const
True if lb_is_member() and lb_id() is sheaf_constants::BOTTOM_INDEX.
bool lb_is_member() const
True if mode == MEMBER_MEMBER or MEMBER_SUBPOSET.
A description of a (lower, upper) bounds pair for a poset. Specifies a portion of a poset for a bound...
poset_bounds_descriptor()
Default constructor.
bool invariant_check() const
True if invariant checking is enabled.
int_type pod_index_type
The plain old data index type.
poset_bounds_descriptor & operator=(const poset_bounds_descriptor &xother)
Assignment operator.
bool ub_is_valid_for(const poset_state_handle &xposet) const
True if the upper bound member or subposet mentioned in this descriptor exists in xposet...
bool lb_is_valid_for(const poset_state_handle &xposet) const
True if the lower bound member or subposet mentioned in this descriptor exists in xposet...
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
virtual bool invariant() const
Class invariant.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
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_ub_id(pod_index_type xub_id)
Sets the index of the upper bound to xub_id.
specification_mode mode() const
Specification mode for this.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.