icedb
version 0.5.1
Snow particle scattering database API
|
#include <Table.hpp>
Public Types | |
typedef std::vector< size_t > | Dimensions_Type |
The dimensions of a Table are expressed as a vector of unsigned integers. More... | |
typedef std::unique_ptr< Table > | Table_Type |
The preferred method of access of a Table is through std::unique_ptr. More... | |
Public Member Functions | |
virtual | ~Table () |
size_t | getNumDimensions () const |
Returns the number of dimensions of a table. More... | |
Dimensions_Type | getDimensions () const |
Returns a vector containing the dimensions of the table. More... | |
void | attachDimensionScale (size_t DimensionNumber, gsl::not_null< const Table *> scale) |
void | detachDimensionScale (size_t DimensionNumber, gsl::not_null< const Table *> scale) |
Detaches a dimension scale from this table. More... | |
bool | isDimensionScale () const |
Is this Table used as a dimension scale? More... | |
void | setDimensionScale (const std::string &dimensionScaleName) |
Designate this table as a dimension scale. More... | |
void | setDimensionScaleAxisLabel (size_t DimensionNumber, const std::string &label) |
Set the axis label for the dimension designated by DimensionNumber. More... | |
std::string | getDimensionScaleAxisLabel (size_t DimensionNumber) const |
Get the axis label for the dimension designated by DimensionNumber. More... | |
std::string | getDimensionScaleName () const |
Get the name of this table's defined dimension scale. More... | |
template<class Type > | |
bool | isTableOfType () const |
Check if this table has the matching Type. More... | |
std::type_index | getTableTypeId () const |
Get the type of the table (i.e. int64_t, float, etc.) More... | |
template<class DataType > | |
void | readAll (std::vector< size_t > &dims, std::vector< DataType > &data) const |
Read all of the data in the associated table. More... | |
template<class DataType > | |
void | writeAll (const gsl::span< const DataType > &outData) const |
Write the passed data to the table. Writes whole table. More... | |
template<class DataType > | |
void | writeAll (const gsl::span< DataType > &outData) const |
Write the passed data to the table. Writes whole table. More... | |
template<class DataType > | |
void | writeAll (const std::vector< DataType > &outData) const |
Write the passed data to the table. Writes whole table. Convenience converter function. More... | |
![]() | |
~CanHaveAttributes () | |
bool | doesAttributeExist (const std::string &attributeName) const |
Does the object have an attribute with the given name? More... | |
std::type_index | getAttributeTypeId (const std::string &attributeName) const |
Returns the type of an attribute. More... | |
template<class Type > | |
bool | isAttributeOfType (const std::string &attributeName) const |
Is the type of the attribute "Type"? More... | |
std::set< std::string > | getAttributeNames () const |
List all attributes attached to this object. More... | |
void | deleteAttribute (const std::string &attributeName) |
Delete an attribute, by name, that is attached to this object. More... | |
template<class DataType > | |
void | readAttributeData (const std::string &attributeName, std::vector< size_t > &dimensions, std::vector< DataType > &data) const |
Function to read the data from an attribute using the provided input vectors. More... | |
template<class DataType > | |
void | writeAttributeData (const std::string &attributeName, const std::vector< size_t > &dimensionas, const std::vector< DataType > &data) |
Function to write an attribute to an object, with the provided raw data. More... | |
template<class DataType > | |
Attribute< DataType > | readAttribute (const std::string &attributeName) const |
Convenience function to read an attribute's data and return an Attribute object. More... | |
template<class DataType > | |
void | writeAttribute (const Attribute< DataType > &attribute) |
Convenience function to write an Attribute to an object. More... | |
template<class DataType > | |
void | writeAttribute (const std::string &name, std::initializer_list< size_t > dims, std::initializer_list< DataType > data) |
Convenience function to write a small Attribute to an object, using initializer lists. More... | |
Public Attributes | |
const std::string | name |
The name of the Table. More... | |
Protected Member Functions | |
virtual void | _setTableSelf (std::shared_ptr< H5::DataSet > obj)=0 |
Associates the icedb table with the fundamental HDF5 DataSet. Only used internally. More... | |
virtual std::shared_ptr< H5::DataSet > | _getTableSelf () const =0 |
Gets the fundamental HDF5 DataSet associated with the table. Only used internally. More... | |
bool | valid () const |
Checks that Table is well-formed during runtime. Only used internally. More... | |
Table (const std::string &name="") | |
Default constructor, used by CanHaveTables. More... | |
![]() | |
CanHaveAttributes () | |
virtual void | _setAttributeParent (std::shared_ptr< H5::H5Object > obj)=0 |
virtual std::shared_ptr< H5::H5Object > | _getAttributeParent () const =0 |
Private Member Functions | |
template<class DataType > | |
void | writeAllInner (const gsl::span< const DataType > &outData) const |
Friends | |
class | CanHaveTables |
Additional Inherited Members | |
![]() | |
static bool | doesAttributeExist (gsl::not_null< const H5::H5Object *> parent, const std::string &attributeName) |
Does an object (parent) have an attribute with the given name? More... | |
static std::type_index | getAttributeTypeId (gsl::not_null< const H5::H5Object *> parent, const std::string &attributeName) |
Returns the type of an attribute. More... | |
template<class DataType > | |
static void | readAttributeData (gsl::not_null< const H5::H5Object *> parent, const std::string &attributeName, std::vector< size_t > &dimensions, std::vector< DataType > &data) |
Function to read the data from an attribute. More... | |
template<class DataType > | |
static Attribute< DataType > | readAttribute (gsl::not_null< const H5::H5Object *> obj, const std::string &attributeName) |
Convenience function to read an attribute's data and return an Attribute object. More... | |
This defines a table.
typedef std::vector<size_t> icedb::Tables::Table::Dimensions_Type |
typedef std::unique_ptr<Table> icedb::Tables::Table::Table_Type |
|
protected |
|
virtual |
Definition at line 10 of file Tables.cpp.
|
protectedpure virtual |
Gets the fundamental HDF5 DataSet associated with the table. Only used internally.
Implemented in icedb::Tables::Table_impl.
Referenced by attachDimensionScale(), detachDimensionScale(), getDimensions(), getDimensionScaleAxisLabel(), getDimensionScaleName(), getNumDimensions(), getTableTypeId(), isDimensionScale(), readAll(), setDimensionScale(), setDimensionScaleAxisLabel(), valid(), and writeAllInner().
|
protectedpure virtual |
Associates the icedb table with the fundamental HDF5 DataSet. Only used internally.
Implemented in icedb::Tables::Table_impl.
void icedb::Tables::Table::attachDimensionScale | ( | size_t | DimensionNumber, |
gsl::not_null< const Table *> | scale | ||
) |
Attaches a dimension scale to a table.
Definition at line 29 of file Tables.cpp.
References _getTableSelf(), getNumDimensions(), and valid().
void icedb::Tables::Table::detachDimensionScale | ( | size_t | DimensionNumber, |
gsl::not_null< const Table *> | scale | ||
) |
Detaches a dimension scale from this table.
Definition at line 39 of file Tables.cpp.
References _getTableSelf(), getNumDimensions(), and valid().
Table::Dimensions_Type icedb::Tables::Table::getDimensions | ( | ) | const |
Returns a vector containing the dimensions of the table.
Definition at line 21 of file Tables.cpp.
References _getTableSelf(), icedb::fs::hdf5::readDatasetDimensions(), and valid().
Referenced by writeAllInner().
std::string icedb::Tables::Table::getDimensionScaleAxisLabel | ( | size_t | DimensionNumber | ) | const |
Get the axis label for the dimension designated by DimensionNumber.
Definition at line 122 of file Tables.cpp.
References _getTableSelf(), getNumDimensions(), and valid().
std::string icedb::Tables::Table::getDimensionScaleName | ( | ) | const |
Get the name of this table's defined dimension scale.
Definition at line 136 of file Tables.cpp.
References _getTableSelf(), and valid().
size_t icedb::Tables::Table::getNumDimensions | ( | ) | const |
Returns the number of dimensions of a table.
Definition at line 15 of file Tables.cpp.
References _getTableSelf(), icedb::fs::hdf5::readDatasetNumDimensions(), and valid().
Referenced by attachDimensionScale(), detachDimensionScale(), getDimensionScaleAxisLabel(), and setDimensionScaleAxisLabel().
std::type_index icedb::Tables::Table::getTableTypeId | ( | ) | const |
Get the type of the table (i.e. int64_t, float, etc.)
Definition at line 149 of file Tables.cpp.
References _getTableSelf(), and valid().
bool icedb::Tables::Table::isDimensionScale | ( | ) | const |
Is this Table used as a dimension scale?
Definition at line 97 of file Tables.cpp.
References _getTableSelf(), and valid().
Referenced by setDimensionScale().
|
inline |
Check if this table has the matching Type.
Definition at line 68 of file Table.hpp.
void icedb::Tables::Table::readAll | ( | std::vector< size_t > & | dims, |
std::vector< DataType > & | data | ||
) | const |
Read all of the data in the associated table.
DataType | is the type of data. |
if | the DataType is mismatched (see isTableOfType and getTableTypeId). |
dims | is an output parameter representing the size of each of the table's dimensions |
data | is an output parameter that stores the table's data. |
Definition at line 180 of file Tables.cpp.
References _getTableSelf(), icedb::fs::hdf5::readDatasetDimensions(), and valid().
void icedb::Tables::Table::setDimensionScale | ( | const std::string & | dimensionScaleName | ) |
Designate this table as a dimension scale.
Definition at line 106 of file Tables.cpp.
References _getTableSelf(), isDimensionScale(), and valid().
Referenced by icedb::Shapes::Shape::createShape().
void icedb::Tables::Table::setDimensionScaleAxisLabel | ( | size_t | DimensionNumber, |
const std::string & | label | ||
) |
Set the axis label for the dimension designated by DimensionNumber.
Definition at line 114 of file Tables.cpp.
References _getTableSelf(), getNumDimensions(), and valid().
|
protected |
Checks that Table is well-formed during runtime. Only used internally.
Definition at line 13 of file Tables.cpp.
References _getTableSelf().
Referenced by icedb::Tables::CanHaveTables::_createTable(), attachDimensionScale(), detachDimensionScale(), getDimensions(), getDimensionScaleAxisLabel(), getDimensionScaleName(), getNumDimensions(), icedb::Tables::CanHaveTables::getTableNames(), getTableTypeId(), isDimensionScale(), icedb::Tables::CanHaveTables::openTable(), readAll(), setDimensionScale(), setDimensionScaleAxisLabel(), icedb::Tables::CanHaveTables::unlinkTable(), and writeAllInner().
|
inline |
Write the passed data to the table. Writes whole table.
DataType | is the type of the data. |
if | the DataType does not match the fundamental type of the table. |
outData | is the data to be written to the table. |
if | outData's size does not match the table's size. |
Definition at line 100 of file Table.hpp.
Referenced by icedb::Shapes::Shape::createShape().
|
inline |
Write the passed data to the table. Writes whole table.
DataType | is the type of the data. |
if | the DataType does not match the fundamental type of the table. |
outData | is the data to be written to the table. |
if | outData's size does not match the table's size. |
|
inline |
Write the passed data to the table. Writes whole table. Convenience converter function.
DataType | is the type of the data. |
if | the DataType does not match the fundamental type of the table. |
outData | is the data to be written to the table. |
if | outData's size does not match the table's size. |
|
private |
Definition at line 221 of file Tables.cpp.
References _getTableSelf(), getDimensions(), and valid().
|
friend |
const std::string icedb::Tables::Table::name |