SheafSystem  0.0.0.0
sheaf::id_block Class Reference

A block of ids all in the same id space. More...

#include <id_block.h>

Inheritance diagram for sheaf::id_block:
sheaf::block< scoped_index > sheaf::auto_block< T, S >

Public Member Functions

virtual bool is_ancestor_of (const any *other) const
 Conformance test; true if other conforms to this. More...
 
virtual id_blockclone () const
 Virtual constructor, makes a new instance of the same type as this. More...
 
id_blockoperator= (const id_block &xother)
 Assignment operator. More...
 
virtual bool invariant () const
 Class invariant. More...
 
 id_block (const id_block &xother)
 Copy constructor. More...
 
virtual ~id_block ()
 Destructor. More...
 
 id_block (const poset_state_handle &xhost, const index_space_handle &xid_space, int xub, const scoped_index *xids=0, int xct=0)
 Creates an instance with host() == xhost, id space == xid_space, ub() == xub, and xct ids copied from xids. More...
 
poset_state_handlehost ()
 The poset that id_space resides in (mutable version). More...
 
const poset_state_handlehost () const
 The poset that id_space resides in (const version). More...
 
const index_space_handleid_space () const
 The id space the ids in this block belong to. More...
 
void put_id_space (const index_space_handle &xnew_id_space, bool xauto_access)
 Sets space() to xid_space and translates the ids. More...
 
void put_member_id_space (bool xauto_access)
 Sets space() to host().member_id_space() and translates the ids. More...
 
bool is_member_hub_id_space () const
 True if space() == host().member_hub_id_space(). More...
 
- Public Member Functions inherited from sheaf::block< scoped_index >
 block (index_type xub=0)
 Creates an instance with ub() == xub; storage is uninitialized. More...
 
 block (index_type xub, size_type xct, const scoped_index *xitems)
 Creates an instance with ub() == xub; storage is initialized with xct items copied from xitems. More...
 
 block (const block &xother)
 Copy constructor. More...
 
blockoperator= (const block &xother)
 Assignment operator. More...
 
 ~block ()
 Destructor. More...
 
- Public Member Functions inherited from sheaf::auto_block< T, S >
pointer_type base () const
 The underlying storage array. More...
 
size_type ct () const
 The number of items currently in use. More...
 
bool invariant () const
 The class invariant. More...
 
reference_type item (index_type xindex) const
 The item at index xindex. More...
 
reference_type operator[] (index_type xindex) const
 The item at index xindex. More...
 
index_type ub () const
 The upper bound on the storage array. The number of items current allocated in the storage array. More...
 
 auto_block (index_type xub=0)
 Creates an instance with ub() == xub; storage is uninitialized. More...
 
 auto_block (index_type xub, size_type xct, const T *xitems)
 Creates an instance with ub() == xub; storage is initialized with xct items copied from xitems. More...
 
 auto_block (const auto_block &xother)
 Copy constructor. More...
 
auto_blockoperator= (const auto_block &xother)
 Assignment operator. More...
 
virtual ~auto_block ()
 Destructor. More...
 
void force_item (index_type xindex, const_reference_type xitem)
 Puts the item xitem at index xindex, resizing if necessary; any other new storage allocated is uninitialized. More...
 
void reserve (index_type xub)
 Makes ub() at least xub; if new storage is allocated, it is uninitialized. More...
 
void set_ct (size_type xct)
 Sets ct() == xct. More...
 
void set_item (index_type xindex, const_reference_type xitem)
 Puts the item xitem at index xindex, but will not resize. More...
 
void assign (const_reference_type xitem)
 Sets the values of all items to xitem. More...
 
void assign (index_type xbegin, index_type xend, const_reference_type xitem)
 Sets the values of items with xbegin <= index < xend to xitem. More...
 
reference_type back () const
 The last item in the auto_block. More...
 
void push_back (const_reference_type item)
 Insert item at the end of the items in the auto_block. More...
 
void push_back (const auto_block &xother)
 Appends xother to the back of this. More...
 
void pop_back ()
 Remove item at the back. More...
 
void clear ()
 Remove all items. More...
 
void initialize (index_type xindex)
 Invokes the initialization policy on the item at xindex. More...
 
void initialize (index_type xbegin, index_type xend)
 Invokes the initialization policy on the range [xbegin, xend). More...
 

Additional Inherited Members

- Public Types inherited from sheaf::block< scoped_index >
typedef auto_block< scoped_index, un_block_initialization_policy< scoped_index > > base_type
 
typedef base_type::index_type index_type
 
typedef base_type::size_type size_type
 
- Public Types inherited from sheaf::auto_block< T, S >
typedef T value_type
 The type of value stored in the container. More...
 
typedef S initialization_policy
 The value initialization policy. More...
 
typedef T & reference_type
 A type that behaves as a reference to the container's value type. More...
 
typedef const T & const_reference_type
 A type that behaves as a const reference to the container's value type. More...
 
typedef T * pointer_type
 A type that behaves as a pointer to the container's value type. More...
 
typedef const T * const_pointer_type
 A type that behaves as a const pointer to the container's value type. More...
 
typedef sheaf::pod_index_type index_type
 The containers index type. More...
 
typedef signed long int difference_type
 A signed integral type used to represent the difference of two indices or iterators. More...
 
typedef unsigned long int size_type
 An unsigned integral type used to represent sizes and capacities. More...
 
- Protected Attributes inherited from sheaf::auto_block< T, S >
pointer_type _base
 Start of storage for this. More...
 
index_type _ub
 The index upper bound. More...
 
size_type _ct
 The number of items currently stored. More...
 

Detailed Description

A block of ids all in the same id space.

Definition at line 48 of file id_block.h.

Constructor & Destructor Documentation

◆ id_block() [1/2]

sheaf::id_block::id_block ( const id_block xother)

Copy constructor.

Postcondition

Definition at line 135 of file id_block.cc.

References sheaf::index_space_handle::get_id_space(), invariant(), and ~id_block().

◆ ~id_block()

sheaf::id_block::~id_block ( )
virtual

Destructor.

Definition at line 159 of file id_block.cc.

References sheaf::index_space_handle::release_id_space().

Referenced by id_block().

◆ id_block() [2/2]

sheaf::id_block::id_block ( const poset_state_handle xhost,
const index_space_handle xid_space,
int  xub,
const scoped_index xids = 0,
int  xct = 0 
)

Creates an instance with host() == xhost, id space == xid_space, ub() == xub, and xct ids copied from xids.

Precondition
  • xhost.is_attached()
  • xhost.member_id_spaces(true).contains(xid_space.index())
  • xub >= 0
  • (0 <= xct) && (xct <= xub)
  • (xids != 0) == (xct > 0)
Postcondition
  • for(int i = ( 0 ); i < ( xct ); ++ i ) item(i) == xids[i]

Definition at line 180 of file id_block.cc.

References sheaf::index_space_family::contains(), sheaf::auto_block< T, S >::ct(), sheaf::index_space_handle::get_id_space(), host(), id_space(), sheaf::index_space_handle::index(), sheaf::poset_state_handle::is_attached(), sheaf::auto_block< T, S >::item(), sheaf::poset_state_handle::member_id_spaces(), and sheaf::auto_block< T, S >::ub().

Member Function Documentation

◆ clone()

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

Virtual constructor, makes a new instance of the same type as this.

Postcondition
  • result != 0
  • -unexecutable( "is_same_type(result)" )

Definition at line 55 of file id_block.cc.

References host(), id_space(), operator=(), and sheaf::auto_block< T, S >::ub().

Referenced by is_ancestor_of().

◆ host() [1/2]

sheaf::poset_state_handle & sheaf::id_block::host ( )

The poset that id_space resides in (mutable version).

Definition at line 216 of file id_block.cc.

Referenced by clone(), id_block(), invariant(), is_member_hub_id_space(), sheaf::operator<<(), put_id_space(), and put_member_id_space().

◆ host() [2/2]

const sheaf::poset_state_handle & sheaf::id_block::host ( ) const

The poset that id_space resides in (const version).

Definition at line 224 of file id_block.cc.

References id_space().

◆ id_space()

const sheaf::index_space_handle & sheaf::id_block::id_space ( ) const

The id space the ids in this block belong to.

Definition at line 233 of file id_block.cc.

References put_id_space().

Referenced by clone(), host(), id_block(), is_member_hub_id_space(), sheaf::operator<<(), put_id_space(), and put_member_id_space().

◆ invariant()

bool sheaf::id_block::invariant ( ) const
virtual

Class invariant.

Invariant

Definition at line 110 of file id_block.cc.

References host().

Referenced by id_block(), is_member_hub_id_space(), and operator=().

◆ is_ancestor_of()

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

Conformance test; true if other conforms to this.

Precondition
  • other != 0

Definition at line 35 of file id_block.cc.

References clone().

◆ is_member_hub_id_space()

bool sheaf::id_block::is_member_hub_id_space ( ) const

◆ operator=()

sheaf::id_block & sheaf::id_block::operator= ( const id_block xother)

Assignment operator.

Postcondition

Definition at line 82 of file id_block.cc.

References sheaf::index_space_handle::get_id_space(), invariant(), and sheaf::block< T >::operator=().

Referenced by clone().

◆ put_id_space()

void sheaf::id_block::put_id_space ( const index_space_handle xnew_id_space,
bool  xauto_access 
)

◆ put_member_id_space()

void sheaf::id_block::put_member_id_space ( bool  xauto_access)

Sets space() to host().member_id_space() and translates the ids.

Precondition
  • xauto_access || host().state_is_read_accessible()
Postcondition

Definition at line 306 of file id_block.cc.

References host(), id_space(), is_member_hub_id_space(), and put_id_space().

Referenced by put_id_space().


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