CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cms::h5::Group Class Reference

#include <h5_Group.h>

Public Member Functions

std::shared_ptr< DataSetderefDataSet (hobj_ref_t iRef) const
 
std::shared_ptr< GroupderefGroup (hobj_ref_t iRef) const
 
std::shared_ptr< AttributefindAttribute (std::string const &iName) const
 
std::shared_ptr< DataSetfindDataSet (std::string const &iName) const
 
std::shared_ptr< GroupfindGroup (std::string const &iName) const
 
std::size_t getNumObjs () const
 
std::string getObjnameByIdx (std::size_t) const
 
 Group (hid_t, std::string const &)
 
 Group (hid_t, const void *iRef)
 
 Group (const Group &)=delete
 
 Group (Group &&)=delete
 
std::string name () const
 
Groupoperator= (const Group &)=delete
 
Groupoperator= (Group &&)=delete
 
 ~Group ()
 

Private Attributes

hid_t id_
 

Detailed Description

Definition at line 36 of file h5_Group.h.

Constructor & Destructor Documentation

◆ Group() [1/4]

Group< TOutput >::Group ( hid_t  iParentID,
std::string const &  iName 
)
explicit

Definition at line 34 of file h5_Group.cc.

References Exception, and id_.

34  : id_(H5Gopen2(iParentID, iName.c_str(), H5P_DEFAULT)) {
35  if (id_ < 0) {
36  throw cms::Exception("UnknownH5Group") << "unable to find group " << iName;
37  }
38  }

◆ Group() [2/4]

Group< TOutput >::Group ( hid_t  iParentID,
const void *  iRef 
)
explicit

Definition at line 40 of file h5_Group.cc.

References Exception, and id_.

40  : id_(H5Rdereference2(iParentID, H5P_DEFAULT, H5R_OBJECT, iRef)) {
41  if (id_ < 0) {
42  throw cms::Exception("BadH5GroupRef") << "unable to dereference Group from parent " << iParentID;
43  }
44  }

◆ ~Group()

Group< TOutput >::~Group ( )

Definition at line 51 of file h5_Group.cc.

References id_.

51 { H5Gclose(id_); }

◆ Group() [3/4]

cms::h5::Group::Group ( const Group )
delete

◆ Group() [4/4]

cms::h5::Group::Group ( Group &&  )
delete

Member Function Documentation

◆ derefDataSet()

std::shared_ptr< DataSet > Group< TOutput >::derefDataSet ( hobj_ref_t  iRef) const

Definition at line 85 of file h5_Group.cc.

References id_.

85 { return std::make_shared<DataSet>(id_, &iRef); }

◆ derefGroup()

std::shared_ptr< Group > Group< TOutput >::derefGroup ( hobj_ref_t  iRef) const

Definition at line 83 of file h5_Group.cc.

References id_.

83 { return std::make_shared<Group>(id_, &iRef); }

◆ findAttribute()

std::shared_ptr< Attribute > Group< TOutput >::findAttribute ( std::string const &  iName) const

Definition at line 79 of file h5_Group.cc.

References id_.

79  {
80  return std::make_shared<Attribute>(id_, iName);
81  }

◆ findDataSet()

std::shared_ptr< DataSet > Group< TOutput >::findDataSet ( std::string const &  iName) const

Definition at line 75 of file h5_Group.cc.

References id_.

75  {
76  return std::make_shared<DataSet>(id_, iName);
77  }

◆ findGroup()

std::shared_ptr< Group > Group< TOutput >::findGroup ( std::string const &  iName) const

Definition at line 72 of file h5_Group.cc.

References id_.

72  {
73  return std::make_shared<Group>(id_, iName);
74  }

◆ getNumObjs()

std::size_t Group< TOutput >::getNumObjs ( ) const

Definition at line 97 of file h5_Group.cc.

References cms::cuda::assert(), and id_.

97  {
98  H5G_info_t ginfo; // Group information
99 
100  herr_t ret_value = H5Gget_info(id_, &ginfo);
101  assert(ret_value >= 0);
102  return (ginfo.nlinks);
103  }
assert(be >=bs)

◆ getObjnameByIdx()

std::string Group< TOutput >::getObjnameByIdx ( std::size_t  idx) const

Definition at line 105 of file h5_Group.cc.

References cms::cuda::assert(), edmScanValgrind::buffer, id_, heavyIonCSV_trainingSettings::idx, AlCaHLTBitMon_QueryRunRegistry::string, and funct::void.

105  {
106  // call H5Lget_name_by_idx with name as NULL to get its length
107  ssize_t name_len = H5Lget_name_by_idx(id_, ".", H5_INDEX_NAME, H5_ITER_INC, idx, nullptr, 0, H5P_DEFAULT);
108  assert(name_len >= 0);
109 
110  // The actual size is the cast value + 1 for the terminal ASCII NUL
111  // (unfortunate in/out type sign mismatch)
112  size_t actual_name_len = static_cast<size_t>(name_len) + 1;
113 
114  std::unique_ptr<char[]> buffer(new char[actual_name_len]);
115 
116  (void)H5Lget_name_by_idx(id_, ".", H5_INDEX_NAME, H5_ITER_INC, idx, buffer.get(), actual_name_len, H5P_DEFAULT);
117 
118  return std::string(buffer.get());
119  }
assert(be >=bs)
TEMPL(T2) struct Divides void
Definition: Factorize.h:24

◆ name()

std::string Group< TOutput >::name ( ) const

Definition at line 87 of file h5_Group.cc.

References edmScanValgrind::buffer, id_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by config.CFG::__str__(), validation.Sample::digest(), and VIDSelectorBase.VIDSelectorBase::initialize().

87  {
88  ssize_t name_size = H5Iget_name(id_, nullptr, 0);
89 
90  size_t actual_name_size = static_cast<size_t>(name_size) + 1;
91  std::unique_ptr<char[]> buffer(new char[actual_name_size]);
92  H5Iget_name(id_, buffer.get(), actual_name_size);
93 
94  return std::string(buffer.get());
95  }

◆ operator=() [1/2]

Group& cms::h5::Group::operator= ( const Group )
delete

◆ operator=() [2/2]

Group& cms::h5::Group::operator= ( Group &&  )
delete

Member Data Documentation

◆ id_

hid_t cms::h5::Group::id_
private