diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-12-07 17:47:45 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-12-07 17:47:45 (GMT) |
commit | afcb04a47b87159f733d7ca1661beb76d96cb8da (patch) | |
tree | 95a517647b3a5720c21acf9512f9c5aae430b357 | |
parent | 81db27b9f434cb953c41aa5c5c51fa3a6b9de480 (diff) | |
parent | d18280078ef816f72daf35661f9be76654d0a277 (diff) | |
download | hdf5-afcb04a47b87159f733d7ca1661beb76d96cb8da.zip hdf5-afcb04a47b87159f733d7ca1661beb76d96cb8da.tar.gz hdf5-afcb04a47b87159f733d7ca1661beb76d96cb8da.tar.bz2 |
Merge pull request #818 in HDFFV/hdf5 from ~BMRIBLER/hdf5_1_8_bmr:hdf5_1_8 to hdf5_1_8
* commit 'd18280078ef816f72daf35661f9be76654d0a277':
Miscellaneous cleanup Description: Moved items around to remove Doxygen warnings. Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
-rw-r--r-- | c++/src/H5DataType.cpp | 102 | ||||
-rw-r--r-- | c++/src/H5DataType.h | 3 |
2 files changed, 53 insertions, 52 deletions
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index ffa2a21..7b385d2 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -243,35 +243,6 @@ void DataType::copy(const DataSet& dset) } //-------------------------------------------------------------------------- -// Function: DataType::p_decode -// Purpose Returns an id of a type by decoding the binary object -/// description of this datatype. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Sept 2017 -//-------------------------------------------------------------------------- -hid_t DataType::p_decode() const -{ - // Make sure that the buffer can be decoded - if (encoded_buf == NULL) - { - throw DataTypeIException("DataType::p_decode", "No encoded buffer"); - } - - // Call C function to decode the binary object description - hid_t encoded_dtype_id = H5Tdecode(encoded_buf); - - // If H5Tdecode fails, raise exception - if (encoded_dtype_id < 0) - { - throw DataTypeIException("DataType::p_decode", "H5Tdecode failed"); - } - else - { - return(encoded_dtype_id); - } -} - -//-------------------------------------------------------------------------- // Function: DataType::decode ///\brief Returns a DataType instance by decoding the binary object /// description of this datatype. @@ -391,28 +362,6 @@ bool DataType::operator==(const DataType& compared_type) const } //-------------------------------------------------------------------------- -// Function: DataType::p_commit (private) -//\brief Commits a transient datatype to a file, creating a new -// named datatype -//\param loc_id - IN: The id of either a file, group, dataset, named -// datatype, or attribute. -//\param name - IN: Name of the datatype -//\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -// Modification: -// Copied from DataType::commit and made into private function -// to be commonly used by several overloads of DataType::commit. -// BMR - Jan, 2007 -//-------------------------------------------------------------------------- -void DataType::p_commit(hid_t loc_id, const char* name) -{ - // Call C routine to commit the transient datatype - herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(ret_value < 0) - throw DataTypeIException(inMemFunc("p_commit"), "H5Tcommit2 failed"); -} - -//-------------------------------------------------------------------------- // Function: DataType::commit ///\brief Commits a transient datatype to a file, creating a new /// named datatype @@ -857,6 +806,57 @@ hid_t DataType::getId() const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- +// Function: DataType::p_commit (private) +//\brief Commits a transient datatype to a file, creating a new +// named datatype +//\param loc_id - IN: The id of either a file, group, dataset, named +// datatype, or attribute. +//\param name - IN: Name of the datatype +//\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 +// Modification: +// Copied from DataType::commit and made into private function +// to be commonly used by several overloads of DataType::commit. +// BMR - Jan, 2007 +//-------------------------------------------------------------------------- +void DataType::p_commit(hid_t loc_id, const char* name) +{ + // Call C routine to commit the transient datatype + herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if(ret_value < 0) + throw DataTypeIException(inMemFunc("p_commit"), "H5Tcommit2 failed"); +} + +//-------------------------------------------------------------------------- +// Function: DataType::p_decode +// Purpose Returns an id of a type by decoding the binary object +/// description of this datatype. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Sept 2017 +//-------------------------------------------------------------------------- +hid_t DataType::p_decode() const +{ + // Make sure that the buffer can be decoded + if (encoded_buf == NULL) + { + throw DataTypeIException("DataType::p_decode", "No encoded buffer"); + } + + // Call C function to decode the binary object description + hid_t encoded_dtype_id = H5Tdecode(encoded_buf); + + // If H5Tdecode fails, raise exception + if (encoded_dtype_id < 0) + { + throw DataTypeIException("DataType::p_decode", "H5Tdecode failed"); + } + else + { + return(encoded_dtype_id); + } +} + +//-------------------------------------------------------------------------- // Function: DataType::p_opentype (private) ///\brief Opens an HDF5 datatype given its name ///\param loc - IN: Location of the type diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 5e10c20..29cc990 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -150,7 +150,6 @@ class H5_DLLCPP DataType : public H5Object { // Opens a datatype and returns the id. hid_t p_opentype(const H5Location& loc, const char* dtype_name) const; - #endif // DOXYGEN_SHOULD_SKIP_THIS private: @@ -162,7 +161,9 @@ class H5_DLLCPP DataType : public H5Object { // Friend function to set DataType id. For library use only. friend void f_DataType_setId(DataType* dtype, hid_t new_id); +#ifndef DOXYGEN_SHOULD_SKIP_THIS void p_commit(hid_t loc_id, const char* name); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; // end of DataType } // namespace H5 |