From d15b6b8d63b44c09a82ae020ca6d574f277289c7 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 17 May 2004 23:46:27 -0500 Subject: [svn-r8537] Purpose: Add more C++ wrapper - incrementally check-in Description: Added wrapper for H5Tis_variable_str to DataType class. Tests for the new wrappers will follow in a few weeks. Platforms: SunOS 5.7 (arabica) Linux 2.4 (eirene) Windows 2000 Misc. update: --- c++/src/H5DataType.cpp | 22 ++++++++++++++++++++++ c++/src/H5DataType.h | 7 +++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index dbe7801..867eb4e 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -507,6 +507,28 @@ bool DataType::detectClass(H5T_class_t cls) const } //-------------------------------------------------------------------------- +// Function: DataType::isVariableStr +///\brief Check whether this datatype is a variable-length string. +///\return true if this datatype is a variable-length string, and +/// false, otherwise. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +bool DataType::isVariableStr() const +{ + htri_t is_varlen_str = H5Tis_variable_str(id); + if( is_varlen_str == 1 ) + return true; + else if( is_varlen_str == 0 ) + return false; + else + { + throw DataTypeIException("DataType::isVariableStr", + "H5Tis_variable_str returns negative value"); + } +} + +//-------------------------------------------------------------------------- // This private function calls the C API H5Tclose to close this datatype. // Used by H5Object::p_reset. // Programmer Binh-Minh Ribler - 2000 diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 6d49f7b..24b7ba3 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -81,12 +81,11 @@ class H5_DLLCPP DataType : public H5Object { // Gets the tag associated with an opaque datatype. string getTag() const; - // Checks whether this datatype contains (or is) a certain type class + // Checks whether this datatype contains (or is) a certain type class. bool detectClass(H5T_class_t cls) const; - // Creates a new variable-length datatype - not implemented yet - // Will be moved into a subclass when completed - //DataType vlenCreate( const DataType& base_type ); + // Checks whether this datatype is a variable-length string. + bool isVariableStr() const; // Used by the API to appropriately close a datatype void p_close() const; -- cgit v0.12