File indexing completed on 2024-04-06 12:01:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "h5_File.h"
0017 #include "h5_Group.h"
0018 #include "h5_DataSet.h"
0019 #include "h5_Attribute.h"
0020 #include "FWCore/Utilities/interface/Exception.h"
0021
0022 namespace cms::h5 {
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 File::File(std::string const& iName, CtrOption) : id_(H5Fopen(iName.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT)) {
0035 if (id_ < 0) {
0036 throw cms::Exception("FailedHDF5FileOpen") << "failed to open HDF5 file " << iName;
0037 }
0038 }
0039
0040
0041
0042
0043
0044
0045 File::~File() { H5Fclose(id_); }
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066 std::shared_ptr<Group> File::findGroup(std::string const& iName) const { return std::make_shared<Group>(id_, iName); }
0067 std::shared_ptr<DataSet> File::findDataSet(std::string const& iName) const {
0068 return std::make_shared<DataSet>(id_, iName);
0069 }
0070
0071 std::shared_ptr<Attribute> File::findAttribute(std::string const& iName) const {
0072 return std::make_shared<Attribute>(id_, iName);
0073 }
0074
0075 std::shared_ptr<Group> File::derefGroup(hobj_ref_t iRef) const { return std::make_shared<Group>(id_, &iRef); }
0076
0077 std::shared_ptr<DataSet> File::derefDataSet(hobj_ref_t iRef) const { return std::make_shared<DataSet>(id_, &iRef); }
0078
0079
0080
0081
0082 }