summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2006-01-03 14:09:40 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2006-01-03 14:09:40 (GMT)
commited2764c29b48f0fd8f82d4936da1403c6fa48efa (patch)
treeaf4fb921e95050378d1b4dce45e8fe92e815ec0f /c++
parent5aa7685ae3efefa3bbc71fccf473598580af3ede (diff)
downloadhdf5-ed2764c29b48f0fd8f82d4936da1403c6fa48efa.zip
hdf5-ed2764c29b48f0fd8f82d4936da1403c6fa48efa.tar.gz
hdf5-ed2764c29b48f0fd8f82d4936da1403c6fa48efa.tar.bz2
[svn-r11855] Purpose: Adding more wrappers
Description: Added member function H5File::openFile and overloaded for convenience. Added overloaded getObjinfo to skip the middle parameter. Changed StrType(const size_t& size); to StrType(const int dummy, const size_t& size); because the first one clashed with StrType(const hid_t existing_id); Platforms tested: Linux 2.4 (heping) SunOS 5.8 64-bit (sol) AIX 5.1 (copper)
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5AtomType.cpp50
-rw-r--r--c++/src/H5CommonFG.cpp175
-rw-r--r--c++/src/H5CommonFG.h8
-rw-r--r--c++/src/H5File.cpp65
-rw-r--r--c++/src/H5File.h6
-rw-r--r--c++/src/H5StrType.cpp36
-rw-r--r--c++/src/H5StrType.h10
7 files changed, 256 insertions, 94 deletions
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index b41f2c3..7d38acc 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -76,14 +76,14 @@ void AtomType::setSize( size_t size ) const
}
//--------------------------------------------------------------------------
-// Function: AtomType::getOrder
-///\brief Returns the byte order of an atomic datatype.
-///\return Byte order, which can be:
-/// \li \c H5T_ORDER_LE
-/// \li \c H5T_ORDER_BE
-/// \li \c H5T_ORDER_VAX
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Mar, 2005
+// Function: AtomType::getOrder
+///\brief Returns the byte order of an atomic datatype.
+///\return Byte order, which can be:
+/// \li \c H5T_ORDER_LE
+/// \li \c H5T_ORDER_BE
+/// \li \c H5T_ORDER_VAX
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
H5T_order_t AtomType::getOrder() const
{
@@ -94,27 +94,27 @@ H5T_order_t AtomType::getOrder() const
if( type_order == H5T_ORDER_ERROR )
{
throw DataTypeIException(inMemFunc("getOrder"),
- "H5Tget_order returns H5T_ORDER_ERROR");
+ "H5Tget_order returns H5T_ORDER_ERROR");
}
return( type_order );
}
//--------------------------------------------------------------------------
-// Function: AtomType::getOrder
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes a reference to a \c std::string for the buffer that
-/// provide the text description of the returned byte order.
-/// The text description can be either of the following:
-/// "Little endian byte ordering (0)";
-/// "Big endian byte ordering (1)";
-/// "VAX mixed byte ordering (2)";
-///\param order_string - OUT: Text description of the returned byte order
-///\return Byte order, which can be:
-/// \li \c H5T_ORDER_LE
-/// \li \c H5T_ORDER_BE
-/// \li \c H5T_ORDER_VAX
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AtomType::getOrder
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c std::string for the buffer that
+/// provide the text description of the returned byte order.
+/// The text description can be either of the following:
+/// "Little endian byte ordering (0)";
+/// "Big endian byte ordering (1)";
+/// "VAX mixed byte ordering (2)";
+///\param order_string - OUT: Text description of the returned byte order
+///\return Byte order, which can be:
+/// \li \c H5T_ORDER_LE
+/// \li \c H5T_ORDER_BE
+/// \li \c H5T_ORDER_VAX
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_order_t AtomType::getOrder( string& order_string ) const
{
@@ -267,7 +267,7 @@ void AtomType::getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const
}
//--------------------------------------------------------------------------
-// Function: AtomType::getPad
+// Function: AtomType::setPad
///\brief Sets the least and most-significant bits padding types.
///\param lsb - IN: Least-significant bit padding type
///\param msb - IN: Most-significant bit padding type
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index ebf6c8b..5e34c46 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -288,6 +288,11 @@ void CommonFG::unlink( const string& name ) const
///\param src - IN: Object's original name
///\param dst - IN: Object's new name
///\exception H5::FileIException or H5::GroupIException
+///\note
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with Group::move. Please refer
+/// to the Group Interface in the HDF5 User's Guide at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/Groups.html
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void CommonFG::move( const char* src, const char* dst ) const
@@ -318,6 +323,10 @@ void CommonFG::move( const string& src, const string& dst ) const
///\param follow_link - IN: Link flag
///\param statbuf - OUT: Buffer to return information about the object
///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// For more information, please refer to the C layer Reference
+/// Manual at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5G.html#Group-GetObjinfo
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void CommonFG::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& statbuf ) const
@@ -342,6 +351,34 @@ void CommonFG::getObjinfo( const string& name, hbool_t follow_link, H5G_stat_t&
}
//--------------------------------------------------------------------------
+// Function: CommonFG::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above functions in that it doesn't have
+/// the paramemter \a follow_link.
+// Programmer Binh-Minh Ribler - Nov, 2005
+//--------------------------------------------------------------------------
+void CommonFG::getObjinfo( const char* name, H5G_stat_t& statbuf ) const
+{
+ herr_t ret_value = H5Gget_objinfo( getLocId(), name, 0, &statbuf );
+ if( ret_value < 0 )
+ {
+ throwException("getObjinfo", "H5Gget_objinfo failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - Nov, 2005
+//--------------------------------------------------------------------------
+void CommonFG::getObjinfo( const string& name, H5G_stat_t& statbuf ) const
+{
+ getObjinfo( name.c_str(), statbuf );
+}
+
+//--------------------------------------------------------------------------
// Function: CommonFG::getLinkval
///\brief Returns the name of the object that the symbolic link points to.
///\param name - IN: Symbolic link to the object
@@ -586,38 +623,6 @@ void CommonFG::unmount( const string& name ) const
}
//--------------------------------------------------------------------------
-// Function: CommonFG::p_open_data_type (private)
-// Purpose Opens the named datatype and returns the datatype's identifier.
-// Return Id of the datatype
-// Exception H5::FileIException or H5::GroupIException
-// Description
-// This private function is used by the member functions
-// CommonFG::openXxxType, where Xxx indicates the specific
-// datatypes.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-hid_t CommonFG::p_open_data_type( const char* name ) const
-{
- // Call C function H5Topen to open the named datatype in this group,
- // giving either the file or group id
- hid_t datatype_id = H5Topen( getLocId(), name );
-
- // If the datatype's opening failed, throw an exception
- if( datatype_id < 0 )
- {
- throwException("openDataType", "H5Topen failed");
- }
-
- // No failure, return the datatype id
- return( datatype_id );
-}
-
-//
-// The following member functions use the private function
-// p_open_data_type to open a named datatype in this location
-//
-
-//--------------------------------------------------------------------------
// Function: CommonFG::openDataType
///\brief Opens the named generic datatype at this location.
///\param name - IN: Name of the datatype to open
@@ -627,8 +632,18 @@ hid_t CommonFG::p_open_data_type( const char* name ) const
//--------------------------------------------------------------------------
DataType CommonFG::openDataType( const char* name ) const
{
- DataType data_type(p_open_data_type(name));
- return( data_type );
+ // Call C function H5Topen to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen(getLocId(), name);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ {
+ throwException("openDataType", "H5Topen failed");
+ }
+ // No failure, create and return the DataType object
+ DataType data_type(type_id);
+ return(data_type);
}
//--------------------------------------------------------------------------
@@ -649,11 +664,21 @@ DataType CommonFG::openDataType( const string& name ) const
///\param name - IN: Name of the array datatype to open
///\return ArrayType instance
///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
ArrayType CommonFG::openArrayType( const char* name ) const
{
- ArrayType array_type(p_open_data_type(name));
+ // Call C function H5Topen to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen(getLocId(), name);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ {
+ throwException("openArrayType", "H5Topen failed");
+ }
+ // No failure, create and return the ArrayType object
+ ArrayType array_type (type_id);
return(array_type);
}
@@ -662,7 +687,7 @@ ArrayType CommonFG::openArrayType( const char* name ) const
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
/// \c std::string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
ArrayType CommonFG::openArrayType( const string& name ) const
{
@@ -679,7 +704,17 @@ ArrayType CommonFG::openArrayType( const string& name ) const
//--------------------------------------------------------------------------
CompType CommonFG::openCompType( const char* name ) const
{
- CompType comp_type(p_open_data_type(name));
+ // Call C function H5Topen to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen(getLocId(), name);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ {
+ throwException("openCompType", "H5Topen failed");
+ }
+ // No failure, create and return the CompType object
+ CompType comp_type(type_id);
return(comp_type);
}
@@ -705,7 +740,17 @@ CompType CommonFG::openCompType( const string& name ) const
//--------------------------------------------------------------------------
EnumType CommonFG::openEnumType( const char* name ) const
{
- EnumType enum_type(p_open_data_type(name));
+ // Call C function H5Topen to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen(getLocId(), name);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ {
+ throwException("openEnumType", "H5Topen failed");
+ }
+ // No failure, create and return the EnumType object
+ EnumType enum_type(type_id);
return(enum_type);
}
@@ -731,7 +776,17 @@ EnumType CommonFG::openEnumType( const string& name ) const
//--------------------------------------------------------------------------
IntType CommonFG::openIntType( const char* name ) const
{
- IntType int_type(p_open_data_type(name));
+ // Call C function H5Topen to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen(getLocId(), name);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ {
+ throwException("openIntType", "H5Topen failed");
+ }
+ // No failure, create and return the IntType object
+ IntType int_type(type_id);
return(int_type);
}
@@ -757,7 +812,17 @@ IntType CommonFG::openIntType( const string& name ) const
//--------------------------------------------------------------------------
FloatType CommonFG::openFloatType( const char* name ) const
{
- FloatType float_type(p_open_data_type(name));
+ // Call C function H5Topen to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen(getLocId(), name);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ {
+ throwException("openFloatType", "H5Topen failed");
+ }
+ // No failure, create and return the FloatType object
+ FloatType float_type(type_id);
return(float_type);
}
@@ -783,7 +848,17 @@ FloatType CommonFG::openFloatType( const string& name ) const
//--------------------------------------------------------------------------
StrType CommonFG::openStrType( const char* name ) const
{
- StrType str_type(p_open_data_type(name));
+ // Call C function H5Topen to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen(getLocId(), name);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ {
+ throwException("openStrType", "H5Topen failed");
+ }
+ // No failure, create and return the StrType object
+ StrType str_type(type_id);
return(str_type);
}
@@ -805,11 +880,21 @@ StrType CommonFG::openStrType( const string& name ) const
///\param name - IN: Name of the variable length datatype to open
///\return VarLenType instance
///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
VarLenType CommonFG::openVarLenType( const char* name ) const
{
- VarLenType varlen_type(p_open_data_type(name));
+ // Call C function H5Topen to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen(getLocId(), name);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ {
+ throwException("openVarLenType", "H5Topen failed");
+ }
+ // No failure, create and return the VarLenType object
+ VarLenType varlen_type(type_id);
return(varlen_type);
}
@@ -818,7 +903,7 @@ VarLenType CommonFG::openVarLenType( const char* name ) const
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
/// \c std::string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
VarLenType CommonFG::openVarLenType( const string& name ) const
{
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index effb9d3..d1c4ce7 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -72,6 +72,8 @@ class H5_DLLCPP CommonFG {
// at this location.
void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
void getObjinfo(const string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
+ void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
+ void getObjinfo(const string& name, H5G_stat_t& statbuf) const;
// Retrieves the name of an object in this group, given the
// object's index.
@@ -141,9 +143,11 @@ class H5_DLLCPP CommonFG {
VarLenType openVarLenType(const char* name) const;
VarLenType openVarLenType(const string& name) const;
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
/// For subclasses, H5File and Group, to return the correct
/// object id, i.e. file or group id.
virtual hid_t getLocId() const = 0;
+#endif // DOXYGEN_SHOULD_SKIP_THIS
/// For subclasses, H5File and Group, to throw appropriate exception.
virtual void throwException(const string func_name, const string msg) const = 0;
@@ -154,10 +158,6 @@ class H5_DLLCPP CommonFG {
// Noop destructor.
virtual ~CommonFG();
- private:
- // Common code for member functions openXxxType
- hid_t p_open_data_type(const char* name) const;
-
}; // end of CommonFG declaration
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 7a4d107..6ce9216 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -157,12 +157,12 @@ H5File::H5File( const H5File& original ) : IdComponent( original ) {}
///\exception H5::FileIException
// Programmer Binh-Minh Ribler - Dec. 2005
//--------------------------------------------------------------------------
-void H5File::flush(H5F_scope_t scope ) const
+void H5File::flush(H5F_scope_t scope) const
{
herr_t ret_value = H5Fflush( id, scope );
if( ret_value < 0 )
{
- throw FileIException("H5File::flush", "H5Fflush returned negative value");
+ throw FileIException("H5File::flush", "H5Fflush failed");
}
}
@@ -174,7 +174,7 @@ void H5File::flush(H5F_scope_t scope ) const
///\exception H5::FileIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool H5File::isHdf5(const char* name )
+bool H5File::isHdf5(const char* name)
{
// Calls C routine H5Fis_hdf5 to determine whether the file is in
// HDF5 format. It returns positive value, 0, or negative value
@@ -202,6 +202,48 @@ bool H5File::isHdf5(const string& name )
}
//--------------------------------------------------------------------------
+// Function: openFile
+///\brief Opens an HDF5 file
+///\param name - IN: Name of the file
+///\param flags - IN: File access flags
+///\param access_plist - IN: File access property list. Default to
+/// FileCreatPropList::DEFAULT
+///\par Description
+/// Valid values of \a flags include:
+/// H5F_ACC_RDWR: Open with read/write access. If the file is
+/// currently open for read-only access then it
+/// will be reopened. Absence of this flag
+/// implies read-only access.
+///
+/// H5F_ACC_RDONLY: Open with read only access. - default
+///
+// Programmer Binh-Minh Ribler - Oct, 2005
+//--------------------------------------------------------------------------
+void H5File::openFile(const char* name, unsigned int flags, const FileAccPropList& access_plist)
+{
+ hid_t access_plist_id = access_plist.getId();
+ id = H5Fopen (name, flags, access_plist_id);
+ if (id < 0) // throw an exception when open fails
+ {
+ throw FileIException("H5File::openFile", "H5Fopen failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5File::openFile
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \c std::string for \a name.
+///\param name - IN: Name of the file - \c std::string
+///\param flags - IN: File access flags
+///\param access_plist - IN: File access property list. Default to
+/// FileAccPropList::DEFAULT
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void H5File::openFile(const string& name, unsigned int flags, const FileAccPropList& access_plist)
+{
+ openFile(name.c_str(), flags, access_plist);
+}
+//--------------------------------------------------------------------------
// Function: H5File::reOpen
///\brief Reopens this file.
///
@@ -216,6 +258,7 @@ bool H5File::isHdf5(const string& name )
// Replaced resetIdComponent with decRefCount to use C library
// ID reference counting mechanism - BMR, Feb 20, 2005
//--------------------------------------------------------------------------
+
void H5File::reOpen()
{
// If this object has a valid id, appropriately decrement reference
@@ -541,7 +584,12 @@ void* H5File::Reference(const string& name) const
//--------------------------------------------------------------------------
H5G_obj_t H5File::getObjType(void *ref, H5R_type_t ref_type) const
{
- return(p_get_obj_type(ref, ref_type));
+ try {
+ return(p_get_obj_type(ref, ref_type));
+ }
+ catch (IdComponentException E) {
+ throw FileIException("H5File::getObjType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
@@ -555,8 +603,13 @@ H5G_obj_t H5File::getObjType(void *ref, H5R_type_t ref_type) const
//--------------------------------------------------------------------------
DataSpace H5File::getRegion(void *ref, H5R_type_t ref_type) const
{
- DataSpace dataspace(p_get_region(ref, ref_type));
- return(dataspace);
+ try {
+ DataSpace dataspace(p_get_region(ref, ref_type));
+ return(dataspace);
+ }
+ catch (IdComponentException E) {
+ throw FileIException("H5File::getRegion", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index ea6b21e..e5e2343 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -30,6 +30,12 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
const FileAccPropList& access_plist = FileAccPropList::DEFAULT );
+ // Open the file
+ void openFile(const string& name, unsigned int flags,
+ const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ void openFile(const char* name, unsigned int flags,
+ const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+
// Close this file.
virtual void close();
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index 68b91fd..f76406a 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -62,20 +62,21 @@ StrType::StrType( const PredType& pred_type ) : AtomType()
//--------------------------------------------------------------------------
// Function: StrType overloaded constructor
///\brief Creates a string datatype with a specified length
-///\param existing_id - IN: Id of an existing datatype
+///\param pred_type - IN: String predefined type to replicate.
+///\param size - IN: Length of the new string type
///\exception H5::DataTypeIException
// Description
// The 1st argument could have been skipped, but this
// constructor will collide with the one that takes an
// existing id.
//
-// Update: by passing 'size' by reference will avoid the
-// clashing problem, so the 1st argument can actually be
-// omitted. This constructor should be replaced by the
-// other after announcing. - May, 2004
+// Update: replacing the 1st argument with a dummy 0 to
+// avoid the clashing problem, that doesn't eliminate the
+// the 1st argument but it's simpler for the user to type
+// a '0' than PredType::C_S1. - Dec 2, 2005
///\note
-/// This constructor will be obsolete in later releases,
-/// please use StrType( const size_t& size ) instead.
+/// The use of this constructor can be shortened by using
+/// its overloaded below as StrType(0, size).
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
StrType::StrType( const PredType& pred_type, const size_t size ) : AtomType()
@@ -85,7 +86,24 @@ StrType::StrType( const PredType& pred_type, const size_t size ) : AtomType()
copy(pred_type);
setSize(size);
}
-StrType::StrType( const size_t& size ) : AtomType()
+
+//--------------------------------------------------------------------------
+// Function: StrType overloaded constructor
+///\brief Creates a string datatype with a specified length
+///\param dummy - IN: To simplify calling the previous constructor
+// and avoid prototype clash with another constructor
+///\param size - IN: Length of the new string type
+///\exception H5::DataTypeIException
+///\par Description
+/// The 1st argument is just a dummy to simplify calling the
+/// previous constructor, such as:
+/// StrType atype(0, size) instead of
+/// StrType atype(PredType::C_S1, size)
+///\note
+/// This constructor may replace the previous one in the future.
+// Programmer Binh-Minh Ribler - Nov 28, 2005
+//--------------------------------------------------------------------------
+StrType::StrType( const int dummy, const size_t& size ) : AtomType()
{
// use DataType::copy to make a copy of the string predefined type
// then set its length
@@ -110,7 +128,7 @@ StrType::StrType( const hid_t existing_id ) : AtomType( existing_id ) {}
StrType::StrType( const StrType& original ) : AtomType ( original ) {}
//--------------------------------------------------------------------------
-// Function: EnumType overloaded constructor
+// Function: StrType overloaded constructor
///\brief Gets the string datatype of the specified dataset
///\param dataset - IN: Dataset that this string datatype associates with
///\exception H5::DataTypeIException
diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h
index b79ad0b..80ebbe4 100644
--- a/c++/src/H5StrType.h
+++ b/c++/src/H5StrType.h
@@ -25,12 +25,12 @@ class H5_DLLCPP StrType : public AtomType {
// Creates a string type using a predefined type
StrType(const PredType& pred_type);
- // Creates a string type with specified length
- StrType(const size_t& size);
-
- // Creates a string type with specified length - will be obsolete
+ // Creates a string type with specified length - may be obsolete
StrType(const PredType& pred_type, const size_t size);
+ // Creates a string type with specified length
+ StrType(const int dummy, const size_t& size);
+
// Gets the string datatype of the specified dataset
StrType(const DataSet& dataset);
@@ -47,7 +47,7 @@ class H5_DLLCPP StrType : public AtomType {
void setStrpad(H5T_str_t strpad) const;
// Returns this class name
- virtual string fromClass () const { return ("StrType"); }
+ virtual string fromClass () const { return("StrType"); }
// default constructor
StrType();