diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2013-09-19 03:08:28 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2013-09-19 03:08:28 (GMT) |
commit | 4182c81addaaac3e4234369dc5a0089fb93756d9 (patch) | |
tree | 538e81a234aa25869e68bc84099b3eaac2dfad63 /c++/src/H5CommonFG.cpp | |
parent | d95f5e293a2c550f24522a98873a08ad7942ee06 (diff) | |
download | hdf5-4182c81addaaac3e4234369dc5a0089fb93756d9.zip hdf5-4182c81addaaac3e4234369dc5a0089fb93756d9.tar.gz hdf5-4182c81addaaac3e4234369dc5a0089fb93756d9.tar.bz2 |
[svn-r24163] Purpose: More on HDFFV-7520 and HDFFV-533
Description:
- Improved the changes in revisions r22836 and r23438, mainly on the
wrappers of reference, dereference, get region, and set/getcomment.
- Added more tests.
Platforms tested:
Linux/32 2.6 (jam)
SunOS 5.11 (emu)
Linux/ppc64 (ostrich)
Diffstat (limited to 'c++/src/H5CommonFG.cpp')
-rw-r--r-- | c++/src/H5CommonFG.cpp | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index d6fe5dc..3bf4b4f 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -460,137 +460,6 @@ H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const } //-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief Sets or resets the comment for an object specified by its name. -///\param name - IN: Name of the object -///\param comment - IN: New comment -///\exception H5::FileIException or H5::GroupIException -///\par Description -/// If \a comment is an empty string or a null pointer, the comment -/// message is removed from the object. -/// Comments should be relatively short, null-terminated, ASCII -/// strings. They can be attached to any object that has an -/// object header, e.g., data sets, groups, named data types, -/// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::setComment( const char* name, const char* comment ) const -{ - herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); - if( ret_value < 0 ) - throwException("setComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void CommonFG::setComment( const H5std_string& name, const H5std_string& comment ) const -{ - setComment( name.c_str(), comment.c_str() ); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief Removes the comment from an object specified by its name. -///\param name - IN: Name of the object -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - May 2005 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const char* name) const -{ - herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); - if( ret_value < 0 ) - throwException("removeComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const H5std_string& name) const -{ - removeComment (name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief Retrieves comment for the specified object and its comment's -/// length. -///\param name - IN: Name of the object -///\param bufsize - IN: Length of the comment to retrieve -///\return Comment string -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const -{ - // bufsize is default to 256 - // temporary variable - hid_t loc_id = getLocId(); // temporary variable - - // temporary C-string for the object's comment; bufsize already including - // null character - char* comment_C = new char[bufsize]; - ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); - - // if the actual length of the comment is longer than bufsize and bufsize - // was the default value, i.e., not given by the user, then call - // H5Oget_comment_by_name again with the correct value. - // If the call to H5Oget_comment_by_name returned an error, skip this block - // and throw an exception below. - if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) - { - size_t new_size = ret_value; - delete []comment_C; - comment_C = new char[new_size]; // new_size including null terminator - ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); - } - - // if H5Oget_comment_by_name returns SUCCEED, return the string comment, - // otherwise, throw an exception - if( ret_value < 0 ) { - delete []comment_C; - throwException("getComment", "H5Oget_comment_by_name failed"); - } - - H5std_string comment = H5std_string(comment_C); - delete []comment_C; - return (comment); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const H5std_string& name, size_t bufsize ) const -{ - return( getComment( name.c_str(), bufsize )); -} - -//-------------------------------------------------------------------------- // Function: CommonFG::mount ///\brief Mounts the file \a child onto this group. ///\param name - IN: Name of the group |