|
icedb
version 0.5.1
Snow particle scattering database API
|
This is a virtual base class for objects that can have attributes. This includes tables, groups and HDF5 files. More...
#include <Attribute.hpp>

Public Member Functions | |
| ~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... | |
Static Public Member Functions | |
| 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... | |
Protected Member Functions | |
| CanHaveAttributes () | |
| virtual void | _setAttributeParent (std::shared_ptr< H5::H5Object > obj)=0 |
| virtual std::shared_ptr< H5::H5Object > | _getAttributeParent () const =0 |
Private Member Functions | |
| bool | valid () const |
This is a virtual base class for objects that can have attributes. This includes tables, groups and HDF5 files.
Definition at line 61 of file Attribute.hpp.
|
protected |
Definition at line 11 of file Attributes.cpp.
| icedb::Attributes::CanHaveAttributes::~CanHaveAttributes | ( | ) |
Definition at line 12 of file Attributes.cpp.
|
protectedpure virtual |
Implemented in icedb::Attributes::CanHaveAttributes_impl.
|
protectedpure virtual |
Implemented in icedb::Attributes::CanHaveAttributes_impl.
| void icedb::Attributes::CanHaveAttributes::deleteAttribute | ( | const std::string & | attributeName | ) |
Delete an attribute, by name, that is attached to this object.
| if | the attribute does not exist. |
Definition at line 55 of file Attributes.cpp.
References icedb::Attributes::CanHaveAttributes_impl::_getAttributeParent(), and valid().
Referenced by writeAttributeData().


| bool icedb::Attributes::CanHaveAttributes::doesAttributeExist | ( | const std::string & | attributeName | ) | const |
Does the object have an attribute with the given name?
Definition at line 61 of file Attributes.cpp.
References icedb::Attributes::CanHaveAttributes_impl::_getAttributeParent(), and valid().
Referenced by icedb::Shapes::Shape::isShape(), icedb::Shapes::Shape::isValid(), readAttributeData(), and writeAttributeData().


|
static |
Does an object (parent) have an attribute with the given name?
Definition at line 78 of file Attributes.cpp.
| std::set< std::string > icedb::Attributes::CanHaveAttributes::getAttributeNames | ( | ) | const |
List all attributes attached to this object.
Definition at line 95 of file Attributes.cpp.
References icedb::Attributes::CanHaveAttributes_impl::_getAttributeParent(), and valid().

| std::type_index icedb::Attributes::CanHaveAttributes::getAttributeTypeId | ( | const std::string & | attributeName | ) | const |
Returns the type of an attribute.
| if | the attribute does not exist. |
Definition at line 50 of file Attributes.cpp.
References icedb::Attributes::CanHaveAttributes_impl::_getAttributeParent(), and icedb::Attributes::CanHaveAttributes_impl::parent.
Referenced by icedb::Shapes::Shape::isShape(), and icedb::Shapes::Shape::isValid().


|
static |
Returns the type of an attribute.
| if | the attribute does not exist. |
Definition at line 34 of file Attributes.cpp.
|
inline |
Is the type of the attribute "Type"?
| if | the attribute does not exist. |
Definition at line 81 of file Attribute.hpp.
References icedb::Attributes::Attribute< DataType >::data.
|
inlinestatic |
Convenience function to read an attribute's data and return an Attribute object.
| if | the base object does not exist |
| if | the attribute has a mismatched DataType |
| if | the attribute does not exist |
| obj | is the containing object |
| DataType | is the type of the data |
| attributeName | is the name of the attribute |
Definition at line 138 of file Attribute.hpp.
References icedb::Attributes::Attribute< DataType >::data, and icedb::Attributes::Attribute< DataType >::dimensionality.
|
inline |
Convenience function to read an attribute's data and return an Attribute object.
| if | the attribute has a mismatched DataType |
| if | the attribute does not exist |
| DataType | is the type of the data |
| attributeName | is the name of the attribute |
Definition at line 150 of file Attribute.hpp.
References icedb::Attributes::Attribute< DataType >::data, and icedb::Attributes::Attribute< DataType >::dimensionality.
|
static |
Function to read the data from an attribute.
| if | the attribute does not exist |
| if | the parent is invalid |
| DataType | is the type of the data to be read |
| if | there is a type mismatch between the actual data's type and the type expected in the function call. |
| parent | is the container of the attribute |
| attributeName | is the name of the attribute |
| dimensions | are the returned dimensions of the attribute. |
| data | are the returned attribute data. The mapping of dimensions and data follows the regular C convention (in contrast to the Fortran one). |
Definition at line 150 of file Attributes.cpp.
References doesAttributeExist().

| void icedb::Attributes::CanHaveAttributes::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.
| if | the attribute does not exist |
| DataType | is the type of the data to be read |
| if | there is a type mismatch between the actual data's type and the type expected in the function call. |
| attributeName | is the name of the attribute |
| dimensions | are the returned dimensions of the attribute. |
| data | are the returned attribute data. The mapping of dimensions and data follows the regular C convention (in contrast to the Fortran one). |
Definition at line 164 of file Attributes.cpp.
References icedb::Attributes::CanHaveAttributes_impl::_getAttributeParent(), doesAttributeExist(), icedb::Attributes::CanHaveAttributes_impl::parent, and valid().

|
private |
Definition at line 19 of file Attributes.cpp.
References icedb::Attributes::CanHaveAttributes_impl::_getAttributeParent().
Referenced by deleteAttribute(), doesAttributeExist(), getAttributeNames(), readAttributeData(), and writeAttributeData().


|
inline |
Convenience function to write an Attribute to an object.
| if | the attribute is somehow invalid (usually from not giving it a proper name). |
| DataType | is the type of the data |
| is | an Attribute<DataType> object |
Definition at line 160 of file Attribute.hpp.
References icedb::Attributes::Attribute< DataType >::data, icedb::Attributes::Attribute< DataType >::dimensionality, and icedb::Attributes::Attribute< DataType >::name.
|
inline |
Convenience function to write a small Attribute to an object, using initializer lists.
Example: grpTest1->writeAttribute<uint64_t>("TestInt5", {1}, {65536});
| name | is the attribute's name |
| dims | are the dimensions |
| data | are the data |
| if | the name is invalid |
Definition at line 175 of file Attribute.hpp.
| void icedb::Attributes::CanHaveAttributes::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.
| if | the base object is read-only |
| DataType | is the type of the data to be read |
| attributeName | is the name of the attribute |
| dimensions | are the dimensions of the attribute. |
| data | are the attribute data. The mapping of dimensions and data follows the regular C convention (in contrast to the Fortran one). |
Definition at line 219 of file Attributes.cpp.
References icedb::Attributes::CanHaveAttributes_impl::_getAttributeParent(), deleteAttribute(), doesAttributeExist(), icedb::Attributes::CanHaveAttributes_impl::parent, and valid().

1.8.13