diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2004-08-20 04:35:18 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2004-08-20 04:35:18 (GMT) |
commit | 824ba5e2fde476934df42284271c358b14e1a6af (patch) | |
tree | caf62890a1527b0fdc2a77a550c7e11f30c48584 /c++/src/H5Attribute.cpp | |
parent | b142a4144862b22c37c27aa11e2ee519a08ede2f (diff) | |
download | hdf5-824ba5e2fde476934df42284271c358b14e1a6af.zip hdf5-824ba5e2fde476934df42284271c358b14e1a6af.tar.gz hdf5-824ba5e2fde476934df42284271c358b14e1a6af.tar.bz2 |
[svn-r9129] Purpose: Updating documentation
Description:
Updated various function headers for the RM as reviewing progresses.
Rearranged functions in header files for more sensible look of the RM.
Platforms tested:
SunOS 5.7 (arabica)
Linux 2.4 (eirene)
Diffstat (limited to 'c++/src/H5Attribute.cpp')
-rw-r--r-- | c++/src/H5Attribute.cpp | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 570dbe7..7b26947 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -163,7 +163,7 @@ DataSpace Attribute::getSpace() const } //-------------------------------------------------------------------------- -// Function: Attribute::p_getType (private) +// Function: Attribute::p_get_type (private) // Purpose Gets the datatype of this attribute. // Return Id of the datatype // Exception H5::AttributeIException @@ -171,7 +171,7 @@ DataSpace Attribute::getSpace() const // This private function is used in AbstractDs. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -hid_t Attribute::p_getType() const +hid_t Attribute::p_get_type() const { hid_t type_id = H5Aget_type( id ); if( type_id > 0 ) @@ -203,7 +203,7 @@ ssize_t Attribute::getName( size_t buf_size, string& attr_name ) const { throw AttributeIException("Attribute::getName", "H5Aget_name failed"); } - // otherwise, convert the C string attribute name and return + // otherwise, convert the C attribute name and return attr_name = name_C; delete name_C; return( name_size ); @@ -241,14 +241,41 @@ string Attribute::getName() const // Try with 256 characters for the name first, if the name's length // returned is more than that then, read the name again with the // appropriate space allocation + char* name_C = new char[256]; // temporary C-string for C API + ssize_t name_size = H5Aget_name(id, 255, name_C); + string attr_name; - ssize_t name_size = getName(255, attr_name); if (name_size >= 256) name_size = getName(name_size, attr_name); + + // otherwise, convert the C attribute name and return + else + attr_name = name_C; + + delete name_C; return( attr_name ); - // let caller catch exception if any } +#ifndef DOXYGEN_SHOULD_SKIP_THIS +//-------------------------------------------------------------------------- +// Function: Attribute::p_close (private) +// Purpose: Closes this attribute. +// Exception H5::AttributeIException +// Description +// This function will be obsolete because its functionality +// is recently handled by the C library layer. - May, 2004 +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void Attribute::p_close() const +{ + herr_t ret_value = H5Aclose( id ); + if( ret_value < 0 ) + { + throw AttributeIException(0, "H5Aclose failed"); + } +} +#endif // DOXYGEN_SHOULD_SKIP_THIS + //-------------------------------------------------------------------------- // Function: Attribute destructor ///\brief Properly terminates access to this attribute. @@ -257,12 +284,12 @@ string Attribute::getName() const Attribute::~Attribute() { // The attribute id will be closed properly - try { - decRefCount(); - } - catch (Exception close_error) { - cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl; - } + try { + decRefCount(); + } + catch (Exception close_error) { + cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl; + } } #ifndef H5_NO_NAMESPACE |