21 #include "SheafSystem/reserved_primary_index_space_state.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/deep_size.h" 24 #include "SheafSystem/hub_index_space_handle.h" 25 #include "SheafSystem/index_space_family.h" 26 #include "SheafSystem/reserved_primary_index_space_handle.h" 27 #include "SheafSystem/reserved_primary_index_space_iterator.h" 38 const std::string& xname,
44 require(!xname.empty());
45 require(!xid_spaces.
contains(xname));
46 require(xoffset >= 0);
52 lstate->
new_state(xid_spaces, xname,
false);
65 ensure(&result.
id_spaces() == &xid_spaces);
69 ensure(result.
name() == xname);
72 ensure(result.
offset() == xoffset);
73 ensure(result.
ct() == xct);
85 const std::string& xname,
93 require(!xname.empty());
94 require(!xid_spaces.
contains(xname));
95 require(xoffset >= 0);
101 lstate->
new_state(xid_spaces, xid, xname,
false);
114 ensure(&result.
id_spaces() == &xid_spaces);
118 ensure(result.
index() == xid);
119 ensure(result.
name() == xname);
122 ensure(result.
offset() == xoffset);
123 ensure(result.
ct() == xct);
257 ensure(is_basic_query);
276 ensure(is_basic_query);
296 ensure(is_basic_query);
384 (void) primary_index_space_state::operator=(xother);
389 ensure((*
this) == xother);
490 handles().release(reinterpret_cast<reserved_primary_index_space_handle&>(xid_space));
494 ensure(is_basic_query);
512 bool result = (lid_space != 0) && handles().allocated(*lid_space);
516 ensure(is_basic_query);
528 sheaf::reserved_primary_index_space_state::
539 ensure(is_basic_query);
627 iterators().release(reinterpret_cast<reserved_primary_index_space_iterator&>(xitr));
631 ensure(is_basic_query);
649 bool result = (litr != 0) && iterators().allocated(*litr);
653 ensure(is_basic_query);
665 sheaf::reserved_primary_index_space_state::
676 ensure(is_basic_query);
694 static const std::string result(
"reserved_primary_index_space_state");
723 sheaf::reserved_primary_index_space_state::
814 size_t result = xinclude_shallow ?
sizeof(xn) : 0;
virtual reserved_primary_index_space_state * clone() const
Virtual constructor; create a new instance of the same type at this.
static size_type handle_pool_deep_size()
The deep size of the handle pool.
size_type ct() const
The number of members.
virtual pod_type index() const
Index of this space.
virtual bool invariant() const
Class invariant.
An abstract iterator over the ids of an id space.
virtual const std::string & class_name() const
The name of this class.
A computed implementation of abstract class primary_index_space_state. This representation is used fo...
virtual bool is_persistent() const
True if this id space should be written to disk.
static size_type handle_pool_ct()
The number of handles in the pool.
pod_type new_hub_id(pod_type xhub_id)
Allocate the hub id xhub_id in this space. Returns the allocated id in the hub id space...
virtual void detach()=0
Detach this handle form its state, if any.
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).
pod_type _next_hub_id
The next available hub id for allocation.
virtual reserved_primary_index_space_state & operator=(const explicit_index_space_state &xother)
Assignment operator.
virtual void detach()=0
Detach this handle form its state, if any.
void attach(explicit_index_space_handle &xid_space) const
Attach the id space handle xid_space to this state.
pod_type _end
Ending id of this space.
virtual bool allocated_id_space(const index_space_handle &xid_space) const
True if and only if id space handle xid_space was allocated by the handle pool.
Abstract base class with useful features for all objects.
virtual ~reserved_primary_index_space_state()
Destructor.
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
std::string name() const
Name of this space.
bool is_hub_id_available(pod_type xhub_id) const
True if and only if the hub id xhub_id is available for allocation.
virtual bool is_attached() const
True if this handle is attached to a state.
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
static reserved_primary_index_space_handle new_space(index_space_family &xid_spaces, const std::string &xname, pod_type xoffset, size_type xct)
Create a new reserved primary id space in the id space family xid_space at the next available id spac...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
An iterator over a reserved term in the primary sum id space in which the equivlence between the ids ...
const hub_index_space_handle & hub_id_space() const
The hub id space.
bool is_explicit_interval(pod_type xid)
True, if and only if the id space interval that contains index xid is an explicit interval...
pod_type new_id()
Allocate the next available id in this space. Returns the allocated id in the hub id space...
virtual index_space_handle & get_id_space() const
Allocates an id space handle from the handle pool.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
A computed implementation class explicit_index_space_state that is used for the terms of the primary ...
void new_state(index_space_family &xid_spaces, const std::string &xname, bool xis_persistent)
Create a new id space state in the id space family xid_spaces at the next available id space index wi...
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
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...
static size_type iterator_pool_deep_size()
The deep size of the iterator pool.
bool is_next_id_available() const
True if and only if the next id is available for allocation.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
size_type _ct
The number of members.
bool invariant_check() const
True if invariant checking is enabled.
reserved_primary_index_space_state()
Default constructor.
pod_index_type pod_type
The "plain old data" index type for this.
An implementation of class primary_index_space_handle that has a reserved primary id space state...
pod_type next_hub_id() const
The next available hub id for allocation.
virtual bool allocated_iterator(const index_space_iterator &xitr) const
True if and only if id space iterator xitr was allocated by the iterator pool.
int_type pod_index_type
The plain old data index type.
virtual size_type deep_size(bool xinclude_shallow) const
The deep size of this.
virtual void release_iterator(index_space_iterator &xitr) const
Returns the id space iterator xitr to the iterator pool.
static size_type iterator_pool_ct()
The number of iterators in the pool.
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
virtual index_space_iterator & get_iterator() const
Allocates an id space iterator from the iterator pool.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
virtual size_type ct() const
The number of members.
bool is_empty() const
True if there are no ids in the space.
Factory and container for a family of id spaces.
pod_type offset() const
The offset into the hub id space.
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
static factory< explicit_index_space_state > & id_space_factory()
A factory for making descendants of this class.
pod_type _begin
Beginning id of this space.
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.
virtual bool invariant() const
Class invariant.
pod_type next_hub_id() const
The next available hub id for allocation.
virtual bool is_attached() const
True if this iterator is attached to a state.
virtual void release_id_space(index_space_handle &xid_space) const
Returns the id space handle xid_space to the handle pool.
A reallocated pool of objects of type T. Objects in the pool are either allocated or stored in a free...
virtual bool contains(pod_type xid) const
True if this space contains id xid.
pod_type _offset
The offset into the hub id space.