summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataType.h
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/H5DataType.h
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/H5DataType.h')
-rw-r--r--c++/src/H5DataType.h31
1 files changed, 27 insertions, 4 deletions
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);