summaryrefslogtreecommitdiffstats
path: root/c++/src/H5CompType.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-10-05 21:24:25 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-10-05 21:24:25 (GMT)
commitb1819710bc3ef8b03e453d177b9a8b308100d96d (patch)
treead4c92a27cbac7642ca9f6892112195cc58c7a76 /c++/src/H5CompType.cpp
parentdd75930ef16b36644111f6e584b11388b63b43c9 (diff)
downloadhdf5-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/H5CompType.cpp')
-rw-r--r--c++/src/H5CompType.cpp60
1 files changed, 59 insertions, 1 deletions
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 16a7d2f..6d879bd 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -84,6 +84,65 @@ CompType::CompType(const DataSet& dataset) : DataType()
}
//--------------------------------------------------------------------------
+// Function: CompType overloaded constructor
+///\brief Creates an CompType instance by opening an HDF5 compound
+/// given its name, provided as a C character string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Compound type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+// Description
+// In 1.8.20, this constructor was introduced and may replace the
+// existing function CommonFG::openCompType(const char*) to
+// improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+CompType::CompType(const H5Location& loc, const char *type_name) : DataType()
+{
+ id = p_opentype(loc, type_name);
+}
+
+//--------------------------------------------------------------------------
+// Function: CompType overloaded constructor
+///\brief Creates an CompType instance by opening an HDF5 compound
+/// datatype given its name, provided as an \c H5std_string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Compound type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+// Description
+// In 1.8.20, this constructor was introduced and may replace the
+// existing function CommonFG::openCompType(const H5std_string&) to
+// improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+CompType::CompType(const H5Location& loc, const H5std_string& type_name) : DataType()
+{
+ id = p_opentype(loc, type_name.c_str());
+}
+
+//--------------------------------------------------------------------------
+// Function: CompType::decode
+///\brief Returns a CompType object via DataType* by decoding the
+/// binary object description of this datatype.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+DataType* CompType::decode() const
+{
+ hid_t encoded_cmptype_id = H5I_INVALID_HID;
+ try {
+ encoded_cmptype_id = p_decode();
+ }
+ catch (DataTypeIException &err) {
+ throw;
+ }
+ CompType *encoded_cmptype = new CompType;
+ encoded_cmptype->p_setId(encoded_cmptype_id);
+ return(encoded_cmptype);
+}
+
+//--------------------------------------------------------------------------
// Function: CompType::getNmembers
///\brief Returns the number of members in this compound datatype.
///\return Number of members
@@ -155,7 +214,6 @@ int CompType::getMemberIndex(const H5std_string& name) const
/// respect to the beginning of the compound data type datum.
///\param member_num - IN: Zero-based index of the member
///\return Byte offset
-///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
// Description
/// Members are stored in no particular order with numbers 0