diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-10-05 21:24:25 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-10-05 21:24:25 (GMT) |
commit | b1819710bc3ef8b03e453d177b9a8b308100d96d (patch) | |
tree | ad4c92a27cbac7642ca9f6892112195cc58c7a76 /c++/src/H5Object.cpp | |
parent | dd75930ef16b36644111f6e584b11388b63b43c9 (diff) | |
download | hdf5-b1819710bc3ef8b03e453d177b9a8b308100d96d.zip hdf5-b1819710bc3ef8b03e453d177b9a8b308100d96d.tar.gz hdf5-b1819710bc3ef8b03e453d177b9a8b308100d96d.tar.bz2 |
Adding new C++ wrappers
Description:
- Added wrappers for H5Tencode to class DataType and H5Tdecode to
classes DataType and its subclasses.
// Creates a binary object description of this datatype.
void DataType::encode()
// Returns the decoded type from the binary object description.
virtual DataType* DataType::decode() const;
virtual DataType* ArrayType::decode() const;
virtual DataType* CompType::decode() const;
virtual DataType* DataType::decode() const;
virtual DataType* EnumType::decode() const;
virtual DataType* FloatType::decode() const;
virtual DataType* IntType::decode() const;
virtual DataType* StrType::decode() const;
virtual DataType* VarLenType::decode() const;
- Replaced existing functions CommonFG::openXxxType with individual
data type constructors, XxxType, to improve usability.
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (platypus)
Darwin (osx1010test)
Diffstat (limited to 'c++/src/H5Object.cpp')
-rw-r--r-- | c++/src/H5Object.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index b35206e..8fe8e56 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -29,6 +29,23 @@ namespace H5 { #ifndef DOXYGEN_SHOULD_SKIP_THIS +// userAttrOpWrpr simply interfaces between the user's function and the +// C library function H5Aiterate2; used to resolve the different prototype +// problem. May be moved to Iterator later. + /* extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, + const H5A_info_t *ainfo, void *op_data) +{ + H5std_string s_attr_name = H5std_string(attr_name); +#ifdef NO_STATIC_CAST + UserData4Aiterate* myData = (UserData4Aiterate *) op_data; +#else + UserData4Aiterate* myData = static_cast <UserData4Aiterate *> (op_data); +#endif + myData->op(*myData->location, s_attr_name, myData->opData); + return 0; +} + */ + //-------------------------------------------------------------------------- // Function: H5Object default constructor (protected) // Programmer Binh-Minh Ribler - 2000 @@ -272,6 +289,25 @@ void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newna // end of Notes for H5A wrappers //-------------------------------------------------------------------------- +// Function: H5Object::getNumAttrs +///\brief Returns the number of attributes attached to this HDF5 object. +///\return Number of attributes +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 +// Modification +// - Moved from H5Location in 1.8.20. -BMR Oct, 2017 +//-------------------------------------------------------------------------- +int H5Object::getNumAttrs() const +{ + H5O_info_t oinfo; /* Object info */ + + if(H5Oget_info(getId(), &oinfo) < 0) + throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); + else + return(static_cast<int>(oinfo.num_attrs)); +} + +//-------------------------------------------------------------------------- // Function: getObjName ///\brief Given an id, returns the type of the object. ///\return The name of the object |