本文整理汇总了C++中H5Location::openAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ H5Location::openAttribute方法的具体用法?C++ H5Location::openAttribute怎么用?C++ H5Location::openAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类H5Location
的用法示例。
在下文中一共展示了H5Location::openAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAttributeAsArray
//Create array of type TYPE, versus setAttributeArray that creates a scalar of type array
int ArfFileBase::setAttributeAsArray(DataTypes type, void* data, int size, String path, String name)
{
H5Location* loc;
Group gloc;
DataSet dloc;
Attribute attr;
DataType H5type;
DataType origType;
if (!opened) return -1;
try
{
try
{
gloc = file->openGroup(path.toUTF8());
loc = &gloc;
}
catch (FileIException error) //If there is no group with that path, try a dataset
{
dloc = file->openDataSet(path.toUTF8());
loc = &dloc;
}
H5type = getH5Type(type);
origType = getNativeType(type);
hsize_t dims = size;
if (loc->attrExists(name.toUTF8()))
{
attr = loc->openAttribute(name.toUTF8());
}
else
{
DataSpace attr_dataspace(1, &dims); //create a 1d simple dataspace of len SIZE
attr = loc->createAttribute(name.toUTF8(),H5type,attr_dataspace);
}
attr.write(origType,data);
}
catch (GroupIException error)
{
PROCESS_ERROR;
}
catch (AttributeIException error)
{
PROCESS_ERROR;
}
catch (DataSetIException error)
{
PROCESS_ERROR;
}
catch (FileIException error)
{
PROCESS_ERROR;
}
return 0;
}