SheafSystem  0.0.0.0
sheaf::primary_sum_index_space_state Class Reference

An implementation of class sum_index_space_state intended for use as the sum of the primary id spaces. More...

#include <primary_sum_index_space_state.h>

Inheritance diagram for sheaf::primary_sum_index_space_state:
sheaf::sum_index_space_state sheaf::explicit_index_space_state sheaf::any

Public Member Functions

virtual const std::string & class_name () const
 The name of this class. More...
 
virtual primary_sum_index_space_stateclone () const
 Virtual constructor; create a new instance of the same type at this. More...
 
- Public Member Functions inherited from sheaf::sum_index_space_state
void equivalence_class (pod_type xhub_id, equivalence_class_type &result) const
 The equivalence class associated with the hub id xhub_id. More...
 
size_type equivalence_ct (pod_type xhub_id) const
 The number of members of the equivalence class of hub id xhub_id. More...
 
bool contains_unique_rep (pod_type xhub_id) const
 True if and only if hub id xhub_id is the only member of its equivalence class. More...
 
const index_space_handleterm (pod_type xi) const
 The xi-th term. More...
 
const index_space_handleterm_of (pod_type xid) const
 The term containing id xid. More...
 
const index_space_handleterm_of (const scoped_index &xid) const
 The term contains id xid. More...
 
const index_space_handlelast_term () const
 The last term. More...
 
pod_type term_begin (pod_type xi) const
 Beginning id of the xi-th term. More...
 
pod_type term_end (pod_type xi) const
 Ending id of the xi-th term. More...
 
pod_type term_hub_begin (pod_type xi) const
 Beginning hub id of the xi-th term. More...
 
pod_type term_hub_end (pod_type xi) const
 Ending hub id of the xi-th term. More...
 
pod_type term_id (pod_type xid) const
 The id of the term containing id xid. More...
 
void binary (pod_type xindex, pod_type &xterm_id, pod_type &xlocal) const
 Converts simple index xindex to its binary components xterm_id and xlocal_id. More...
 
void simple (pod_type xterm_id, pod_type xlocal_id, pod_type &xindex) const
 Converts binary components xterm_id, xlocal_id to simple index xindex. More...
 
- Public Member Functions inherited from sheaf::explicit_index_space_state
virtual ~explicit_index_space_state ()
 Destructor. More...
 
const index_space_collectionhost () const
 The host collection (const version). More...
 
index_space_collectionhost ()
 The host collection (mutable version). More...
 
pod_type index () const
 The index of this id space. More...
 
const index_space_familyid_spaces () const
 The id space family for this (const version). More...
 
index_space_familyid_spaces ()
 The id space family for this (mutable version). More...
 
const hub_index_space_handlehub_id_space () const
 The hub id space. More...
 
size_type ct () const
 The number of members. More...
 
bool is_empty () const
 True if there are no ids in the space. More...
 
pod_type begin () const
 Beginning id of this space. More...
 
pod_type end () const
 Ending id of this space. More...
 
bool is_gathered () const
 True if begin() == 0 and end() == ct(). More...
 
bool contains (const scoped_index &xid) const
 True if this space contains an id equivalent to xid. synonym for contains_hub(xid.hub_pod()). More...
 
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_unglued_hub(xid) More...
 
bool contains (pod_type xid, const scoped_index &xhub_id) const
 True if this space contains an id xid equivalent to xhub_id in the hub id space. synonym for contains(xid, xhub_id.hub_pod()). More...
 
virtual bool contains (pod_type xid, pod_type xhub_id) const
 True if this space contains an id xid equivalent to xhub_id in the hub id space. More...
 
pod_type pod (const scoped_index &xid) const
 The pod index in this space equivalent to xid. synonym for pod(xid.hub_pod()). More...
 
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_pod(xid). More...
 
bool is_persistent () const
 True if this id space should be written to disk. More...
 
virtual void new_product_structure (const abstract_product_structure &xproduct)
 Creates a new product structure for this id space by cloning the product structure, xproduct. More...
 
virtual void delete_product_structure ()
 Deletes the product structure for this id space. More...
 
const abstract_product_structureproduct_structure () const
 The product structure for this id space (const version). More...
 
abstract_product_structureproduct_structure ()
 The product structure for this id space (mutable version). More...
 
bool has_product_structure () const
 True if this id space has a product structure. 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...
 

Friends

class hub_index_space_iterator
 
class namespace_poset
 
SHEAF_DLL_SPEC size_t deep_size (const primary_sum_index_space_state &xn, bool xinclude_shallow)
 The deep size of primary_sum_index_space_state& xn. More...
 

SPACE FACTORY FACET

static hub_index_space_handle new_space (index_space_family &xid_spaces, const std::string &xname)
 Create a new primary sum id space in the id space family xid_space at the next available id space index with name xname. Returns a handle to the id space created. More...
 
static hub_index_space_handle new_space (index_space_family &xid_spaces, pod_type xid, const std::string &xname)
 Create a new primary sum id space in the id space family xid_space at the id space index xid with name xname. Returns a handle to the id space created. More...
 

PRIMARY_SUM_INDEX_SPACE_STATE FACET

 primary_sum_index_space_state ()
 Default constructor. More...
 
 primary_sum_index_space_state (const primary_sum_index_space_state &xother)
 Copy constructor; disabled. More...
 
virtual ~primary_sum_index_space_state ()
 Destructor. More...
 

PRIMARY SUM INDEX SPACE FACET

interval_set _members
 Set of members in the domain of this map. More...
 
pod_type _next_id
 The next available id. More...
 
reserved_primary_index_space_handle _reserved_term
 The current reserved term. More...
 
unordered::unordered_set< pod_type_reserved_term_ids
 The set of reserved term ids. More...
 
std::string next_term_name ()
 Name of the next term id space. More...
 
pod_type new_reserved_term ()
 Creates a new reserved term starting above next_hub_id(). Returns the index of the term created. More...
 
pod_type new_reserved_term (pod_type xid)
 Creates a new reserved term starting at id xid. Returns the index of the term created. More...
 
void add_term (pod_type xterm_id, pod_type xbegin, pod_type xend)
 Insert term with id xterm_id into the interval . More...
 
bool reserved_interval_is_available (pod_type xid) const
 True if the reserved interval for id xid is available for allocation. More...
 
void update_extrema ()
 Update the id extrema. More...
 
pod_type new_id ()
 Allocate the next available id in this space. More...
 
pod_type new_id (pod_type xid)
 Allocate the id xid in this space. More...
 
void delete_id (pod_type xid)
 Deallocate the id xid in this space. More...
 
bool is_valid_reserved_id (pod_type xid) const
 True if and only if the reserved term containing xid is already a reserved term or is available for allocation. More...
 
pod_type next_id () const
 The next available id. More...
 
pod_type new_primary_term (size_type xct)
 Create a new primary term [next_id(), next_id()+xct). Returns the index of the term created. More...
 
pod_type new_primary_term (pod_type xid, size_type xct)
 Create a new primary term [xid, xid+xct). Returns the index of the term created. More...
 
void remove_term (pod_type xi)
 Remove xi-th term of this sum. More...
 
void extend_last_term (size_type xct)
 Extends the last term to ct() == xct. More...
 
bool interval_is_full (pod_type xbegin, pod_type xend) const
 True if all ids in the interval [xbegin, xend) are in this space. More...
 
bool interval_is_empty (pod_type xbegin, pod_type xend) const
 True if all ids in the interval [xbegin, xend) are not in this space. More...
 
bool interval_is_available (pod_type xbegin, pod_type xend) const
 True if the ids in the interval [xbegin, xend) are available in this space. More...
 
static const std::string & term_prefix ()
 Prefix of the term id spaces. More...
 

GLUING FACET

void glue (pod_type xid, pod_type xrep)
 Glues xid to xrep; adds xid to the equivalence class with representative member xrep. More...
 
void unglue (pod_type xid)
 Unglues xid; makes xid its own representative. More...
 
void unglue_all (pod_type xrep_id)
 Unglue all ids glued to representative xrep_id; makes each id in the equivalence class of xrep_id its own representative. More...
 
bool has_gluing () const
 Ture if there is any gluing. More...
 

GATHERED ID SPACE FACET

interval_index_space_handle _gathered_id_space
 The gathered id space. More...
 
static const std::string & gathered_hub_id_space_name ()
 Name of the gathered id space. More...
 
void update_gathered_id_space (bool xexclude_bottom)
 Update the gathered id space. If xexclude_bottom, construct the id space without BOTTOM_INDEX. More...
 
const index_space_handlenew_gathered_id_space (bool xexclude_bottom)
 Construct a gathered id space from this id space. If xexclude_bottom, construct the id space without BOTTOM_INDEX. More...
 
void update_gathered_id_space ()
 Update the gathered id space. More...
 
const index_space_handlegathered_id_space () const
 The gathered id space. More...
 
bool has_gathered_id_space () const
 True, if the gathered id space exists. More...
 
bool gathered_id_space_excludes_bottom () const
 True, if the gathered id space excludes BOTTOM_INDEX. More...
 

STANDARD IDS FACET

pod_type _standard_id_end
 The end id of the standard ids. More...
 
void update_standard_ids ()
 Make end() the standard id end. More...
 
bool has_only_standard_ids () const
 True if and only if there are only standard ids. More...
 
void clear_ids ()
 Deallocate all non-standard ids. More...
 

SUM INDEX SPACE FACET

typedef unordered::unordered_map< pod_type, pod_typerem_type
 The type of rem map. More...
 
rem_type _rem
 The reflexive reduction of the rem map. More...
 
pod_type _term_id_begin
 Beginning index of the terms in this sum. More...
 
pod_type _term_id_end
 Ending index of the terms in this sum. More...
 
virtual bool contains_rep (pod_type xhub_id) const
 True if and only if hub id xhub_id is the representative member of its equivalence class. More...
 
virtual pod_type rep (pod_type xhub_id) const
 The representative member of the equivalence class of hub id xhub_id. More...
 
virtual pod_type host_rep (pod_type xhub_id) const
 The host id associated with the representative member of the equivalence class of hub id xhub_id. More...
 
virtual pod_type term_id_begin () const
 Beginning index of the terms in this sum. More...
 
virtual pod_type term_id_end () const
 Ending index of the terms in this sum. More...
 
virtual bool contains_term_id (pod_type xi) const
 True if this map contains the xi-th term. More...
 
virtual void clear ()
 Deletes all entries. More...
 

EXPLICIT_INDEX_SPACE_STATE FACET

virtual primary_sum_index_space_stateoperator= (const explicit_index_space_state &xother)
 Assignment operator. More...
 
virtual bool operator== (const explicit_index_space_state &xother) const
 True if this is equivalent to xother. More...
 
virtual size_type deep_size (bool xinclude_shallow) const
 The deep size of this. More...
 

INDEX SPACE FACET

virtual bool contains (pod_type xid) const
 True if this space contains id xid. More...
 
virtual bool contains_unglued_hub (pod_type xid) const
 True if this space contains an id equivalent to xid in the unglued hub id space. More...
 
virtual bool contains_glued_hub (pod_type xid) const
 True if this space contains an id equivalent to xid in the glued hub id space. More...
 
virtual pod_type pod (pod_type xid) const
 The pod index in this space equivalent to xid in the hub id space. More...
 
virtual pod_type unglued_hub_pod (pod_type xid) const
 The pod index in the unglued hub id space equivalent to xid in this id space. More...
 
virtual pod_type glued_hub_pod (pod_type xid) const
 The pod index in the glued primary sum id space equivalent to xid in this id space. More...
 

HANDLE POOL FACET

static size_type handle_pool_ct ()
 The number of handles in the pool. More...
 
static size_type handle_pool_deep_size ()
 The deep size of the handle pool. More...
 
virtual index_space_handleget_id_space () const
 The id space handle with this state. More...
 
virtual void release_id_space (index_space_handle &xid_space) const
 Release the id space handle xid_space. More...
 
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. More...
 

ITERATOR POOL FACET

static size_type iterator_pool_ct ()
 The number of iterators in the pool. More...
 
static size_type iterator_pool_deep_size ()
 The deep size of the iterator pool. More...
 
virtual index_space_iteratorget_iterator () const
 Allocates an id space iterator from the iterator pool. More...
 
virtual void release_iterator (index_space_iterator &xitr) const
 Returns the id space iterator xitr to the iterator pool. More...
 
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. More...
 

ANY FACET

virtual bool is_ancestor_of (const any *other) const
 Conformance test; true if other conforms to this. More...
 
virtual bool invariant () const
 Class invariant. More...
 

Additional Inherited Members

- Public Types inherited from sheaf::sum_index_space_state
typedef std::list< pod_typeequivalence_class_type
 The type used to represent an equivalence class. More...
 
- Public Types inherited from sheaf::explicit_index_space_state
typedef pod_index_type pod_type
 The "plain old data" index type for this. More...
 
- Static Public Member Functions inherited from sheaf::explicit_index_space_state
static factory< explicit_index_space_state > & id_space_factory ()
 A factory for making descendants of this class. More...
 
- Protected Types inherited from sheaf::sum_index_space_state
typedef unordered::unordered_multimap< pod_type, pod_typerem_inv_type
 The type of the inverse of the rem map. More...
 
typedef zero_block_initialization_policy< index_space_handle * > terms_init_type
 The type of the terms block initialization policy. More...
 
typedef auto_block< index_space_handle *, terms_init_typeterms_type
 The type of the terms block. More...
 
typedef std::map< pod_type, pod_typesum_to_term_type
 The type of sum_to_term_map. More...
 
- Protected Member Functions inherited from sheaf::sum_index_space_state
 sum_index_space_state ()
 Default constructor. More...
 
 sum_index_space_state (const sum_index_space_state &xother)
 Copy constructor; disabled. More...
 
virtual ~sum_index_space_state ()
 Destructor. More...
 
- Protected Member Functions inherited from sheaf::explicit_index_space_state
 explicit_index_space_state ()
 Default constructor. More...
 
 explicit_index_space_state (const explicit_index_space_state &xother)
 Copy constructor; disabled. More...
 
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 with name xname, and persistence xis_persistent. More...
 
void new_state (index_space_family &xid_spaces, pod_type xid, const std::string &xname, bool xis_persistent)
 Create a new id space state in the id space family xid_spaces at the id space index xid with name xname, and persistence xis_persistent. More...
 
void invalidate_extrema ()
 Invalidate the extrema. More...
 
void attach (explicit_index_space_handle &xid_space) const
 Attach the id space handle xid_space to this state. More...
 
void attach (explicit_index_space_iterator &xitr) const
 Attach the id space iterator xitr to this state. More...
 
- Protected Member Functions inherited from sheaf::any
 any ()
 default constructor More...
 
- Protected Attributes inherited from sheaf::sum_index_space_state
rem_inv_type _rem_inv
 The inverse rem map. More...
 
terms_type _terms
 The terms of this sum. More...
 
block< pod_type_term_begin
 The beginning of the interval in the sum id space for each term. More...
 
block< pod_type_term_end
 The end of the interval in the sum id space for each term. More...
 
sum_to_term_type _sum_to_term_map
 The term id corresponding to each sum id. More...
 
- Protected Attributes inherited from sheaf::explicit_index_space_state
index_space_collection_host
 The host collection. More...
 
pod_type _index
 The index of this id space. More...
 
size_type _ct
 The number of members. More...
 
pod_type _begin
 Beginning id of this space. More...
 
pod_type _end
 Ending id of this space. More...
 
bool _is_persistent
 True if this id space should be written to disk. More...
 
abstract_product_structure_product
 The product structure for this id space. More...
 

Detailed Description

An implementation of class sum_index_space_state intended for use as the sum of the primary id spaces.

Class primary_sum_index_space_state has a mutable equivalence relation which is interpreted as defining the hub id space as the quotient space of the primary sum id space by the equivalence relation. That is, the equivalence relation is interpreted as gluing members of the primary sum id space together to form the hub id space.

The implementation of this class takes advantage of two unique features:

(1) The hub id space is an explicit subset of the primary sum id space, so the equivalence relation can represented using the rem function. We can thus make the equivalence relation mutable by storing the rem function and its inverse in mutable form and deriving the id spaces from the equivalence relation.

(2) In practice, relatively few sum ids are glued, so most of the equivalence classes contain only a single member and most of the entries in the rem function are reflexive (rem(s) = s). We can thus store only the reflexive reduction of rem and its inverse.

Definition at line 86 of file primary_sum_index_space_state.h.

Member Typedef Documentation

◆ rem_type

typedef unordered::unordered_map<pod_type, pod_type> sheaf::primary_sum_index_space_state::rem_type
protected

The type of rem map.

Definition at line 462 of file primary_sum_index_space_state.h.

Constructor & Destructor Documentation

◆ primary_sum_index_space_state() [1/2]

sheaf::primary_sum_index_space_state::primary_sum_index_space_state ( )
protected

Default constructor.

Postcondition

Definition at line 121 of file primary_sum_index_space_state.cc.

References invariant(), sheaf::explicit_index_space_state::is_empty(), and ~primary_sum_index_space_state().

Referenced by clone(), and new_space().

◆ primary_sum_index_space_state() [2/2]

sheaf::primary_sum_index_space_state::primary_sum_index_space_state ( const primary_sum_index_space_state xother)
inlineprotected

Copy constructor; disabled.

Definition at line 141 of file primary_sum_index_space_state.h.

◆ ~primary_sum_index_space_state()

sheaf::primary_sum_index_space_state::~primary_sum_index_space_state ( )
protectedvirtual

Destructor.

Definition at line 143 of file primary_sum_index_space_state.cc.

References new_id().

Referenced by primary_sum_index_space_state().

Member Function Documentation

◆ add_term()

◆ allocated_id_space()

bool sheaf::primary_sum_index_space_state::allocated_id_space ( const index_space_handle xid_space) const
virtual

True if and only if id space handle xid_space was allocated by the handle pool.

Postcondition
  • is_basic_query

Implements sheaf::explicit_index_space_state.

Definition at line 1833 of file primary_sum_index_space_state.cc.

References iterator_pool_ct().

Referenced by release_id_space().

◆ allocated_iterator()

bool sheaf::primary_sum_index_space_state::allocated_iterator ( const index_space_iterator xitr) const
virtual

True if and only if id space iterator xitr was allocated by the iterator pool.

Postcondition
  • is_basic_query

Implements sheaf::explicit_index_space_state.

Definition at line 1970 of file primary_sum_index_space_state.cc.

References class_name().

Referenced by release_iterator().

◆ class_name()

const std::string & sheaf::primary_sum_index_space_state::class_name ( ) const
virtual

The name of this class.

Reimplemented from sheaf::sum_index_space_state.

Definition at line 2022 of file primary_sum_index_space_state.cc.

References clone().

Referenced by allocated_iterator().

◆ clear()

void sheaf::primary_sum_index_space_state::clear ( )
virtual

◆ clear_ids()

◆ clone()

sheaf::primary_sum_index_space_state * sheaf::primary_sum_index_space_state::clone ( ) const
virtual

Virtual constructor; create a new instance of the same type at this.

Postcondition
  • result != 0
  • is_same_type(result)

Implements sheaf::explicit_index_space_state.

Definition at line 2030 of file primary_sum_index_space_state.cc.

References sheaf::explicit_index_space_state::id_space_factory(), is_ancestor_of(), sheaf::any::is_same_type(), and primary_sum_index_space_state().

Referenced by class_name().

◆ contains()

bool sheaf::primary_sum_index_space_state::contains ( pod_type  xid) const
virtual

True if this space contains id xid.

Postcondition
  • is_basic_query

Implements sheaf::explicit_index_space_state.

Definition at line 1579 of file primary_sum_index_space_state.cc.

References _members, sheaf::interval_set::contains_member(), and contains_unglued_hub().

Referenced by add_term(), delete_id(), glued_hub_pod(), host_rep(), new_id(), new_primary_term(), operator=(), pod(), unglue(), and unglued_hub_pod().

◆ contains_glued_hub()

bool sheaf::primary_sum_index_space_state::contains_glued_hub ( pod_type  xid) const
virtual

True if this space contains an id equivalent to xid in the glued hub id space.

Postcondition
  • is_basic_query

Reimplemented from sheaf::explicit_index_space_state.

Definition at line 1617 of file primary_sum_index_space_state.cc.

References _members, _rem, sheaf::interval_set::contains_member(), and pod().

Referenced by contains_unglued_hub(), and glued_hub_pod().

◆ contains_rep()

bool sheaf::primary_sum_index_space_state::contains_rep ( pod_type  xhub_id) const
virtual

True if and only if hub id xhub_id is the representative member of its equivalence class.

Postcondition
  • result ? contains_hub(xhub_id) : true

Implements sheaf::sum_index_space_state.

Definition at line 1306 of file primary_sum_index_space_state.cc.

References _rem, sheaf::explicit_index_space_state::contains_hub(), and rep().

Referenced by clear_ids(), glue(), unglue(), and unglue_all().

◆ contains_term_id()

bool sheaf::primary_sum_index_space_state::contains_term_id ( pod_type  xi) const
virtual

True if this map contains the xi-th term.

Postcondition
  • is_basic_query

Implements sheaf::sum_index_space_state.

Definition at line 1428 of file primary_sum_index_space_state.cc.

References _term_id_begin, _term_id_end, sheaf::sum_index_space_state::_terms, and clear().

Referenced by remove_term(), and term_id_end().

◆ contains_unglued_hub()

bool sheaf::primary_sum_index_space_state::contains_unglued_hub ( pod_type  xid) const
virtual

True if this space contains an id equivalent to xid in the unglued hub id space.

Postcondition
  • is_basic_query

Implements sheaf::explicit_index_space_state.

Definition at line 1598 of file primary_sum_index_space_state.cc.

References _members, contains_glued_hub(), and sheaf::interval_set::contains_member().

Referenced by contains(), and unglued_hub_pod().

◆ deep_size()

sheaf::size_type sheaf::primary_sum_index_space_state::deep_size ( bool  xinclude_shallow) const
virtual

The deep size of this.

Postcondition
  • result >= 0

Reimplemented from sheaf::sum_index_space_state.

Definition at line 1516 of file primary_sum_index_space_state.cc.

References sheaf::deep_size(), and operator=().

◆ delete_id()

void sheaf::primary_sum_index_space_state::delete_id ( pod_type  xid)

◆ extend_last_term()

◆ gathered_hub_id_space_name()

const std::string & sheaf::primary_sum_index_space_state::gathered_hub_id_space_name ( )
static

Name of the gathered id space.

Postcondition
  • is_basic_query

Definition at line 1115 of file primary_sum_index_space_state.cc.

References sheaf::poset_path::reserved_prefix(), and update_gathered_id_space().

Referenced by gathered_id_space_excludes_bottom(), and new_gathered_id_space().

◆ gathered_id_space()

const sheaf::index_space_handle & sheaf::primary_sum_index_space_state::gathered_id_space ( ) const

The gathered id space.

Precondition
Postcondition
  • is_basic_query

Definition at line 1058 of file primary_sum_index_space_state.cc.

References _gathered_id_space, and has_gathered_id_space().

Referenced by sheaf::hub_index_space_handle::gathered_id_space(), new_gathered_id_space(), and update_gathered_id_space().

◆ gathered_id_space_excludes_bottom()

bool sheaf::primary_sum_index_space_state::gathered_id_space_excludes_bottom ( ) const

◆ get_id_space()

sheaf::index_space_handle & sheaf::primary_sum_index_space_state::get_id_space ( ) const
virtual

The id space handle with this state.

Postcondition
  • result.is_attached()

Implements sheaf::explicit_index_space_state.

Definition at line 1786 of file primary_sum_index_space_state.cc.

References sheaf::explicit_index_space_state::attach(), sheaf::explicit_index_space_handle::is_attached(), and release_id_space().

Referenced by handle_pool_deep_size().

◆ get_iterator()

sheaf::index_space_iterator & sheaf::primary_sum_index_space_state::get_iterator ( ) const
virtual

Allocates an id space iterator from the iterator pool.

Postcondition
  • result.is_attached()

Implements sheaf::explicit_index_space_state.

Definition at line 1923 of file primary_sum_index_space_state.cc.

References sheaf::explicit_index_space_state::attach(), sheaf::explicit_index_space_iterator::is_attached(), and release_iterator().

Referenced by iterator_pool_deep_size().

◆ glue()

void sheaf::primary_sum_index_space_state::glue ( pod_type  xid,
pod_type  xrep 
)

Glues xid to xrep; adds xid to the equivalence class with representative member xrep.

Precondition
  • contains_unique_rep(xid)
  • contains_rep(xrep)
  • term_id(xid) > term_id(xrep)
Todo:
Modify the term maps?
Postcondition
  • !contains_rep(xid)
  • glued_hub_pod(xid) == xrep

Definition at line 869 of file primary_sum_index_space_state.cc.

References _rem, sheaf::sum_index_space_state::_rem_inv, contains_rep(), sheaf::sum_index_space_state::contains_unique_rep(), glued_hub_pod(), invariant(), sheaf::sum_index_space_state::term_id(), and unglue().

Referenced by sheaf::hub_index_space_handle::glue(), and update_extrema().

◆ glued_hub_pod()

sheaf::explicit_index_space_state::pod_type sheaf::primary_sum_index_space_state::glued_hub_pod ( pod_type  xid) const
virtual

The pod index in the glued primary sum id space equivalent to xid in this id space.

Postcondition
  • !is_valid(result) || contains_glued_hub(result)

Reimplemented from sheaf::explicit_index_space_state.

Definition at line 1689 of file primary_sum_index_space_state.cc.

References _rem, contains(), contains_glued_hub(), handle_pool_ct(), sheaf::invalid_pod_index(), and sheaf::is_valid().

Referenced by glue(), and unglued_hub_pod().

◆ handle_pool_ct()

sheaf::size_type sheaf::primary_sum_index_space_state::handle_pool_ct ( )
static

The number of handles in the pool.

Postcondition
  • result >= 0

Definition at line 1748 of file primary_sum_index_space_state.cc.

References handle_pool_deep_size().

Referenced by glued_hub_pod().

◆ handle_pool_deep_size()

sheaf::size_type sheaf::primary_sum_index_space_state::handle_pool_deep_size ( )
static

The deep size of the handle pool.

Postcondition
  • result >= 0

Definition at line 1767 of file primary_sum_index_space_state.cc.

References sheaf::deep_size(), and get_id_space().

Referenced by handle_pool_ct().

◆ has_gathered_id_space()

bool sheaf::primary_sum_index_space_state::has_gathered_id_space ( ) const

◆ has_gluing()

bool sheaf::primary_sum_index_space_state::has_gluing ( ) const

Ture if there is any gluing.

Postcondition
  • is_basic_query

Definition at line 979 of file primary_sum_index_space_state.cc.

References _rem, and new_gathered_id_space().

Referenced by sheaf::hub_index_space_handle::has_gluing(), and unglue_all().

◆ has_only_standard_ids()

bool sheaf::primary_sum_index_space_state::has_only_standard_ids ( ) const

True if and only if there are only standard ids.

Postcondition
  • is_basic_query

Definition at line 1236 of file primary_sum_index_space_state.cc.

References _standard_id_end, clear_ids(), and sheaf::explicit_index_space_state::end().

Referenced by clear_ids(), sheaf::hub_index_space_handle::has_only_standard_ids(), and update_standard_ids().

◆ host_rep()

sheaf::primary_sum_index_space_state::pod_type sheaf::primary_sum_index_space_state::host_rep ( pod_type  xhub_id) const
virtual

The host id associated with the representative member of the equivalence class of hub id xhub_id.

Precondition
  • contains_hub(xhub_id)
Postcondition
  • contains(result)

Implements sheaf::sum_index_space_state.

Definition at line 1367 of file primary_sum_index_space_state.cc.

References contains(), sheaf::explicit_index_space_state::contains_hub(), rep(), and term_id_begin().

Referenced by rep().

◆ interval_is_available()

bool sheaf::primary_sum_index_space_state::interval_is_available ( pod_type  xbegin,
pod_type  xend 
) const

True if the ids in the interval [xbegin, xend) are available in this space.

Precondition
  • xbegin < xend
Postcondition
  • is_basic_query

Definition at line 613 of file primary_sum_index_space_state.cc.

References sheaf::sum_index_space_state::_term_begin, sheaf::sum_index_space_state::_term_end, _term_id_begin, _term_id_end, and term_prefix().

Referenced by add_term(), sheaf::hub_index_space_handle::interval_is_available(), interval_is_empty(), new_primary_term(), and reserved_interval_is_available().

◆ interval_is_empty()

bool sheaf::primary_sum_index_space_state::interval_is_empty ( pod_type  xbegin,
pod_type  xend 
) const

True if all ids in the interval [xbegin, xend) are not in this space.

Precondition
  • xbegin < xend
Postcondition
  • is_basic_query

Definition at line 592 of file primary_sum_index_space_state.cc.

References _members, interval_is_available(), and sheaf::interval_set::interval_is_empty().

Referenced by add_term(), sheaf::hub_index_space_handle::interval_is_empty(), interval_is_full(), and remove_term().

◆ interval_is_full()

bool sheaf::primary_sum_index_space_state::interval_is_full ( pod_type  xbegin,
pod_type  xend 
) const

True if all ids in the interval [xbegin, xend) are in this space.

Precondition
  • xbegin < xend
Postcondition
  • is_basic_query

Definition at line 571 of file primary_sum_index_space_state.cc.

References _members, interval_is_empty(), and sheaf::interval_set::interval_is_full().

Referenced by extend_last_term(), sheaf::hub_index_space_handle::interval_is_full(), and new_primary_term().

◆ invariant()

◆ is_ancestor_of()

bool sheaf::primary_sum_index_space_state::is_ancestor_of ( const any other) const
virtual

Conformance test; true if other conforms to this.

Precondition
  • other != 0

Reimplemented from sheaf::sum_index_space_state.

Definition at line 2081 of file primary_sum_index_space_state.cc.

References invariant().

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

◆ is_valid_reserved_id()

bool sheaf::primary_sum_index_space_state::is_valid_reserved_id ( pod_type  xid) const

True if and only if the reserved term containing xid is already a reserved term or is available for allocation.

Postcondition
  • is_basic_query

Definition at line 280 of file primary_sum_index_space_state.cc.

References sheaf::sum_index_space_state::_terms, sheaf::is_valid(), next_id(), reserved_interval_is_available(), and sheaf::sum_index_space_state::term_id().

Referenced by delete_id(), sheaf::hub_index_space_handle::is_valid_reserved_id(), and new_id().

◆ iterator_pool_ct()

sheaf::size_type sheaf::primary_sum_index_space_state::iterator_pool_ct ( )
static

The number of iterators in the pool.

Postcondition
  • result >= 0

Definition at line 1885 of file primary_sum_index_space_state.cc.

References iterator_pool_deep_size().

Referenced by allocated_id_space().

◆ iterator_pool_deep_size()

sheaf::size_type sheaf::primary_sum_index_space_state::iterator_pool_deep_size ( )
static

The deep size of the iterator pool.

Postcondition
  • result >= 0

Definition at line 1904 of file primary_sum_index_space_state.cc.

References sheaf::deep_size(), and get_iterator().

Referenced by iterator_pool_ct().

◆ new_gathered_id_space()

const sheaf::index_space_handle & sheaf::primary_sum_index_space_state::new_gathered_id_space ( bool  xexclude_bottom)

◆ new_id() [1/2]

◆ new_id() [2/2]

◆ new_primary_term() [1/2]

sheaf::primary_sum_index_space_state::pod_type sheaf::primary_sum_index_space_state::new_primary_term ( size_type  xct)

Create a new primary term [next_id(), next_id()+xct). Returns the index of the term created.

Precondition
Postcondition
  • interval_is_full(old_next_id, old_next_id+xct)
  • ct() == old_ct + xct

Definition at line 344 of file primary_sum_index_space_state.cc.

References _next_id, contains(), sheaf::explicit_index_space_state::ct(), sheaf::explicit_index_space_state::id_spaces(), interval_is_available(), interval_is_full(), invariant(), next_id(), and term_id_end().

Referenced by sheaf::hub_index_space_handle::new_primary_term(), and next_id().

◆ new_primary_term() [2/2]

sheaf::primary_sum_index_space_state::pod_type sheaf::primary_sum_index_space_state::new_primary_term ( pod_type  xid,
size_type  xct 
)

Create a new primary term [xid, xid+xct). Returns the index of the term created.

Precondition
  • interval_is_available(xid, xid+xct)
Postcondition
  • interval_is_full(xid, xid+xct)
  • ct() == old_ct + xct

Definition at line 374 of file primary_sum_index_space_state.cc.

References sheaf::explicit_index_space_state::_ct, _members, add_term(), contains(), sheaf::explicit_index_space_state::ct(), sheaf::explicit_index_space_state::id_spaces(), sheaf::explicit_index_space_handle::index(), sheaf::interval_set::insert_interval(), interval_is_available(), interval_is_full(), invariant(), sheaf::primary_index_space_state::new_space(), next_term_name(), remove_term(), term_id_end(), and update_extrema().

◆ new_reserved_term() [1/2]

sheaf::primary_sum_index_space_state::pod_type sheaf::primary_sum_index_space_state::new_reserved_term ( )
protected

Creates a new reserved term starting above next_hub_id(). Returns the index of the term created.

Postcondition
  • _reserved_term.offset() >= old_next_id

Definition at line 685 of file primary_sum_index_space_state.cc.

References _next_id, _reserved_term, _term_id_end, next_id(), sheaf::primary_index_space_handle::offset(), sheaf::RESERVED_TERM_SIZE, sheaf::sum_index_space_state::term_end(), and term_id_end().

Referenced by new_id(), and next_term_name().

◆ new_reserved_term() [2/2]

sheaf::primary_sum_index_space_state::pod_type sheaf::primary_sum_index_space_state::new_reserved_term ( pod_type  xid)
protected

◆ new_space() [1/2]

sheaf::hub_index_space_handle sheaf::primary_sum_index_space_state::new_space ( index_space_family xid_spaces,
const std::string &  xname 
)
static

Create a new primary sum id space in the id space family xid_space at the next available id space index with name xname. Returns a handle to the id space created.

Precondition
  • !xname.empty()
  • !xid_spaces.contains(xname)
Postcondition
  • &result.id_spaces() == &xid_spaces
  • xid_spaces.contains(xname)
  • result.conforms_to_state(xname)
  • result.name() == xname

Definition at line 43 of file primary_sum_index_space_state.cc.

References sheaf::hub_index_space_handle::conforms_to_state(), sheaf::index_space_family::contains(), sheaf::explicit_index_space_handle::id_spaces(), sheaf::explicit_index_space_handle::is_persistent(), and sheaf::index_space_handle::name().

Referenced by sheaf::index_space_family::index_space_family().

◆ new_space() [2/2]

sheaf::hub_index_space_handle sheaf::primary_sum_index_space_state::new_space ( index_space_family xid_spaces,
pod_type  xid,
const std::string &  xname 
)
static

Create a new primary sum id space in the id space family xid_space at the id space index xid with name xname. Returns a handle to the id space created.

Precondition
  • !xid_spaces.contains(xid)
  • xid_spaces.is_explicit_interval(xid)
  • !xname.empty()
  • !xid_spaces.contains(xname)
Postcondition
  • &result.id_spaces() == &xid_spaces
  • xid_spaces.contains(xname)
  • result.conforms_to_state(xname)
  • result.index() == xid
  • result.name() == xname

Definition at line 74 of file primary_sum_index_space_state.cc.

References sheaf::hub_index_space_handle::conforms_to_state(), sheaf::index_space_family::contains(), sheaf::explicit_index_space_handle::id_spaces(), sheaf::explicit_index_space_handle::index(), sheaf::index_space_family::is_explicit_interval(), sheaf::explicit_index_space_handle::is_persistent(), sheaf::index_space_handle::name(), and primary_sum_index_space_state().

◆ next_id()

sheaf::primary_sum_index_space_state::pod_type sheaf::primary_sum_index_space_state::next_id ( ) const

The next available id.

Postcondition
  • is_basic_query

Definition at line 325 of file primary_sum_index_space_state.cc.

References _next_id, and new_primary_term().

Referenced by is_valid_reserved_id(), new_primary_term(), new_reserved_term(), and sheaf::hub_index_space_handle::next_id().

◆ next_term_name()

std::string sheaf::primary_sum_index_space_state::next_term_name ( )
protected

Name of the next term id space.

Postcondition
  • !result.empty()

Definition at line 662 of file primary_sum_index_space_state.cc.

References new_reserved_term(), term_id_end(), and term_prefix().

Referenced by new_primary_term(), new_reserved_term(), and term_prefix().

◆ operator=()

sheaf::primary_sum_index_space_state & sheaf::primary_sum_index_space_state::operator= ( const explicit_index_space_state xother)
protectedvirtual

Assignment operator.

Precondition
  • is_ancestor_of(&xother)
Postcondition
  • (*this) == xother

Reimplemented from sheaf::sum_index_space_state.

Definition at line 1537 of file primary_sum_index_space_state.cc.

References _members, _next_id, _rem, _reserved_term, _standard_id_end, _term_id_begin, _term_id_end, contains(), invariant(), and is_ancestor_of().

Referenced by deep_size().

◆ operator==()

bool sheaf::primary_sum_index_space_state::operator== ( const explicit_index_space_state xother) const
virtual

True if this is equivalent to xother.

Precondition
  • is_ancestor_of(&xother)
Error:
Since we still support tr1 unordered_maps the comparison operator may not be supported. See COM-374.

Reimplemented from sheaf::sum_index_space_state.

Definition at line 1485 of file primary_sum_index_space_state.cc.

References _members, _next_id, _reserved_term, _standard_id_end, _term_id_begin, _term_id_end, deep_size, is_ancestor_of(), and sheaf::sum_index_space_state::operator==().

Referenced by clear().

◆ pod()

sheaf::explicit_index_space_state::pod_type sheaf::primary_sum_index_space_state::pod ( pod_type  xid) const
virtual

The pod index in this space equivalent to xid in the hub id space.

Postcondition
  • !is_valid(result) || contains(result)

Implements sheaf::explicit_index_space_state.

Definition at line 1644 of file primary_sum_index_space_state.cc.

References contains(), sheaf::explicit_index_space_state::contains_hub(), sheaf::invalid_pod_index(), sheaf::is_valid(), and unglued_hub_pod().

Referenced by contains_glued_hub().

◆ release_id_space()

void sheaf::primary_sum_index_space_state::release_id_space ( index_space_handle xid_space) const
virtual

Release the id space handle xid_space.

Precondition
  • allocated_id_space(xid_space)
Postcondition
  • is_basic_query

Implements sheaf::explicit_index_space_state.

Definition at line 1806 of file primary_sum_index_space_state.cc.

References allocated_id_space(), and sheaf::index_space_handle::detach().

Referenced by get_id_space().

◆ release_iterator()

void sheaf::primary_sum_index_space_state::release_iterator ( index_space_iterator xitr) const
virtual

Returns the id space iterator xitr to the iterator pool.

Precondition
  • allocated_iterator(xitr)
Postcondition
  • is_basic_query

Implements sheaf::explicit_index_space_state.

Definition at line 1943 of file primary_sum_index_space_state.cc.

References allocated_iterator(), and sheaf::index_space_iterator::detach().

Referenced by get_iterator().

◆ remove_term()

◆ rep()

sheaf::primary_sum_index_space_state::pod_type sheaf::primary_sum_index_space_state::rep ( pod_type  xhub_id) const
virtual

The representative member of the equivalence class of hub id xhub_id.

Precondition
  • contains_hub(xhub_id)
Postcondition
  • is_basic_query

Implements sheaf::sum_index_space_state.

Definition at line 1332 of file primary_sum_index_space_state.cc.

References _rem, sheaf::explicit_index_space_state::contains_hub(), and host_rep().

Referenced by contains_rep(), and host_rep().

◆ reserved_interval_is_available()

bool sheaf::primary_sum_index_space_state::reserved_interval_is_available ( pod_type  xid) const
protected

True if the reserved interval for id xid is available for allocation.

Definition at line 810 of file primary_sum_index_space_state.cc.

References interval_is_available(), sheaf::RESERVED_TERM_SIZE, and update_extrema().

Referenced by add_term(), and is_valid_reserved_id().

◆ term_id_begin()

sheaf::primary_sum_index_space_state::pod_type sheaf::primary_sum_index_space_state::term_id_begin ( ) const
virtual

Beginning index of the terms in this sum.

Postcondition
  • is_basic_query

Implements sheaf::sum_index_space_state.

Definition at line 1390 of file primary_sum_index_space_state.cc.

References _term_id_begin, and term_id_end().

Referenced by host_rep(), and remove_term().

◆ term_id_end()

sheaf::primary_sum_index_space_state::pod_type sheaf::primary_sum_index_space_state::term_id_end ( ) const
virtual

Ending index of the terms in this sum.

Postcondition
  • is_basic_query

Implements sheaf::sum_index_space_state.

Definition at line 1409 of file primary_sum_index_space_state.cc.

References _term_id_end, and contains_term_id().

Referenced by add_term(), extend_last_term(), new_primary_term(), new_reserved_term(), next_term_name(), remove_term(), and term_id_begin().

◆ term_prefix()

const std::string & sheaf::primary_sum_index_space_state::term_prefix ( )
staticprotected

Prefix of the term id spaces.

Postcondition
  • !result.empty()

Definition at line 643 of file primary_sum_index_space_state.cc.

References next_term_name().

Referenced by interval_is_available(), and next_term_name().

◆ unglue()

void sheaf::primary_sum_index_space_state::unglue ( pod_type  xid)

Unglues xid; makes xid its own representative.

Precondition
  • contains(xid)
  • !contains_rep(xid)
Todo:
Modify the term maps?
Postcondition
  • contains_unique_rep(xid)

Definition at line 897 of file primary_sum_index_space_state.cc.

References _rem, sheaf::sum_index_space_state::_rem_inv, contains(), contains_rep(), sheaf::sum_index_space_state::contains_unique_rep(), sheaf::explicit_index_space_state::hub_pod(), invariant(), and unglue_all().

Referenced by glue(), and sheaf::hub_index_space_handle::unglue().

◆ unglue_all()

void sheaf::primary_sum_index_space_state::unglue_all ( pod_type  xrep_id)

Unglue all ids glued to representative xrep_id; makes each id in the equivalence class of xrep_id its own representative.

Precondition
  • contains_rep(xrep_id)
Todo:
Modify the term maps.
Postcondition
  • contains_unique_rep(xrep_id)

Definition at line 942 of file primary_sum_index_space_state.cc.

References _rem, sheaf::sum_index_space_state::_rem_inv, contains_rep(), sheaf::sum_index_space_state::contains_unique_rep(), has_gluing(), and invariant().

Referenced by unglue(), and sheaf::hub_index_space_handle::unglue_all().

◆ unglued_hub_pod()

sheaf::explicit_index_space_state::pod_type sheaf::primary_sum_index_space_state::unglued_hub_pod ( pod_type  xid) const
virtual

The pod index in the unglued hub id space equivalent to xid in this id space.

Postcondition
  • !is_valid(result) || contains_unglued_hub(result)

Implements sheaf::explicit_index_space_state.

Definition at line 1670 of file primary_sum_index_space_state.cc.

References contains(), contains_unglued_hub(), glued_hub_pod(), sheaf::invalid_pod_index(), and sheaf::is_valid().

Referenced by pod().

◆ update_extrema()

◆ update_gathered_id_space() [1/2]

◆ update_gathered_id_space() [2/2]

◆ update_standard_ids()

void sheaf::primary_sum_index_space_state::update_standard_ids ( )

Friends And Related Function Documentation

◆ deep_size

SHEAF_DLL_SPEC size_t deep_size ( const primary_sum_index_space_state xn,
bool  xinclude_shallow 
)
friend

The deep size of primary_sum_index_space_state& xn.

Referenced by sheaf::deep_size(), and operator==().

Member Data Documentation

◆ _gathered_id_space

interval_index_space_handle sheaf::primary_sum_index_space_state::_gathered_id_space
protected

◆ _members

◆ _next_id

pod_type sheaf::primary_sum_index_space_state::_next_id
protected

The next available id.

Definition at line 269 of file primary_sum_index_space_state.h.

Referenced by add_term(), new_primary_term(), new_reserved_term(), next_id(), operator=(), and operator==().

◆ _rem

rem_type sheaf::primary_sum_index_space_state::_rem
protected

◆ _reserved_term

reserved_primary_index_space_handle sheaf::primary_sum_index_space_state::_reserved_term
protected

The current reserved term.

Definition at line 274 of file primary_sum_index_space_state.h.

Referenced by new_id(), new_reserved_term(), operator=(), and operator==().

◆ _reserved_term_ids

unordered::unordered_set<pod_type> sheaf::primary_sum_index_space_state::_reserved_term_ids
protected

The set of reserved term ids.

Definition at line 279 of file primary_sum_index_space_state.h.

◆ _standard_id_end

pod_type sheaf::primary_sum_index_space_state::_standard_id_end
protected

The end id of the standard ids.

Definition at line 406 of file primary_sum_index_space_state.h.

Referenced by clear_ids(), has_only_standard_ids(), operator=(), operator==(), and update_standard_ids().

◆ _term_id_begin

pod_type sheaf::primary_sum_index_space_state::_term_id_begin
protected

Beginning index of the terms in this sum.

Definition at line 472 of file primary_sum_index_space_state.h.

Referenced by clear(), contains_term_id(), interval_is_available(), operator=(), operator==(), remove_term(), and term_id_begin().

◆ _term_id_end

pod_type sheaf::primary_sum_index_space_state::_term_id_end
protected

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