SheafSystem  0.0.0.0
sheaf::record_set Class Referenceabstract

An abstract, indexed collection of records on secondary storage. More...

#include <record_set.h>

Inheritance diagram for sheaf::record_set:
sheaf::any sheaf::attributes_record_set sheaf::dof_tuple_record_set sheaf::member_record_set

Public Member Functions

virtual record_setclone () const
 Virtual constructor; makes a new instance of the same type as this. Not implemented since this class is abstract. More...
 
virtual bool invariant () const
 Class invariant. More...
 
virtual bool is_ancestor_of (const any *other) const
 Conformance test; true if other conforms to this. More...
 
 record_set (const sheaf_file &xfile, int xrecord_buffer_ub, const poset_scaffold &xscaffold)
 Creates an instance attached to the record_set with name xname in the file xfile, using record packets of size xpacket_ub. More...
 
 record_set (const record_set &xother)
 Copy constructor. More...
 
virtual ~record_set ()
 Destructor. More...
 
const sheaf_filefile () const
 The file this record_set belongs to. More...
 
std::string name () const
 The name of this data set. More...
 
std::string alias () const
 The standard alias for this data set. More...
 
virtual const std::string & suffix () const
 The name suffix for this data set. More...
 
std::string data_set_name (const std::string &xname) const
 The data set name for a poset with name xname. More...
 
std::string data_set_alias (const std::string &xname) const
 The data set alias for a poset with name xname. More...
 
std::string poset_name () const
 The name of the poset this represents, extracted from the name of the dataset. More...
 
poset_scaffoldscaffold ()
 Scaffold for constructing poset associated with this record set (mutable version). More...
 
const poset_scaffoldscaffold () const
 Scaffold for constructing poset associated with this record set (const version). More...
 
poset_data_type_maptype_map ()
 Data type map for records in this record set (mutable version) More...
 
const poset_data_type_maptype_map () const
 Data type map for records in this record set (const version) More...
 
virtual void open ()
 Opens the record_set. More...
 
bool is_open () const
 True if this record_set is open. More...
 
virtual void close ()
 Closes the record_set. More...
 
int record_buffer_ct () const
 The number of active records in record buffer. More...
 
void inc_record_buffer_ct ()
 The increment the number of active records in record buffer. More...
 
void reset_record_buffer_ct ()
 The set the number of active records in record buffer to 0. More...
 
int record_buffer_ub () const
 The maximum number of records the buffer can hold. More...
 
bool record_buffer_is_empty () const
 True if there are no active records in the buffer. More...
 
bool record_buffer_is_full () const
 True if there are no inactive records in the buffer. 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...
 

Static Public Member Functions

static const std::string & name_space_alias ()
 The reserved, standard alias for the namespace in the file. More...
 
static const std::string & name_space_prefix ()
 The reserved, standard prefix for namespace dataser names. More...
 

Protected Member Functions

virtual hid_t create_dataset ()=0
 Creates a new HDF datset. Defined in descendants. More...
 
virtual void create_int_data_type ()=0
 Creates a new HDF internal data type. Defined in descendants. More...
 
void extend_dataset (const hsize_t *xdims, int xdims_ub)
 Extends the dataset dimensions to at least the dimensions given xdims, an array of length xdims_ub. More...
 
void create_alias ()
 Creates a soft link from alias to the data set. More...
 
void set_name_from_alias ()
 Sets the primary name of the dataset from the alias. More...
 
hid_t hdf_id ()
 The HDF id for this record set. More...
 
hid_t ext_dataspace_hdf_id ()
 The HDF id for the external dataspace of this record set. More...
 
hid_t ext_data_type_hdf_id ()
 The HDF external data type id for this record set. More...
 
int ext_dataspace_rank ()
 The rank of the dataspace for the record_set. More...
 
hsize_t ext_dataspace_dim (int xi)
 The dimension of xi-th index of the external dataspace. More...
 
hid_t int_dataspace_hdf_id ()
 The hdf5 id of the internal dataspace associated with the record buffer. More...
 
hid_t int_data_type_hdf_id ()
 The HDF internal data type id for this record set. More...
 
virtual void read_dataset_attributes ()
 Opens and reads the dataset attribute objects from the file. A stub in this class, intended to be redefined in descendants. More...
 
virtual void write_dataset_attributes ()
 Writes the dataset attribute objects into the file. A stub in this class, intended to be redefined in descendants. More...
 
void read_attribute (const char *&xatt_values, size_type &xatt_ct, const data_converter *xatt_conv, const std::string &xatt_name)
 Reads the attribute with name xatt_name from the file. More...
 
void write_attribute (const void *xatt_values, size_type xatt_ct, const data_converter *xatt_conv, const std::string &xatt_name)
 Writes the attribute with name xatt_name into the file. More...
 
- Protected Member Functions inherited from sheaf::any
 any ()
 default constructor More...
 

Protected Attributes

sheaf_file_file
 The file this record_set belongs to. More...
 
std::string _name
 The name of this record_set. More...
 
std::string _alias
 The standard alias for this record_set. More...
 
poset_scaffold_scaffold
 The poset scaffold associated with this. More...
 
hid_t _hdf_id
 The HDF id for this record set. More...
 
hid_t _ext_dataspace_hdf_id
 The HDF id for the external dataspace of this record set. More...
 
hid_t _ext_data_type_hdf_id
 The HDF external data type id for this record set. More...
 
int _ext_dataspace_rank
 The rank of the dataspace for the record_set. More...
 
hsize_t * _ext_dataspace_dims
 The current dimensions of the external dataspace. More...
 
int _record_buffer_ct
 The number of active records in record buffer. More...
 
int _record_buffer_ub
 The maximum number of records the buffer can hold. More...
 
hid_t _int_dataspace_hdf_id
 The hdf5 id of the dataspace associated with the record buffer. More...
 
hid_t _int_data_type_hdf_id
 The HDF internal data type id for this record set. More...
 

Static Protected Attributes

static const hid_t NOT_AN_HDF_ID = -1
 Value indicating an invalid HDf object id. /. More...
 

Detailed Description

An abstract, indexed collection of records on secondary storage.

Design overview:

A record is a group of related data items that the i/o subsystem wants to process as a unit for some reason. There are 5 types of records: poset_general_record various general attributes of a poset member_names_record (index, name) pairs for each entry in the member names table subposet_names_record (index, name) pairs for each entry in the subposet names table id_space_names_record (index, name) pair for each id space member_record all member specific data, including dof_tuple_id, links, and subposet membership, id space membership table_dof_tuple_record. all the dofs for a single table dof tuple dof_tuple_record. all the dofs for a single row dof tuple

A record_set is a single index array of records. There are three types of record sets: attributes_record_set poset_general_record, table_dof_tuple_record, member_names_record, subposet_names_record, and id_space_names_record member_record_set one member_record for each member dof_tuple_record_set one dof_tuple_record for each dof_tuple

The attributes_record_set and member_record_set are implemented as HDF datasets containing dataspaces of rank 1 and datatype variable length of char. The single index of the dataspace is the record index and the poset_general_, table_dof_tuple_, member_names_, subposet_names_, id_space_names_and member_ records are all implemented as instances of HDF variable length of char.

HDF variable length data types require two buffers be allocated: 1) a "hdf buffer" storing the hvl_t structs that store the address and length of the variable length data and 2) an "external buffer" storing the actual variable length data. this buffer is called "external" because it contains data in external format. In addition, there is an "internal buffer" that stores the data in internal form. The internal buffer collects together the data in the record from whatever diverse locations it is stored in the poset object.

Todo:
changes to record hierarchy
  • merge record and variable_length_record
  • introduce the internal buffer as a separate object, rather than giving the record the features of the internal buffer. */

Definition at line 150 of file record_set.h.

Constructor & Destructor Documentation

◆ record_set() [1/2]

sheaf::record_set::record_set ( const sheaf_file xfile,
int  xrecord_buffer_ub,
const poset_scaffold xscaffold 
)

Creates an instance attached to the record_set with name xname in the file xfile, using record packets of size xpacket_ub.

Precondition
  • xfile.is_open()
  • xrecord_buffer_ub > 0
Postcondition
  • !is_open()

Definition at line 136 of file record_set.cc.

References _ext_data_type_hdf_id, _ext_dataspace_hdf_id, _hdf_id, _int_data_type_hdf_id, _int_dataspace_hdf_id, _record_buffer_ct, invariant(), sheaf::sheaf_file::is_open(), is_open(), NOT_AN_HDF_ID, record_buffer_ct(), and record_buffer_ub().

Referenced by is_ancestor_of().

◆ record_set() [2/2]

sheaf::record_set::record_set ( const record_set xother)

Copy constructor.

Not Implemented.

Postcondition

Definition at line 174 of file record_set.cc.

References invariant(), and ~record_set().

◆ ~record_set()

sheaf::record_set::~record_set ( )
virtual

Destructor.

Definition at line 192 of file record_set.cc.

References file().

Referenced by record_set().

Member Function Documentation

◆ alias()

std::string sheaf::record_set::alias ( ) const

◆ clone()

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

Virtual constructor; makes a new instance of the same type as this. Not implemented since this class is abstract.

Not Implemented.

Postcondition
  • result != 0
  • is_same_type(result)

Reimplemented from sheaf::any.

Reimplemented in sheaf::attributes_record_set, sheaf::dof_tuple_record_set, and sheaf::member_record_set.

Definition at line 43 of file record_set.cc.

References invariant().

◆ close()

◆ create_alias()

void sheaf::record_set::create_alias ( )
protected

Creates a soft link from alias to the data set.

Precondition
Postcondition
  • -unexecutable( "link from alias to data set exists" )

Definition at line 849 of file record_set.cc.

References _alias, _name, alias(), file(), hdf_id(), is_open(), name(), and set_name_from_alias().

Referenced by extend_dataset(), and open().

◆ create_dataset()

hid_t sheaf::record_set::create_dataset ( )
protectedpure virtual

Creates a new HDF datset. Defined in descendants.

Precondition
  • file().mode() == sheaf_file::READ_WRITE
Is Abstract.
Postcondition
  • result >= 0

Implemented in sheaf::dof_tuple_record_set, sheaf::member_record_set, and sheaf::attributes_record_set.

Definition at line 718 of file record_set.cc.

References create_int_data_type(), file(), and NOT_AN_HDF_ID.

Referenced by open(), and record_buffer_is_full().

◆ create_int_data_type()

void sheaf::record_set::create_int_data_type ( )
protectedpure virtual

Creates a new HDF internal data type. Defined in descendants.

Precondition
Is Abstract.
Postcondition

Implemented in sheaf::dof_tuple_record_set, sheaf::member_record_set, and sheaf::attributes_record_set.

Definition at line 742 of file record_set.cc.

References extend_dataset(), file(), int_data_type_hdf_id(), and is_open().

Referenced by create_dataset(), and open().

◆ data_set_alias()

std::string sheaf::record_set::data_set_alias ( const std::string &  xname) const

The data set alias for a poset with name xname.

Postcondition

Definition at line 340 of file record_set.cc.

References name_space_alias(), poset_name(), scaffold(), and suffix().

Referenced by sheaf::attributes_record_set::attributes_record_set(), data_set_name(), sheaf::dof_tuple_record_set::dof_tuple_record_set(), and sheaf::member_record_set::member_record_set().

◆ data_set_name()

std::string sheaf::record_set::data_set_name ( const std::string &  xname) const

The data set name for a poset with name xname.

Postcondition

Definition at line 308 of file record_set.cc.

References data_set_alias(), name_space_prefix(), scaffold(), and suffix().

Referenced by sheaf::attributes_record_set::attributes_record_set(), sheaf::dof_tuple_record_set::dof_tuple_record_set(), sheaf::member_record_set::member_record_set(), and suffix().

◆ ext_data_type_hdf_id()

hid_t sheaf::record_set::ext_data_type_hdf_id ( )
protected

The HDF external data type id for this record set.

Definition at line 943 of file record_set.cc.

References _ext_data_type_hdf_id, and ext_dataspace_rank().

Referenced by ext_dataspace_hdf_id().

◆ ext_dataspace_dim()

hsize_t sheaf::record_set::ext_dataspace_dim ( int  xi)
protected

The dimension of xi-th index of the external dataspace.

Precondition

Definition at line 960 of file record_set.cc.

References _ext_dataspace_dims, ext_dataspace_rank(), int_dataspace_hdf_id(), and is_open().

Referenced by ext_dataspace_rank(), and extend_dataset().

◆ ext_dataspace_hdf_id()

hid_t sheaf::record_set::ext_dataspace_hdf_id ( )
protected

The HDF id for the external dataspace of this record set.

Definition at line 936 of file record_set.cc.

References _ext_dataspace_hdf_id, and ext_data_type_hdf_id().

Referenced by hdf_id().

◆ ext_dataspace_rank()

int sheaf::record_set::ext_dataspace_rank ( )
protected

◆ extend_dataset()

void sheaf::record_set::extend_dataset ( const hsize_t *  xdims,
int  xdims_ub 
)
protected

Extends the dataset dimensions to at least the dimensions given xdims, an array of length xdims_ub.

Precondition
Postcondition
  • ext_dataspace_dim(0) >= xdims[0]
  • -unexecutable( "for all 0 <= i < ext_dataspace_rank(): ext_dataspace_dim(i) == xdims[i]" )
Todo:
make above executable and remove first postcondition.

Definition at line 764 of file record_set.cc.

References _ext_dataspace_dims, _ext_dataspace_hdf_id, _hdf_id, create_alias(), ext_dataspace_dim(), ext_dataspace_rank(), and is_open().

Referenced by create_int_data_type(), sheaf::member_record_set::write_selection(), and sheaf::dof_tuple_record_set::write_selection().

◆ file()

◆ hdf_id()

hid_t sheaf::record_set::hdf_id ( )
protected

◆ inc_record_buffer_ct()

void sheaf::record_set::inc_record_buffer_ct ( )

The increment the number of active records in record buffer.

Definition at line 643 of file record_set.cc.

References _record_buffer_ct, and reset_record_buffer_ct().

Referenced by sheaf::member_record_set::externalize(), sheaf::member_record_set::make_internal_dataspace(), sheaf::member_record_set::read_record(), and record_buffer_ct().

◆ int_data_type_hdf_id()

hid_t sheaf::record_set::int_data_type_hdf_id ( )
protected

◆ int_dataspace_hdf_id()

hid_t sheaf::record_set::int_dataspace_hdf_id ( )
protected

The hdf5 id of the internal dataspace associated with the record buffer.

Definition at line 982 of file record_set.cc.

References _int_dataspace_hdf_id, and int_data_type_hdf_id().

Referenced by ext_dataspace_dim().

◆ invariant()

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

◆ is_ancestor_of()

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

Conformance test; true if other conforms to this.

Precondition
  • other != 0

Reimplemented from sheaf::any.

Reimplemented in sheaf::attributes_record_set, sheaf::dof_tuple_record_set, and sheaf::member_record_set.

Definition at line 110 of file record_set.cc.

References record_set().

Referenced by invariant().

◆ is_open()

bool sheaf::record_set::is_open ( ) const

◆ name()

◆ name_space_alias()

const std::string & sheaf::record_set::name_space_alias ( )
static

The reserved, standard alias for the namespace in the file.

Definition at line 268 of file record_set.cc.

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

Referenced by alias(), and data_set_alias().

◆ name_space_prefix()

const std::string & sheaf::record_set::name_space_prefix ( )
static

The reserved, standard prefix for namespace dataser names.

Definition at line 276 of file record_set.cc.

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

Referenced by data_set_name(), name_space_alias(), and poset_name().

◆ open()

◆ poset_name()

std::string sheaf::record_set::poset_name ( ) const

The name of the poset this represents, extracted from the name of the dataset.

Definition at line 373 of file record_set.cc.

References _name, name_space_prefix(), scaffold(), and suffix().

Referenced by sheaf::storage_agent::begin_read_transaction(), and data_set_alias().

◆ read_attribute()

void sheaf::record_set::read_attribute ( const char *&  xatt_values,
size_type xatt_ct,
const data_converter xatt_conv,
const std::string &  xatt_name 
)
protected

Reads the attribute with name xatt_name from the file.

Precondition
  • xatt_values == 0
  • xatt_ct == 0
  • xatt_conv != 0
  • !xatt_name.empty()
Postcondition
  • (xatt_values == 0) == (xatt_ct == 0)

Definition at line 1045 of file record_set.cc.

References _hdf_id, sheaf::data_converter::internal_size(), sheaf::data_converter::internal_type(), is_open(), sheaf::poset_state_handle::name(), scaffold(), sheaf::poset_scaffold::structure(), and write_attribute().

Referenced by write_dataset_attributes().

◆ read_dataset_attributes()

void sheaf::record_set::read_dataset_attributes ( )
protectedvirtual

Opens and reads the dataset attribute objects from the file. A stub in this class, intended to be redefined in descendants.

Precondition
Postcondition
  • -unexecutable( "all attributes opened, read, and closed" )

Reimplemented in sheaf::attributes_record_set.

Definition at line 1000 of file record_set.cc.

References is_open(), and write_dataset_attributes().

Referenced by int_data_type_hdf_id(), and open().

◆ record_buffer_ct()

◆ record_buffer_is_empty()

bool sheaf::record_set::record_buffer_is_empty ( ) const

◆ record_buffer_is_full()

bool sheaf::record_set::record_buffer_is_full ( ) const

True if there are no inactive records in the buffer.

Definition at line 705 of file record_set.cc.

References _record_buffer_ct, _record_buffer_ub, and create_dataset().

Referenced by sheaf::member_record_set::externalize(), and record_buffer_is_empty().

◆ record_buffer_ub()

◆ reset_record_buffer_ct()

◆ scaffold() [1/2]

◆ scaffold() [2/2]

const sheaf::poset_scaffold & sheaf::record_set::scaffold ( ) const

Scaffold for constructing poset associated with this record set (const version).

Definition at line 424 of file record_set.cc.

References _scaffold, and type_map().

◆ set_name_from_alias()

void sheaf::record_set::set_name_from_alias ( )
protected

Sets the primary name of the dataset from the alias.

Precondition
Postcondition
  • !name().empty()

Definition at line 879 of file record_set.cc.

References _alias, _name, alias(), file(), hdf_id(), is_open(), and name().

Referenced by create_alias(), and open().

◆ suffix()

const std::string & sheaf::record_set::suffix ( ) const
virtual

The name suffix for this data set.

Reimplemented in sheaf::attributes_record_set, sheaf::member_record_set, and sheaf::dof_tuple_record_set.

Definition at line 284 of file record_set.cc.

References data_set_name().

Referenced by data_set_alias(), data_set_name(), name_space_prefix(), and poset_name().

◆ type_map() [1/2]

◆ type_map() [2/2]

const sheaf::poset_data_type_map & sheaf::record_set::type_map ( ) const

Data type map for records in this record set (const version)

Definition at line 442 of file record_set.cc.

References _scaffold, open(), and sheaf::poset_scaffold::type_map().

◆ write_attribute()

void sheaf::record_set::write_attribute ( const void *  xatt_values,
size_type  xatt_ct,
const data_converter xatt_conv,
const std::string &  xatt_name 
)
protected

Writes the attribute with name xatt_name into the file.

Precondition
  • xatt_values != 0
  • xatt_ct > 0
  • xatt_conv != 0
  • !xatt_name.empty()
Issue:
does deleting and rewriting the attribute everytime we write to the dataset imply a resource leak in the file?

Definition at line 1135 of file record_set.cc.

References _hdf_id, sheaf::data_converter::external_type(), sheaf::data_converter::internal_type(), and NOT_AN_HDF_ID.

Referenced by read_attribute().

◆ write_dataset_attributes()

void sheaf::record_set::write_dataset_attributes ( )
protectedvirtual

Writes the dataset attribute objects into the file. A stub in this class, intended to be redefined in descendants.

Precondition
Postcondition
  • -unexecutable( "all attributes created, written, and closed" )

Reimplemented in sheaf::attributes_record_set.

Definition at line 1022 of file record_set.cc.

References is_open(), and read_attribute().

Referenced by close(), and read_dataset_attributes().

Member Data Documentation

◆ _alias

◆ _ext_data_type_hdf_id

hid_t sheaf::record_set::_ext_data_type_hdf_id
protected

The HDF external data type id for this record set.

Definition at line 415 of file record_set.h.

Referenced by close(), sheaf::attributes_record_set::create_int_data_type(), ext_data_type_hdf_id(), open(), record_set(), and sheaf::member_record_set::write_selection().

◆ _ext_dataspace_dims

◆ _ext_dataspace_hdf_id

◆ _ext_dataspace_rank

int sheaf::record_set::_ext_dataspace_rank
protected

◆ _file

sheaf_file& sheaf::record_set::_file
protected

The file this record_set belongs to.

Definition at line 385 of file record_set.h.

Referenced by file(), and open().

◆ _hdf_id

◆ _int_data_type_hdf_id

◆ _int_dataspace_hdf_id

◆ _name

◆ _record_buffer_ct

◆ _record_buffer_ub

◆ _scaffold

poset_scaffold& sheaf::record_set::_scaffold
protected

The poset scaffold associated with this.

Definition at line 400 of file record_set.h.

Referenced by scaffold(), and type_map().

◆ NOT_AN_HDF_ID

const hid_t sheaf::record_set::NOT_AN_HDF_ID = -1
staticprotected

Value indicating an invalid HDf object id. /.

Issue:
does HDF have a defined value for this? /

Definition at line 431 of file record_set.h.

Referenced by close(), create_dataset(), int_data_type_hdf_id(), record_set(), and write_attribute().


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