summaryrefslogtreecommitdiffstats
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
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)
-rw-r--r--c++/src/H5ArrayType.cpp59
-rw-r--r--c++/src/H5ArrayType.h8
-rw-r--r--c++/src/H5Classes.h2
-rw-r--r--c++/src/H5CompType.cpp60
-rw-r--r--c++/src/H5CompType.h8
-rw-r--r--c++/src/H5DataType.cpp169
-rw-r--r--c++/src/H5DataType.h31
-rw-r--r--c++/src/H5EnumType.cpp59
-rw-r--r--c++/src/H5EnumType.h8
-rw-r--r--c++/src/H5FloatType.cpp59
-rw-r--r--c++/src/H5FloatType.h8
-rw-r--r--c++/src/H5IntType.cpp59
-rw-r--r--c++/src/H5IntType.h8
-rw-r--r--c++/src/H5Location.cpp5
-rw-r--r--c++/src/H5Location.h77
-rw-r--r--c++/src/H5Object.cpp36
-rw-r--r--c++/src/H5Object.h6
-rw-r--r--c++/src/H5StrType.cpp59
-rw-r--r--c++/src/H5StrType.h8
-rw-r--r--c++/src/H5VarLenType.cpp59
-rw-r--r--c++/src/H5VarLenType.h11
21 files changed, 754 insertions, 45 deletions
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index 6d2ca83..6be1a1f 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -70,6 +70,44 @@ ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims)
}
//--------------------------------------------------------------------------
+// Function: ArrayType overloaded constructor
+///\brief Creates an ArrayType instance by opening an HDF5 array datatype
+/// given its name, provided as a C character string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Array 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::openArrayType(const char*) to
+// improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+ArrayType::ArrayType(const H5Location& loc, const char *type_name) : DataType()
+{
+ id = p_opentype(loc, type_name);
+}
+
+//--------------------------------------------------------------------------
+// Function: ArrayType overloaded constructor
+///\brief Creates an ArrayType instance by opening an HDF5 array datatype
+/// given its name, provided as an \c H5std_string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Array 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::openArrayType(const H5std_string&) to
+// improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+ArrayType::ArrayType(const H5Location& loc, const H5std_string& type_name) : DataType()
+{
+ id = p_opentype(loc, type_name.c_str());
+}
+
+//--------------------------------------------------------------------------
// Function: ArrayType::operator=
///\brief Assignment operator
///\param rhs - IN: Reference to the existing array datatype
@@ -99,6 +137,27 @@ ArrayType& ArrayType::operator=(const ArrayType& rhs)
}
//--------------------------------------------------------------------------
+// Function: ArrayType::decode
+///\brief Returns an ArrayType object via DataType* by decoding the
+/// binary object description of this type.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+DataType* ArrayType::decode() const
+{
+ hid_t encoded_arrtype_id = H5I_INVALID_HID;
+ try {
+ encoded_arrtype_id = p_decode();
+ }
+ catch (DataTypeIException &err) {
+ throw;
+ }
+ ArrayType *encoded_arrtype = new ArrayType;
+ encoded_arrtype->p_setId(encoded_arrtype_id);
+ return(encoded_arrtype);
+}
+
+//--------------------------------------------------------------------------
// Function: ArrayType::getArrayNDims
///\brief Returns the number of dimensions for an array datatype.
///\return Number of dimensions
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index 6de11f2..952aae1 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -28,9 +28,17 @@ class H5_DLLCPP ArrayType : public DataType {
// specified base type.
ArrayType(const DataType& base_type, int ndims, const hsize_t* dims);
+ // Constructors that open an array datatype, given a location.
+ ArrayType(const H5Location& loc, const char* name);
+ ArrayType(const H5Location& loc, const H5std_string& name);
+
// Assignment operator
ArrayType& operator=(const ArrayType& rhs);
+ // Returns an ArrayType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType* decode() const;
+
// Returns the number of dimensions of this array datatype.
int getArrayNDims() const;
//int getArrayNDims(); // removed 1.8.18 and 1.10.1
diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h
index 23bff29..6baa3d0 100644
--- a/c++/src/H5Classes.h
+++ b/c++/src/H5Classes.h
@@ -30,10 +30,10 @@ namespace H5 {
class DataSpace;
class AtomType;
class PredType;
- class EnumType;
class IntType;
class FloatType;
class StrType;
+ class EnumType;
class CompType;
class AbstractDs;
class DataSet;
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
diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h
index f6d77f4..3aabf55 100644
--- a/c++/src/H5CompType.h
+++ b/c++/src/H5CompType.h
@@ -43,6 +43,14 @@ class H5_DLLCPP CompType : public DataType {
// Copy constructor - makes a copy of original object
CompType(const CompType& original);
+ // Constructors that open a compound datatype, given a location.
+ CompType(const H5Location& loc, const char* name);
+ CompType(const H5Location& loc, const H5std_string& name);
+
+ // Returns a CompType object via DataType* by decoding the binary
+ // object description of this type.
+ virtual DataType* decode() const;
+
// Returns the type class of the specified member of this compound
// datatype. It provides to the user a way of knowing what type
// to create another datatype of the same class
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 6162bec..ffa2a21 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -18,6 +18,7 @@
#endif
#include <string>
+#include "H5private.h" // for HDcalloc
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -45,7 +46,7 @@ namespace H5 {
///\brief Default constructor: Creates a stub datatype
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType::DataType() : H5Object(), id(H5I_INVALID_HID) {}
+DataType::DataType() : H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0) {}
//--------------------------------------------------------------------------
// Function: DataType overloaded constructor
@@ -60,7 +61,7 @@ DataType::DataType() : H5Object(), id(H5I_INVALID_HID) {}
// Removed second argument, "predefined", after changing to the
// new ref counting mechanism that relies on C's ref counting.
//--------------------------------------------------------------------------
-DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id)
+DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id), encoded_buf(NULL), buf_size(0)
{
incRefCount(); // increment number of references to this id
}
@@ -73,7 +74,7 @@ DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object()
+DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), encoded_buf(NULL), buf_size(0)
{
// Call C routine to create the new datatype
id = H5Tcreate(type_class, size);
@@ -96,7 +97,7 @@ DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object()
// Jul, 2008
// Added for application convenience.
//--------------------------------------------------------------------------
-DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type) : H5Object(), id(H5I_INVALID_HID)
+DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type) : H5Object(), encoded_buf(NULL), buf_size(0)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, "constructor - by dereference");
}
@@ -114,7 +115,7 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type)
// Jul, 2008
// Added for application convenience.
//--------------------------------------------------------------------------
-DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object()
+DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0)
{
id = H5Location::p_dereference(attr.getId(), ref, ref_type, "constructor - by dereference");
}
@@ -124,7 +125,7 @@ DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type)
///\brief Copy constructor: makes a copy of the original DataType object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType::DataType(const DataType& original) : H5Object(), id(original.id)
+DataType::DataType(const DataType& original) : H5Object(), id(original.id), encoded_buf(NULL), buf_size(0)
{
incRefCount(); // increment number of references to this id
}
@@ -142,7 +143,7 @@ DataType::DataType(const DataType& original) : H5Object(), id(original.id)
// unnecessarily and will produce undefined behavior.
// -BMR, Apr 2015
//--------------------------------------------------------------------------
-DataType::DataType(const PredType& pred_type) : H5Object()
+DataType::DataType(const PredType& pred_type) : H5Object(), encoded_buf(NULL), buf_size(0)
{
// call C routine to copy the datatype
id = H5Tcopy(pred_type.getId());
@@ -151,6 +152,44 @@ DataType::DataType(const PredType& pred_type) : H5Object()
}
//--------------------------------------------------------------------------
+// Function: DataType overloaded constructor
+///\brief Creates a DataType instance by opening an HDF5 datatype given
+/// its name as a char*.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Datatype 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::openDataType(const char*) to
+// improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+DataType::DataType(const H5Location& loc, const char *type_name) : H5Object(), encoded_buf(NULL), buf_size(0)
+{
+ id = p_opentype(loc, type_name);
+}
+
+//--------------------------------------------------------------------------
+// Function: DataType overloaded constructor
+///\brief Creates a DataType instance by opening an HDF5 datatype given
+/// its name as an \c H5std_string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Datatype 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::openDataType(const H5std_string&)
+// to improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+DataType::DataType(const H5Location& loc, const H5std_string& type_name) : H5Object(), encoded_buf(NULL), buf_size(0)
+{
+ id = p_opentype(loc, type_name.c_str());
+}
+
+//--------------------------------------------------------------------------
// Function: DataType::copy
///\brief Copies an existing datatype to this datatype object
///\param like_type - IN: Datatype to be copied
@@ -204,6 +243,102 @@ 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.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+DataType* DataType::decode() const
+{
+ hid_t encoded_dtype_id = H5I_INVALID_HID;
+ try {
+ encoded_dtype_id = p_decode();
+ }
+ catch (DataTypeIException &err) {
+ throw;
+ }
+ DataType *encoded_dtype = new DataType;
+ encoded_dtype->p_setId(encoded_dtype_id);
+ return(encoded_dtype);
+}
+
+//--------------------------------------------------------------------------
+// Function: DataType::encode
+///\brief Creates a binary object description of this datatype.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+void DataType::encode()
+{
+ // Call H5Tencode passing in null to determine the size of the buffer
+ herr_t ret_value = H5Tencode(id, NULL, &buf_size);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("DataType::encode", "Failed to get buf_size");
+ }
+
+ // Allocate buffer and call C function again to encode
+ if (buf_size > 0)
+ {
+ encoded_buf = (unsigned char *)HDcalloc((size_t)1, buf_size);
+ ret_value = H5Tencode(id, encoded_buf, &buf_size);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("DataType::encode", "H5Tencode failed");
+ }
+ }
+ else
+ {
+ throw DataTypeIException("DataType::encode", "Failed to allocate buffer for encoding");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: DataType::hasBinaryDesc
+///\brief Determines whether this datatype has a binary object
+/// description.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+bool DataType::hasBinaryDesc() const
+{
+ if (encoded_buf != NULL)
+ return true;
+ else
+ return false;
+}
+
+//--------------------------------------------------------------------------
// Function: DataType::operator=
///\brief Assignment operator
///\param rhs - IN: Reference to the existing datatype
@@ -722,6 +857,26 @@ hid_t DataType::getId() const
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
+// Function: DataType::p_opentype (private)
+///\brief Opens an HDF5 datatype given its name
+///\param loc - IN: Location of the type
+///\param type_name - IN: Datatype name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+// Description
+// This function was introduced in 1.8.20 to be used by the
+// new XxxType constructors that open a datatype. -BMR, Sept 2017
+//--------------------------------------------------------------------------
+hid_t DataType::p_opentype(const H5Location& loc, const char *type_name) const
+{
+ // Call C function to open the named datatype at this location
+ hid_t ret_value = H5Topen2(loc.getId(), type_name, H5P_DEFAULT);
+ if (ret_value < 0)
+ throw DataTypeIException(inMemFunc("constructor"), "H5Topen2 failed");
+ return(ret_value);
+}
+
+//--------------------------------------------------------------------------
// Function: DataType::p_setId
///\brief Sets the identifier of this object to a new value.
///
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 8970a8d..5e10c20 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -36,6 +36,10 @@ class H5_DLLCPP DataType : public H5Object {
// Creates a copy of a predefined type
DataType(const PredType& pred_type);
+ // Opens a generic named datatype at a given location.
+ DataType(const H5Location& loc, const char* name);
+ DataType(const H5Location& loc, const H5std_string& name);
+
// Creates a datatype by way of dereference.
DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
@@ -49,6 +53,13 @@ class H5_DLLCPP DataType : public H5Object {
// Copies the datatype of dset to this datatype object.
void copy(const DataSet& dset);
+ // Returns a DataType instance by decoding the binary object
+ // description of this datatype.
+ virtual DataType* decode() const;
+
+ // Creates a binary object description of this datatype.
+ void encode();
+
// Returns the datatype class identifier.
H5T_class_t getClass() const;
@@ -56,10 +67,6 @@ class H5_DLLCPP DataType : public H5Object {
// a named datatype which can be accessed from the location.
void commit(const H5Location& loc, const char* name);
void commit(const H5Location& loc, const H5std_string& name);
- // These two overloaded functions are kept for backward compatibility
- // only; they missed the const - removed from 1.8.18 and 1.10.1
- //void commit(H5Location& loc, const char* name);
- //void commit(H5Location& loc, const H5std_string& name);
// Determines whether this datatype is a named datatype or
// a transient datatype.
@@ -121,6 +128,9 @@ class H5_DLLCPP DataType : public H5Object {
// Default constructor
DataType();
+ // Determines whether this datatype has a binary object description.
+ bool hasBinaryDesc() const;
+
// Gets the datatype id.
virtual hid_t getId() const;
@@ -131,11 +141,24 @@ class H5_DLLCPP DataType : public H5Object {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
hid_t id; // HDF5 datatype id
+ // Returns an id of a type by decoding the binary object
+ // description of this datatype.
+ hid_t p_decode() const;
+
// Sets the datatype id.
virtual void p_setId(const hid_t new_id);
+
+ // 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:
+ // Buffer for binary object description of this datatype, allocated
+ // in DataType::encode and used in DataType::decode
+ unsigned char *encoded_buf;
+ size_t buf_size;
+
// Friend function to set DataType id. For library use only.
friend void f_DataType_setId(DataType* dtype, hid_t new_id);
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index 0c26728..4b06ca5 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -106,6 +106,65 @@ EnumType::EnumType(const IntType& data_type) : DataType()
}
//--------------------------------------------------------------------------
+// Function: EnumType overloaded constructor
+///\brief Creates an EnumType instance by opening an HDF5 enum datatype
+/// given its name, provided as a C character string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Enum datatype 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::openEnumType(const char*) to
+// improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+EnumType::EnumType(const H5Location& loc, const char *type_name) : DataType()
+{
+ id = p_opentype(loc, type_name);
+}
+
+//--------------------------------------------------------------------------
+// Function: EnumType overloaded constructor
+///\brief Creates an EnumType instance by opening an HDF5 enum datatype
+/// given its name, provided as an \c H5std_string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Enum datatype 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::openEnumType(const H5std_string&)
+// to improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+EnumType::EnumType(const H5Location& loc, const H5std_string& type_name) : DataType()
+{
+ id = p_opentype(loc, type_name.c_str());
+}
+
+//--------------------------------------------------------------------------
+// Function: EnumType::decode
+///\brief Returns an EnumType object via DataType* by decoding the
+/// binary object description of this type.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+DataType* EnumType::decode() const
+{
+ hid_t encoded_enumtype_id = H5I_INVALID_HID;
+ try {
+ encoded_enumtype_id = p_decode();
+ }
+ catch (DataTypeIException &err) {
+ throw;
+ }
+ EnumType *encoded_enumtype = new EnumType;
+ encoded_enumtype->p_setId(encoded_enumtype_id);
+ return(encoded_enumtype);
+}
+
+//--------------------------------------------------------------------------
// Function: EnumType::insert
///\brief Inserts a new member to this enumeration datatype.
///\param name - IN: Name of the new member
diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h
index 5cbe262..745c09b 100644
--- a/c++/src/H5EnumType.h
+++ b/c++/src/H5EnumType.h
@@ -34,6 +34,14 @@ class H5_DLLCPP EnumType : public DataType {
// Creates a new enum datatype based on an integer datatype
EnumType(const IntType& data_type); // H5Tenum_create
+ // Constructors that open an enum datatype, given a location.
+ EnumType(const H5Location& loc, const char* name);
+ EnumType(const H5Location& loc, const H5std_string& name);
+
+ // Returns an EnumType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType* decode() const;
+
// Returns the number of members in this enumeration datatype.
int getNmembers () const;
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index 0abf52a..05284f9 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -87,6 +87,65 @@ FloatType::FloatType(const DataSet& dataset) : AtomType()
}
//--------------------------------------------------------------------------
+// Function: FloatType overloaded constructor
+///\brief Creates an FloatType instance by opening an HDF5 float datatype
+/// given its name, provided as a C character string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Float 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::openFloatType(const char*)
+// to improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+FloatType::FloatType(const H5Location& loc, const char *type_name) : AtomType()
+{
+ id = p_opentype(loc, type_name);
+}
+
+//--------------------------------------------------------------------------
+// Function: FloatType overloaded constructor
+///\brief Creates an FloatType instance by opening an HDF5 float datatype
+/// given its name, provided as an \c H5std_string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Float 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::openFloatType(const H5std_string&)
+// to improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+FloatType::FloatType(const H5Location& loc, const H5std_string& type_name) : AtomType()
+{
+ id = p_opentype(loc, type_name.c_str());
+}
+
+//--------------------------------------------------------------------------
+// Function: FloatType::decode
+///\brief Returns an FloatType object via DataType* by decoding the
+/// binary object description of this type.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+DataType* FloatType::decode() const
+{
+ hid_t encoded_flttype_id = H5I_INVALID_HID;
+ try {
+ encoded_flttype_id = p_decode();
+ }
+ catch (DataTypeIException &err) {
+ throw;
+ }
+ FloatType *encoded_flttype = new FloatType;
+ encoded_flttype->p_setId(encoded_flttype_id);
+ return(encoded_flttype);
+}
+
+//--------------------------------------------------------------------------
// Function: FloatType::getFields
///\brief Retrieves floating point datatype bit field information.
///\param spos - OUT: Retrieved floating-point sign bit
diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h
index d0256e1..d26df5c 100644
--- a/c++/src/H5FloatType.h
+++ b/c++/src/H5FloatType.h
@@ -30,6 +30,14 @@ class H5_DLLCPP FloatType : public AtomType {
// Gets the floating-point datatype of the specified dataset.
FloatType(const DataSet& dataset);
+ // Constructors that open an HDF5 float datatype, given a location.
+ FloatType(const H5Location& loc, const char* name);
+ FloatType(const H5Location& loc, const H5std_string& name);
+
+ // Returns an FloatType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType* decode() const;
+
// Retrieves the exponent bias of a floating-point type.
size_t getEbias() const;
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 7d48314..6af2dc2 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -86,6 +86,65 @@ IntType::IntType(const DataSet& dataset) : AtomType()
}
//--------------------------------------------------------------------------
+// Function: IntType overloaded constructor
+///\brief Creates a IntType instance by opening an HDF5 integer datatype
+/// given its name as a char*.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Integer 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::openIntType(const char*) to
+// improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+IntType::IntType(const H5Location& loc, const char *type_name) : AtomType()
+{
+ id = p_opentype(loc, type_name);
+}
+
+//--------------------------------------------------------------------------
+// Function: IntType overloaded constructor
+///\brief Creates a IntType instance by opening an HDF5 integer datatype
+/// given its name, provided as an \c H5std_string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Integer 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::openIntType(const H5std_string&)
+// to improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+IntType::IntType(const H5Location& loc, const H5std_string& type_name) : AtomType()
+{
+ id = p_opentype(loc, type_name.c_str());
+}
+
+//--------------------------------------------------------------------------
+// Function: IntType::decode
+///\brief Returns an IntType object via DataType* by decoding the
+/// binary object description of this type.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+DataType* IntType::decode() const
+{
+ hid_t encoded_inttype_id = H5I_INVALID_HID;
+ try {
+ encoded_inttype_id = p_decode();
+ }
+ catch (DataTypeIException &err) {
+ throw;
+ }
+ IntType *encoded_inttype = new IntType;
+ encoded_inttype->p_setId(encoded_inttype_id);
+ return(encoded_inttype);
+}
+
+//--------------------------------------------------------------------------
// Function: IntType::getSign
///\brief Retrieves the sign type for an integer type.
///\return Valid sign type
diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h
index 5602b32..3e10111 100644
--- a/c++/src/H5IntType.h
+++ b/c++/src/H5IntType.h
@@ -32,6 +32,14 @@ class H5_DLLCPP IntType : public AtomType {
// Gets the integer datatype of the specified dataset
IntType(const DataSet& dataset);
+ // Constructors that open an HDF5 integer datatype, given a location.
+ IntType(const H5Location& loc, const char* name);
+ IntType(const H5Location& loc, const H5std_string& name);
+
+ // Returns an IntType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType* decode() const;
+
// Retrieves the sign type for an integer type
H5T_sign_t getSign() const;
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index ab09305..4ef5d82 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -338,10 +338,13 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new
//--------------------------------------------------------------------------
// Function: H5Location::getNumAttrs
-///\brief Returns the number of attributes attached to this HDF5 object.
+///\brief Deprecated - Returns the number of attributes attached to
+/// this HDF5 object.
///\return Number of attributes
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
+// Modification
+// - Moved to H5Object in 1.8.20. -BMR
//--------------------------------------------------------------------------
int H5Location::getNumAttrs() const
{
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index bbeb30f..7a54c2b 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -41,20 +41,6 @@ class UserData4Aiterate { // user data for attribute iteration
// Inheritance: IdComponent
class H5_DLLCPP H5Location : public IdComponent {
public:
- // Creates an attribute for the specified object at this location
- // PropList is currently not used, so always be default.
- virtual Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
- virtual Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
-
- // Given its name, opens the attribute that belongs to an object at
- // this location.
- virtual Attribute openAttribute(const char* name) const;
- virtual Attribute openAttribute(const H5std_string& name) const;
-
- // Given its index, opens the attribute that belongs to an object at
- // this location.
- virtual Attribute openAttribute(const unsigned int idx) const;
-
// Checks if a link of a given name exists in this location
bool nameExists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
bool nameExists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
@@ -66,7 +52,8 @@ class H5_DLLCPP H5Location : public IdComponent {
H5std_string getFileName() const;
// Determines the number of attributes at this location.
- int getNumAttrs() const;
+ // - moved to H5Object (1.8.20)
+ int getNumAttrs() const; // Deprecated
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
@@ -78,21 +65,6 @@ class H5_DLLCPP H5Location : public IdComponent {
// Note: getRefObjType deprecates getObjType, but getObjType's name is
// misleading, so getRefObjType is used in the new function instead.
- // Iterate user's function over the attributes at this location.
- virtual int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
-
- // Checks whether the named attribute exists at this location.
- virtual bool attrExists(const char* name) const;
- virtual bool attrExists(const H5std_string& name) const;
-
- // Renames the named attribute to a new name.
- virtual void renameAttr(const char* oldname, const char* newname) const;
- virtual void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
-
- // Removes the named attribute from this location.
- virtual void removeAttr(const char* name) const;
- virtual void removeAttr(const H5std_string& name) const;
-
// Returns the object header version of an object
unsigned objVersion() const;
@@ -140,6 +112,51 @@ class H5_DLLCPP H5Location : public IdComponent {
///\brief Returns an identifier. (pure virtual)
virtual hid_t getId() const = 0;
+/***************************************************************************
+ Notes for H5A wrappers
+ ======================
+ These H5A wrappers are marked "deprecated" in 1.8.19.
+ They are moved to H5Object to prevent the object id from being
+ passed in to H5A APIs.
+***************************************************************************/
+
+ // Creates an attribute for the specified object at this location
+ // PropList is currently not used, so always be default.
+ // Deprecated
+ virtual Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
+ virtual Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
+
+ // Given its name, opens the attribute that belongs to an object at
+ // this location.
+ // Deprecated
+ virtual Attribute openAttribute(const char* name) const;
+ virtual Attribute openAttribute(const H5std_string& name) const;
+
+ // Given its index, opens the attribute that belongs to an object at
+ // this location.
+ virtual Attribute openAttribute(const unsigned int idx) const; // Deprecated
+
+ // Iterate user's function over the attributes at this location.
+ virtual int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL,
+ void* op_data = NULL); // Deprecated
+
+ // Checks whether the named attribute exists at this location.
+ // Deprecated
+ virtual bool attrExists(const char* name) const;
+ virtual bool attrExists(const H5std_string& name) const;
+
+ // Renames the named attribute to a new name.
+ // Deprecated
+ virtual void renameAttr(const char* oldname, const char* newname) const;
+ virtual void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
+
+ // Removes the named attribute from this location.
+ // Deprecated
+ virtual void removeAttr(const char* name) const;
+ virtual void removeAttr(const H5std_string& name) const;
+
+/**************************** End of H5A note *******************************/
+
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Default constructor,
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index b35206e..8fe8e56 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -29,6 +29,23 @@
namespace H5 {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// userAttrOpWrpr simply interfaces between the user's function and the
+// C library function H5Aiterate2; used to resolve the different prototype
+// problem. May be moved to Iterator later.
+ /* extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
+ const H5A_info_t *ainfo, void *op_data)
+{
+ H5std_string s_attr_name = H5std_string(attr_name);
+#ifdef NO_STATIC_CAST
+ UserData4Aiterate* myData = (UserData4Aiterate *) op_data;
+#else
+ UserData4Aiterate* myData = static_cast <UserData4Aiterate *> (op_data);
+#endif
+ myData->op(*myData->location, s_attr_name, myData->opData);
+ return 0;
+}
+ */
+
//--------------------------------------------------------------------------
// Function: H5Object default constructor (protected)
// Programmer Binh-Minh Ribler - 2000
@@ -272,6 +289,25 @@ void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newna
// end of Notes for H5A wrappers
//--------------------------------------------------------------------------
+// Function: H5Object::getNumAttrs
+///\brief Returns the number of attributes attached to this HDF5 object.
+///\return Number of attributes
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// - Moved from H5Location in 1.8.20. -BMR Oct, 2017
+//--------------------------------------------------------------------------
+int H5Object::getNumAttrs() const
+{
+ H5O_info_t oinfo; /* Object info */
+
+ if(H5Oget_info(getId(), &oinfo) < 0)
+ throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
+ else
+ return(static_cast<int>(oinfo.num_attrs));
+}
+
+//--------------------------------------------------------------------------
// Function: getObjName
///\brief Given an id, returns the type of the object.
///\return The name of the object
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index 8d9cb45..afeea7d 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -33,6 +33,7 @@ namespace H5 {
Apr 2, 2014: Added wrapper getObjName for H5Iget_name -BMR
*/
// Inheritance: H5Location -> IdComponent
+
class H5_DLLCPP H5Object : public H5Location {
public:
// Creates an attribute for the specified object
@@ -59,6 +60,9 @@ class H5_DLLCPP H5Object : public H5Location {
void removeAttr(const char* name) const;
void removeAttr(const H5std_string& name) const;
+ // Determines the number of attributes belong to this object.
+ int getNumAttrs() const;
+
// Gets the name of this HDF5 object, i.e., Group, DataSet, or
// DataType.
ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
@@ -81,7 +85,7 @@ class H5_DLLCPP H5Object : public H5Location {
// removal does not raise any problems in two 1.10 releases.
// Creates a copy of an existing object giving the object id
- H5Object(const hid_t object_id);
+ // H5Object(const hid_t object_id);
// Copy constructor: makes copy of an H5Object object.
// H5Object(const H5Object& original);
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index ef63ccb..00fbe20 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -142,6 +142,65 @@ StrType::StrType(const DataSet& dataset) : AtomType ()
}
//--------------------------------------------------------------------------
+// Function: StrType overloaded constructor
+///\brief Creates an StrType instance by opening an HDF5 string datatype
+/// given its name, provided as a C character string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: String 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::openStrType(const char*)
+// to improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+StrType::StrType(const H5Location& loc, const char *type_name) : AtomType()
+{
+ id = p_opentype(loc, type_name);
+}
+
+//--------------------------------------------------------------------------
+// Function: StrType overloaded constructor
+///\brief Creates an StrType instance by opening an HDF5 string datatype
+/// given its name, provided as an \c H5std_string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: String 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::openStrType(const H5std_string&)
+// to improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+StrType::StrType(const H5Location& loc, const H5std_string& type_name) : AtomType()
+{
+ id = p_opentype(loc, type_name.c_str());
+}
+
+//--------------------------------------------------------------------------
+// Function: StrType::decode
+///\brief Returns an StrType object via DataType* by decoding the
+/// binary object description of this type.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+DataType* StrType::decode() const
+{
+ hid_t encoded_strtype_id = H5I_INVALID_HID;
+ try {
+ encoded_strtype_id = p_decode();
+ }
+ catch (DataTypeIException &err) {
+ throw;
+ }
+ StrType *encoded_strtype = new StrType;
+ encoded_strtype->p_setId(encoded_strtype_id);
+ return(encoded_strtype);
+}
+
+//--------------------------------------------------------------------------
// Function: StrType::getCset
///\brief Retrieves the character set type of this string datatype.
///\return Character set type, which can be:
diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h
index 7ae33ee..24c9ca3 100644
--- a/c++/src/H5StrType.h
+++ b/c++/src/H5StrType.h
@@ -36,6 +36,14 @@ class H5_DLLCPP StrType : public AtomType {
// Gets the string datatype of the specified dataset
StrType(const DataSet& dataset);
+ // Constructors that open an HDF5 string datatype, given a location.
+ StrType(const H5Location& loc, const char* name);
+ StrType(const H5Location& loc, const H5std_string& name);
+
+ // Returns an StrType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType* decode() const;
+
// Retrieves the character set type of this string datatype.
H5T_cset_t getCset() const;
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index c3d5e58..8d9e3a1 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -70,6 +70,65 @@ VarLenType::VarLenType(const DataType* base_type) : DataType()
}
//--------------------------------------------------------------------------
+// Function: VarLenType overloaded constructor
+///\brief Creates an VarLenType instance by opening an HDF5 variable
+/// length datatype given its name, provided as a C char*.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Variable length 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::openVarLenType(const char*) to
+// improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+VarLenType::VarLenType(const H5Location& loc, const char *type_name) : DataType()
+{
+ id = p_opentype(loc, type_name);
+}
+
+//--------------------------------------------------------------------------
+// Function: VarLenType overloaded constructor
+///\brief Creates an VarLenType instance by opening an HDF5 variable
+/// length datatype given its name, provided as an \c H5std_string.
+///\param loc - IN: Location of the type
+///\param type_name - IN: Variable length 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::openVarLenType(const H5std_string&) to
+// improve usability.
+// -BMR, Sept 2017
+//--------------------------------------------------------------------------
+VarLenType::VarLenType(const H5Location& loc, const H5std_string& type_name) : DataType()
+{
+ id = p_opentype(loc, type_name.c_str());
+}
+
+//--------------------------------------------------------------------------
+// Function: VarLenType::decode
+///\brief Returns an VarLenType object via DataType* by decoding the
+/// binary object description of this type.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Sept 2017
+//--------------------------------------------------------------------------
+DataType* VarLenType::decode() const
+{
+ hid_t encoded_vltype_id = H5I_INVALID_HID;
+ try {
+ encoded_vltype_id = p_decode();
+ }
+ catch (DataTypeIException &err) {
+ throw;
+ }
+ VarLenType *encoded_vltype = new VarLenType;
+ encoded_vltype->p_setId(encoded_vltype_id);
+ return(encoded_vltype);
+}
+
+//--------------------------------------------------------------------------
// Function: VarLenType destructor
///\brief Properly terminates access to this datatype.
// Programmer Binh-Minh Ribler - May, 2004
diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h
index 1b93876..a9713ad 100644
--- a/c++/src/H5VarLenType.h
+++ b/c++/src/H5VarLenType.h
@@ -26,8 +26,19 @@ class H5_DLLCPP VarLenType : public DataType {
public:
// Constructor that creates a variable-length datatype based
// on the specified base type.
+ VarLenType(const DataType& base_type);
+
+ // Deprecated - will be removed after 1.8.20
VarLenType(const DataType* base_type);
+ // Constructors that open a variable-length datatype, given a location.
+ VarLenType(const H5Location& loc, const char* name);
+ VarLenType(const H5Location& loc, const H5std_string& name);
+
+ // Returns an VarLenType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType* decode() const;
+
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("VarLenType"); }