30 explicit Type(hid_t iID) : id_(iID) {
assert(id_ >= 0); }
31 ~
Type() noexcept { H5Tclose(id_); }
33 void insertMember(
const char* iName,
size_t offset, hid_t member_id) { H5Tinsert(id_, iName,
offset, member_id); }
38 explicit DataSpace(hid_t iID) : id_(iID) {
assert(id_ >= 0); }
39 ~DataSpace() noexcept { H5Sclose(id_); }
50 throw cms::Exception(
"UnknownH5DataSet") <<
"unable to find dataset " << iName;
54 DataSet::DataSet(hid_t iParentID,
const void* iRef) : id_(H5Rdereference2(iParentID, H5P_DEFAULT, H5R_OBJECT, iRef)) {
56 throw cms::Exception(
"BadH5DataSetRef") <<
"unable to derenfence dataset from parent " << iParentID;
87 return std::make_shared<Attribute>(
id_, iName);
91 DataSpace space_id{H5Dget_space(
id_)};
93 hssize_t num_elements = H5Sget_simple_extent_npoints(space_id.id_);
104 auto pl = H5Dget_create_plist(
id_);
105 auto ret = H5Pget_layout(pl);
111 Type type_id{H5Dget_type(
id_)};
112 auto class_type = H5Tget_class(type_id.id_);
113 if (class_type != H5T_REFERENCE) {
114 throw cms::Exception(
"BadDataSetType") <<
"asked to read dataset as a ref, but it is a " << class_type;
117 std::vector<hobj_ref_t> refs;
120 auto ret_value = H5Dread(
id_, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, refs.data());
128 Type type_id{H5Dget_type(
id_)};
129 auto class_type = H5Tget_class(type_id.id_);
130 if (class_type != H5T_INTEGER) {
131 throw cms::Exception(
"BadDataSetType") <<
"asked to read dataset as a byte, but it is a " << class_type;
134 std::vector<char> bytes;
135 bytes.resize(
size());
137 auto ret_value = H5Dread(
id_, H5T_STD_I8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, bytes.data());
150 const Type type_id{H5Dget_type(
id_)};
151 if (not H5Tequal(sv_type_id.id_, type_id.id_)) {
153 <<
"asked to read dataset as a IOVSyncValue, but it is a " << type_id.id_;
157 std::vector<cond::hdf5::IOVSyncValue> syncValues;
158 syncValues.resize(
size());
160 auto ret_value = H5Dread(
id_, sv_type_id.id_, H5S_ALL, H5S_ALL, H5P_DEFAULT, syncValues.data());
162 throw cms::Exception(
"BadH5Read") <<
"unable to read IOVSyncValue dataset " <<
id_;
std::vector< cond::hdf5::IOVSyncValue > readSyncValues() const
ret
prodAgent to be discontinued
std::size_t memorySize() const
uint64_t fileOffset() const
std::shared_ptr< Attribute > findAttribute(std::string const &iName) const
DataSet(hid_t iParentID, std::string const &iName)
unsigned long long uint64_t
std::vector< hobj_ref_t > readRefs() const
std::vector< char > readBytes() const
std::size_t storageSize() const