summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5AtomType.cpp2
-rw-r--r--c++/src/H5CommonFG.cpp28
-rw-r--r--c++/src/H5CommonFG.h2
-rw-r--r--c++/src/H5File.cpp45
-rw-r--r--c++/src/H5File.h6
-rw-r--r--c++/src/H5StrType.cpp36
-rw-r--r--c++/src/H5StrType.h8
7 files changed, 112 insertions, 15 deletions
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 3ed814e..48d833c 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -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 836d7b4..fb801e9 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -351,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
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 058b989..8fa1e1d 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.
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 50a2fca..abcbc6b 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -116,7 +116,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
{
// These bits only set for creation, so if any of them are set,
// create the file.
- if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG ))
+ if( flags & (H5F_ACC_CREAT|H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG))
{
hid_t create_plist_id = create_plist.getId();
hid_t access_plist_id = access_plist.getId();
@@ -183,6 +183,49 @@ 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.
///
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 30ee167..7e73ef3 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 9bf3f93..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);