本文整理汇总了C++中h5::DataSet::getNumAttrs方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSet::getNumAttrs方法的具体用法?C++ DataSet::getNumAttrs怎么用?C++ DataSet::getNumAttrs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类h5::DataSet
的用法示例。
在下文中一共展示了DataSet::getNumAttrs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Gets the number of variable attributes.
* @return The number of variable attributes in the opened file.
*/
int HDF5FileReader::getNumberOfVariableAttributes()
{
int numVAttributes;
//get the first variable and see how many attributes. They should all be the same.
H5::DataSet dataset = this->variableGroup->openDataSet(this->variableGroup->getObjnameByIdx(0));
numVAttributes = dataset.getNumAttrs();
return numVAttributes;
}
示例2:
void ossim_hdf5::printObject( H5::H5File* file,
const std::string& objectName,
const std::string& prefix,
std::ostream& out )
{
#if 0
std::cout << "printObject entered..."
<< "\nobjectName: " << objectName
<< "\nprefix: " << prefix
<< std::endl;
#endif
H5::DataSet dataset = file->openDataSet( objectName );
// Get the class of the datatype that is used by the dataset.
H5T_class_t type_class = dataset.getTypeClass();
out << prefix << ".class_type: "
<< ossim_hdf5::getDatatypeClassType( type_class ) << std::endl;
const ossim_uint32 ATTRS_COUNT = dataset.getNumAttrs();
for ( ossim_uint32 aIdx = 0; aIdx < ATTRS_COUNT; ++aIdx )
{
H5::Attribute attr = dataset.openAttribute( aIdx );
ossim_hdf5::printAttribute( attr, prefix, out );
attr.close();
}
// Extents:
std::vector<ossim_uint32> extents;
ossim_hdf5::getExtents( &dataset, extents );
for ( ossim_uint32 i = 0; i < extents.size(); ++i )
{
ossimString os;
std::string exStr = ".extent";
exStr += os.toString(i).string();
out << prefix << exStr << ": " << extents[i] << std::endl;
}
// ossimScalarType scalar = getScalarType( type_class, dataset.getId() );
ossimScalarType scalar = ossim_hdf5::getScalarType( dataset.getId() );
if ( scalar != OSSIM_SCALAR_UNKNOWN)
{
out << prefix << "." << ossimKeywordNames::SCALAR_TYPE_KW << ": "
<< ossimScalarTypeLut::instance()->getEntryString( scalar ) << std::endl;
if ( ossim::scalarSizeInBytes( scalar ) > 1 )
{
ossimByteOrder byteOrder = ossim_hdf5::getByteOrder( &dataset );
std::string byteOrderString = "little_endian";
if ( byteOrder == OSSIM_BIG_ENDIAN )
{
byteOrderString = "big_endian";
}
out << prefix << "." <<ossimKeywordNames::BYTE_ORDER_KW << ": "
<< byteOrderString << std::endl;
}
}
#if 0
// Attributes:
int numberOfAttrs = dataset.getNumAttrs();
cout << "numberOfAttrs: " << numberOfAttrs << endl;
for ( ossim_int32 attrIdx = 0; attrIdx < numberOfAttrs; ++attrIdx )
{
H5::Attribute attribute = dataset.openAttribute( attrIdx );
cout << "attribute.from class: " << attribute.fromClass() << endl;
}
#endif
dataset.close();
} // End: printObject