diff options
Diffstat (limited to 'c++/src/H5CommonFG.cpp')
-rw-r--r-- | c++/src/H5CommonFG.cpp | 133 |
1 files changed, 2 insertions, 131 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 0651c29..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 @@ -1138,6 +1007,7 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const } #endif /* H5_NO_DEPRECATED_SYMBOLS */ +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: CommonFG default constructor ///\brief Default constructor. @@ -1151,6 +1021,7 @@ CommonFG::CommonFG() {} // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CommonFG::~CommonFG() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE } |