libSplash
|
#include <AttributeInfo.hpp>
Public Member Functions | |
AttributeInfo (hid_t attr) | |
AttributeInfo (H5AttributeId &attr) | |
AttributeInfo (const AttributeInfo &other) | |
AttributeInfo & | operator= (const AttributeInfo &other) |
size_t | getMemSize () throw (DCException) |
const CollectionType & | getType () throw (DCException) |
Dimensions | getDims () throw (DCException) |
uint32_t | getNDims () throw (DCException) |
bool | isScalar () throw (DCException) |
bool | isVarSize () throw (DCException) |
std::string | readName () |
void | read (const CollectionType &colType, void *buf) throw (DCException) |
bool | readNoThrow (const CollectionType &colType, void *buf) |
void | read (void *buf, size_t bufSize) throw (DCException) |
void | close () |
Friends | |
void | swap (AttributeInfo &lhs, AttributeInfo &rhs) |
Class holding information about an attribute.
Usage example:
Definition at line 50 of file AttributeInfo.hpp.
|
explicit |
Construct from an attribute id, takes over ownership!
Definition at line 36 of file AttributeInfo.cpp.
void splash::AttributeInfo::close | ( | ) |
Closes the attribute invalidating all future calls to this object Note: If there are multiple instances relating to the same HDF5-Attribute all of them must be closed or destroyed
Definition at line 196 of file AttributeInfo.cpp.
Dimensions splash::AttributeInfo::getDims | ( | ) | ||
throw | ( | DCException | ||
) |
Return the size in each dimension
Definition at line 141 of file AttributeInfo.cpp.
size_t splash::AttributeInfo::getMemSize | ( | ) | ||
throw | ( | DCException | ||
) |
Return the size of the required memory in bytes when querying the value
Definition at line 115 of file AttributeInfo.cpp.
uint32_t splash::AttributeInfo::getNDims | ( | ) | ||
throw | ( | DCException | ||
) |
Return the number of dimensions
Definition at line 159 of file AttributeInfo.cpp.
const CollectionType & splash::AttributeInfo::getType | ( | ) | ||
throw | ( | DCException | ||
) |
Return the CollectionType. Might be ColTypeUnknown
Definition at line 131 of file AttributeInfo.cpp.
|
inline |
Return whether this is a scalar value
Definition at line 72 of file AttributeInfo.hpp.
bool splash::AttributeInfo::isVarSize | ( | ) | ||
throw | ( | DCException | ||
) |
Return true, if the attribute has a variable size in which case reading it will only return its pointer
Definition at line 166 of file AttributeInfo.cpp.
void splash::AttributeInfo::read | ( | const CollectionType & | colType, |
void * | buf | ||
) | |||
throw | ( | DCException | |
) |
Read the data of this attribute into the buffer of the given type. Data conversion may occur, if required. See the HDF5 manual for details (6.10. Data Transfer: Datatype Conversion and Selection) Throws an exception if the attribute could not be read or converted
colType | Type of the buffer |
buf | Pointer to buffer. Size must be equal to getMemSize |
Definition at line 172 of file AttributeInfo.cpp.
void splash::AttributeInfo::read | ( | void * | buf, |
size_t | bufSize | ||
) | |||
throw | ( | DCException | |
) |
Read the data of this attribute into the buffer of the given size. No data conversion occurs, so the type as found in the file is used. Throws an exception if the attribute could not be read or the buffer is to small. Warning: Might be unsafe if you are not the author of the HDF5 file or the data type differs from the expected one. Check the meta-data and/or pass the CollectionType to make sure you get what you expect.
buf | Pointer to buffer |
bufSize | Size of the buffer |
Definition at line 183 of file AttributeInfo.cpp.
std::string splash::AttributeInfo::readName | ( | ) |
Read the name of the attribute. Returns an empty string on error
Definition at line 101 of file AttributeInfo.cpp.
bool splash::AttributeInfo::readNoThrow | ( | const CollectionType & | colType, |
void * | buf | ||
) |
Read the data of this attribute into the buffer of the given type. Data conversion may occur, if required. See the HDF5 manual for details (6.10. Data Transfer: Datatype Conversion and Selection) Does not throw exception, so it can be used for trying different types
colType | Type of the buffer |
buf | Pointer to buffer. Size must be equal to getMemSize |
Definition at line 178 of file AttributeInfo.cpp.