void HDFAtom<std::string>::Create(H5::H5Location &object, std::string atomName) { H5::StrType strType(0, H5T_VARIABLE); hsize_t defaultDims[] = {1}; H5::DataSpace defaultDataSpace(1, defaultDims); attribute = object.createAttribute(atomName.c_str(), strType, H5::DataSpace(H5S_SCALAR)); initialized= true; }
void Create(H5::H5Location &object, const std::string & name, const std::vector<std::string> &vect) { hsize_t length = vect.size(); H5::StrType strType(0,H5T_VARIABLE); H5::ArrayType arrayDataType(strType, 1, &length); attribute = object.createAttribute(name.c_str(), strType, H5::DataSpace(1, &length)); attribute.write(strType, &((vect)[0])); }
void Create(H5::H5Location &object, const std::string & name, std::vector<int> &vect) { hsize_t length = vect.size(); H5::ArrayType arrayDataType(H5::PredType::NATIVE_INT, 1, &length); attribute = object.createAttribute(name.c_str(), H5::PredType::NATIVE_INT, H5::DataSpace(1, &length)); attribute.write(H5::PredType::NATIVE_INT, &((vect)[0])); }
void Create(H5::H5Location &object, const std::string & name, const std::string & value) { H5::StrType strType(0, value.size()); attribute = object.createAttribute(name.c_str(), strType, H5::DataSpace(0,NULL)); isInitialized = true; attribute.write(strType, value.c_str()); }
int Initialize(H5::H5Location &object, const std::string & attributeName) { attribute = object.openAttribute(attributeName.c_str()); isInitialized = true; return 1; }
int Initialize(H5::H5Location &object, const std::string & attributeName, bool createIfMissing=false) { attribute = object.openAttribute(attributeName.c_str()); initialized = true; return 1; }