21 #include "SheafSystem/interval_index_space_handle.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/index_space_family.h" 24 #include "SheafSystem/interval_index_space_state.h" 25 #include "SheafSystem/scoped_index.h" 36 const std::string& xname,
42 require(!xname.empty());
43 require(!xid_spaces.
contains(xname));
55 ensure(&result.id_spaces() == &xid_spaces);
57 ensure(result.conforms_to_state(xname));
59 ensure(result.is_persistent() == xis_persistent);
60 ensure(result.name() == xname);
62 ensure(result.merge_mode() >= xmerge_mode);
109 ensure((*
this) == xother);
122 require(xid_spaces.
contains(xindex));
134 ensure(
index() == xindex);
143 const std::string& xname)
147 require(xid_spaces.
contains(xname));
159 ensure(
name() == xname);
181 ensure((*
this) == xother);
219 ensure(&
state() == &xstate);
241 ensure(is_basic_query);
263 ensure(is_basic_query);
321 require(xhub_begin <= xhub_end);
322 require(xbegin <= xend);
323 require((xhub_end - xhub_begin) == (xend - xbegin));
333 ensure(
ct() >= old_ct);
334 ensure_for_range(
pod_type i=xhub_begin, i<=xhub_end, ++i,
pod(i) == xbegin+(i-xhub_begin));
335 ensure_for_range(
pod_type i=xbegin, i<=xend, ++i,
hub_pod(i) == xhub_begin+(i-xbegin));
373 require(xhub_begin <= xhub_end);
386 ensure(
ct() == old_ct + (xhub_end - xhub_begin + 1));
387 ensure(
next_id() == old_next_id + (xhub_end - xhub_begin + 1));
388 ensure_for_range(
pod_type i=xhub_begin, i<=xhub_end, ++i,
pod(i) == old_next_id+(i-xhub_begin));
430 require(xhub_begin <= xhub_end);
452 require(xbegin <= xend);
569 ensure(is_basic_query);
631 ensure(is_basic_query);
664 ensure((*
this) == xother);
685 ensure(*result == *
this);
719 ensure(is_basic_query);
An implementation of class scattered_insertion_index_space_handle that has a interval id space state...
An STL map implementation of class scattered_insertion_index_space_state optimized to efficiently rep...
virtual bool invariant() const
Class invariant.
pod_type interval_end(const scoped_index &xid) const
The end of the interval containing xid.hub_pod. synonym for internval_end(xid.hub_pod()).
virtual void attach_to(pod_type xindex)
Attach to the state with index xindex in the id space family id_spaces().
virtual pod_type index() const
Index of this space.
bool in_scope() const
True if and only if scope() contains an entry for pod().
pod_type next_id() const
The id inserted by the next call to push_back.
pod_type interval_end(const scoped_index &xid) const
The end of the interval containing xid.hub_pod. synonym for internval_end(xid.hub_pod()).
virtual bool conforms_to_state(const index_space_collection &xhost, pod_type xlocal_id) const
True if this conforms to the handle type required by the state with local scope id xlocal_id in the h...
size_type remove_hub_interval(pod_type xhub_begin, pod_type xhub_end)
Removes the equivalance associated with the interval [xhub_begin, xhub_end]. Returns the number of en...
bool merge_mode() const
True if and only if compatible intervals should be merged.
static interval_index_space_handle new_space(index_space_family &xid_spaces, const std::string &xname, bool xis_persistent, bool xmerge_mode)
Create a new interval id space in the id space family xid_space at the next available id space index ...
bool contains_hub(pod_type xid) const
True if this space contains an id equivalent to xid in the unglued hub id space. synonym for contains...
void put_merge_mode(bool xvalue)
Sets merge_mode() to xvalue.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
virtual const index_space_family & id_spaces() const
The id space family for this (const version).
virtual bool is_attached() const =0
True if this handle is attached to a state.
pod_type interval_begin(const scoped_index &xid) const
The beginning of the interval containing xid.hub_pod(). synonym for internval_begin(xid.hub_pod()).
void print_map_rep(std::ostream &xos) const
Inserts the map representation into ostream xos.
size_type remove_interval(const scoped_index &xhub_begin, const scoped_index &xhub_end)
Removes the equivalance associated with the interval [xhub_begin.hub_pod(), xhub_end.hub_pod()]. synonym for remove_hub_interval(xhub_begin.hub_pod(), xhub_end.hub_pod()). Returns the number of entries actually removed, if any.
virtual pod_type pod(pod_type xid) const
The pod index in this space equivalent to xid in the hub id space.
pod_type interval_begin(const scoped_index &xid) const
The beginning of the interval containing xid.hub_pod(). synonym for internval_begin(xid.hub_pod()).
Abstract base class with useful features for all objects.
bool merge_mode() const
True if and only if compatible intervals should be merged.
void insert_interval(pod_type xbegin, pod_type xend, const scoped_index &xhub_begin, const scoped_index &xhub_end)
Make the closed interval [xbegin, xend] equivalent to [xbegin.hub_pod(), xhub_end.hub_pod()]. synonym for insert_interval(xbegin, xend, xhub_begin.hub_pod(), xhub_end.hub_pod()).
std::string name() const
Name of this space.
pod_index_type pod_type
The "plain old data" index type for this.
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 state.
interval_index_space_handle & operator=(const interval_index_space_handle &xother)
Assignment operator; attach this handle to the state of xother. synonym for attach_to(xother).
void insert_interval(pod_type xbegin, pod_type xend, const scoped_index &xhub_begin, const scoped_index &xhub_end)
Make the closed interval [xbegin, xend] equivalent to [xbegin.hub_pod(), xhub_end.hub_pod()]. synonym for insert_interval(xbegin, xend, xhub_begin.hub_pod(), xhub_end.hub_pod()).
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
void push_interval(const scoped_index &xhub_begin, const scoped_index &xhub_end)
Push the closed interval [xhub_begin.hub_pod(), xhub_end.hub_pod()] to the end of this space...
size_type remove_hub_interval(pod_type xhub_begin, pod_type xhub_end)
Removes the equivalance associated with the interval [xhub_begin, xhub_end]. Returns the number of en...
A collection of id space states. This is a virtual class with provides an interface for accessing the...
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
virtual bool contains(pod_type xlocal_id) const =0
True if this collection contains the id space with local id xlocal_id.
virtual bool invariant() const
Class invariant.
pod_type hub_pod(pod_type xid) const
The pod index in the unglued hub id space equivalent to xid in this id space; synonym for unglued_hub...
interval_index_space_handle()
Default constructor.
void put_merge_mode(bool xvalue)
Sets merge_mode() to xvalue.
bool invariant_check() const
True if invariant checking is enabled.
virtual interval_index_space_handle * clone() const
Virtual constructor, makes a new instance of the same type as this. If the handle is attached...
interval_index_space_state & state()
The interval id space state (mutable version).
A handle for a scattered_insertion_index_space_state.
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
virtual size_type ct() const
The number of members.
Factory and container for a family of id spaces.
void push_interval(const scoped_index &xhub_begin, const scoped_index &xhub_end)
Push the closed interval [xhub_begin.hub_pod(), xhub_end.hub_pod()] to the end of this space...
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
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.
size_type remove_interval(const scoped_index &xhub_begin, const scoped_index &xhub_end)
Removes the equivalance associated with the interval [xhub_begin.hub_pod(), xhub_end.hub_pod()]. synonym for remove_hub_interval(xhub_begin.hub_pod(), xhub_end.hub_pod()). Returns the number of entries actually removed, if any.
static interval_index_space_handle new_space(index_space_family &xid_spaces, const std::string &xname, bool xis_persistent, bool xmerge_mode)
Create a new interval id space in the id space family xid_space with name xname, persistence xis_pers...
virtual ~interval_index_space_handle()
Destructor.
virtual bool contains(pod_type xid) const
True if this space contains id xid.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
void print_map_rep(std::ostream &xos) const
Inserts the map representation into ostream xos.