summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/H5AcreatProp.cpp12
-rw-r--r--c++/src/H5Attribute.cpp31
-rw-r--r--c++/src/H5Attribute.h6
-rw-r--r--c++/src/H5CompType.cpp10
-rw-r--r--c++/src/H5DataSet.cpp13
-rw-r--r--c++/src/H5DataSet.h3
-rw-r--r--c++/src/H5DataType.cpp13
-rw-r--r--c++/src/H5DataType.h3
-rw-r--r--c++/src/H5DxferProp.cpp2
-rw-r--r--c++/src/H5Exception.cpp88
-rw-r--r--c++/src/H5Exception.h30
-rw-r--r--c++/src/H5File.cpp14
-rw-r--r--c++/src/H5Group.cpp14
-rw-r--r--c++/src/H5IdComponent.cpp8
-rw-r--r--c++/src/H5IdComponent.h4
-rw-r--r--c++/src/H5LaccProp.cpp4
-rw-r--r--c++/src/H5LaccProp.h3
-rw-r--r--c++/src/H5LcreatProp.cpp12
-rw-r--r--c++/src/H5Location.cpp194
-rw-r--r--c++/src/H5Object.cpp24
-rw-r--r--c++/src/H5Object.h6
-rw-r--r--c++/src/H5StrcreatProp.cpp8
22 files changed, 293 insertions, 209 deletions
diff --git a/c++/src/H5AcreatProp.cpp b/c++/src/H5AcreatProp.cpp
index 29886d8..825d230 100644
--- a/c++/src/H5AcreatProp.cpp
+++ b/c++/src/H5AcreatProp.cpp
@@ -39,7 +39,7 @@ AttrCreatPropList* AttrCreatPropList::DEFAULT_ = 0;
// If AttrCreatPropList::DEFAULT_ already points to an allocated
// object, throw a PropListIException. This scenario should not
// happen.
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
AttrCreatPropList* AttrCreatPropList::getConstant()
{
@@ -65,7 +65,7 @@ AttrCreatPropList* AttrCreatPropList::getConstant()
// Purpose: Deletes the constant object that AttrCreatPropList::DEFAULT_
// points to.
// exception H5::PropListIException
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
void AttrCreatPropList::deleteConstants()
{
@@ -83,7 +83,7 @@ const AttrCreatPropList& AttrCreatPropList::DEFAULT = *getConstant();
//--------------------------------------------------------------------------
// Function: Default Constructor
///\brief Creates a file access property list
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
AttrCreatPropList::AttrCreatPropList() : StrCreatPropList(H5P_ATTRIBUTE_CREATE) {}
@@ -91,7 +91,7 @@ AttrCreatPropList::AttrCreatPropList() : StrCreatPropList(H5P_ATTRIBUTE_CREATE)
// Function: AttrCreatPropList copy constructor
///\brief Copy constructor: same HDF5 object as \a original
///\param original - IN: AttrCreatPropList instance to copy
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
AttrCreatPropList::AttrCreatPropList(const AttrCreatPropList& original) : StrCreatPropList(original) {}
@@ -99,14 +99,14 @@ AttrCreatPropList::AttrCreatPropList(const AttrCreatPropList& original) : StrCre
// Function: AttrCreatPropList overloaded constructor
///\brief Creates a file access property list using the id of an
/// existing one.
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
AttrCreatPropList::AttrCreatPropList(const hid_t plist_id) : StrCreatPropList(plist_id) {}
//--------------------------------------------------------------------------
// Function: AttrCreatPropList destructor
///\brief Noop destructor
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
AttrCreatPropList::~AttrCreatPropList() {}
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 3733736..739cda7 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -278,23 +278,6 @@ DataSpace Attribute::getSpace() const
}
//--------------------------------------------------------------------------
-// Function: Attribute::getFileName
-///\brief Gets the name of the file, in which this attribute belongs.
-///\return File name
-///\exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - Jul, 2004
-//--------------------------------------------------------------------------
-H5std_string Attribute::getFileName() const
-{
- try {
- return(p_get_file_name());
- }
- catch (IdComponentException& E) {
- throw FileIException("Attribute::getFileName", E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
// Function: Attribute::getName
///\brief Gets the name of this attribute, returning its length.
///\param attr_name - OUT: Buffer for the name string as char*
@@ -633,6 +616,20 @@ void Attribute::p_setId(const hid_t new_id)
// reset object's id to the given id
id = new_id;
}
+
+//--------------------------------------------------------------------------
+// Function: Attribute::throwException
+///\brief Throws H5::AttributeIException.
+///\param func_name - Name of the function where failure occurs
+///\param msg - Message describing the failure
+///\exception H5::AttributeIException
+// May 2018
+//--------------------------------------------------------------------------
+void Attribute::throwException(const H5std_string& func_name, const H5std_string& msg) const
+{
+ throw AttributeIException(inMemFunc(func_name.c_str()), msg);
+}
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index 98883e2..9ac21b5 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -41,9 +41,6 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
// Closes this attribute.
virtual void close();
- // Gets the name of the file, in which this attribute belongs.
- H5std_string getFileName() const;
-
// Gets the name of this attribute.
ssize_t getName(char* attr_name, size_t buf_size = 0) const;
H5std_string getName(size_t len) const;
@@ -80,6 +77,9 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
// Gets the attribute id.
virtual hid_t getId() const;
+ // Throw group exception.
+ virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+
// Destructor: properly terminates access to this attribute.
virtual ~Attribute();
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 9527037..903a7c4 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -191,7 +191,7 @@ H5std_string CompType::getMemberName(unsigned member_num) const
/// Members are stored in no particular order with numbers 0
/// through N-1, where N is the value returned by the member
/// function \c CompType::getNmembers.
-// May 16, 2002
+// May 2002
//--------------------------------------------------------------------------
int CompType::getMemberIndex(const char* name) const
{
@@ -216,7 +216,7 @@ int CompType::getMemberIndex(const char* name) const
/// Members are stored in no particular order with numbers 0
/// through N-1, where N is the value returned by the member
/// function \c CompType::getNmembers.
-// Apr 18, 2018
+// Apr 2018
//--------------------------------------------------------------------------
int CompType::getMemberIndex(const H5std_string& name) const
{
@@ -311,7 +311,7 @@ DataType CompType::getMemberDataType(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return ArrayType instance
///\exception H5::DataTypeIException
-// Jul, 2005
+// Jul 2005
//--------------------------------------------------------------------------
ArrayType CompType::getMemberArrayType(unsigned member_num) const
{
@@ -437,7 +437,7 @@ StrType CompType::getMemberStrType(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return VarLenType instance
///\exception H5::DataTypeIException
-// Jul, 2005
+// Jul 2005
//--------------------------------------------------------------------------
VarLenType CompType::getMemberVarLenType(unsigned member_num) const
{
@@ -533,7 +533,7 @@ void CompType::pack() const
///\exception H5::DataTypeIException
// Note
// H5Tset_size works on atom datatypes and compound datatypes only
-// 2014
+// March 2014
//--------------------------------------------------------------------------
void CompType::setSize(size_t size) const
{
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 14dd607..1dce28e 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -826,6 +826,19 @@ void DataSet::close()
}
//--------------------------------------------------------------------------
+// Function: DataSet::throwException
+///\brief Throws H5::DataSetIException.
+///\param func_name - Name of the function where failure occurs
+///\param msg - Message describing the failure
+///\exception H5::DataSetIException
+// May 2018
+//--------------------------------------------------------------------------
+void DataSet::throwException(const H5std_string& func_name, const H5std_string& msg) const
+{
+ throw DataSetIException(inMemFunc(func_name.c_str()), msg);
+}
+
+//--------------------------------------------------------------------------
// Function: DataSet destructor
///\brief Properly terminates access to this dataset.
// Programmer Binh-Minh Ribler - 2000
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index 09aab08..f0178f4 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -85,6 +85,9 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataSet"); }
+ // Throw DataSetIException.
+ virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+
// Creates a dataset by way of dereference.
DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 7b385d2..dc9b422 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -924,6 +924,19 @@ void DataType::close()
}
//--------------------------------------------------------------------------
+// Function: DataType::throwException
+///\brief Throws H5::DataTypeIException.
+///\param func_name - Name of the function where failure occurs
+///\param msg - Message describing the failure
+///\exception H5::DataTypeIException
+// May 2018
+//--------------------------------------------------------------------------
+void DataType::throwException(const H5std_string& func_name, const H5std_string& msg) const
+{
+ throw DataTypeIException(inMemFunc(func_name.c_str()), msg);
+}
+
+//--------------------------------------------------------------------------
// Function: DataType destructor
///\brief Properly terminates access to this datatype.
// Programmer Binh-Minh Ribler - 2000
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 29cc990..efb0c14 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -122,6 +122,9 @@ class H5_DLLCPP DataType : public H5Object {
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataType"); }
+ // Throw DataTypeIException.
+ virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+
// Creates a copy of an existing DataType using its id
DataType(const hid_t type_id);
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index da66ec6..f303e95 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -92,7 +92,7 @@ DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {}
// Function DSetMemXferPropList constructor
///\brief Creates a dataset transfer property list with transform
/// expression.
-// Programmer: Binh-Minh Ribler - 2000
+// March 2014
//--------------------------------------------------------------------------
DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET_XFER)
{
diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp
index 0bb15bc..e5cc7b2 100644
--- a/c++/src/H5Exception.cpp
+++ b/c++/src/H5Exception.cpp
@@ -331,27 +331,27 @@ void Exception::printError(FILE* stream) const
Exception::~Exception() throw() {}
//--------------------------------------------------------------------------
-// Subclass: FileIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: LocationException
+// Programmer Binh-Minh Ribler - 2014
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: FileIException default constructor
+// Function: LocationException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-FileIException::FileIException():Exception(){}
+LocationException::LocationException() : Exception(){}
//--------------------------------------------------------------------------
-// Function: FileIException overloaded constructor
-///\brief Creates a FileIException with the name of the function,
+// Function: LocationException overloaded constructor
+///\brief Creates a LocationException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-FileIException::FileIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+LocationException::LocationException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: FileIException destructor
+// Function: LocationException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
-FileIException::~FileIException() throw() {}
+LocationException::~LocationException() throw() {}
//--------------------------------------------------------------------------
// Subclass: GroupIException
@@ -361,7 +361,7 @@ FileIException::~FileIException() throw() {}
// Function: GroupIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-GroupIException::GroupIException():Exception(){}
+GroupIException::GroupIException() : LocationException(){}
//--------------------------------------------------------------------------
// Function: GroupIException overloaded constructor
///\brief Creates a GroupIException with the name of the function,
@@ -369,7 +369,7 @@ GroupIException::GroupIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-GroupIException::GroupIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+GroupIException::GroupIException(const H5std_string& func, const H5std_string& message) : LocationException(func, message) {}
//--------------------------------------------------------------------------
// Function: GroupIException destructor
///\brief Noop destructor.
@@ -377,6 +377,29 @@ GroupIException::GroupIException(const H5std_string& func, const H5std_string& m
GroupIException::~GroupIException() throw() {}
//--------------------------------------------------------------------------
+// Subclass: FileIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+// Function: FileIException default constructor
+///\brief Default constructor.
+//--------------------------------------------------------------------------
+FileIException::FileIException():GroupIException(){}
+//--------------------------------------------------------------------------
+// Function: FileIException overloaded constructor
+///\brief Creates a FileIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
+//--------------------------------------------------------------------------
+FileIException::FileIException(const H5std_string& func, const H5std_string& message) : GroupIException(func, message) {}
+//--------------------------------------------------------------------------
+// Function: FileIException destructor
+///\brief Noop destructor.
+//--------------------------------------------------------------------------
+FileIException::~FileIException() throw() {}
+
+//--------------------------------------------------------------------------
// Subclass: DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
@@ -384,7 +407,7 @@ GroupIException::~GroupIException() throw() {}
// Function: DataSpaceIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-DataSpaceIException::DataSpaceIException():Exception(){}
+DataSpaceIException::DataSpaceIException() : Exception(){}
//--------------------------------------------------------------------------
// Function: DataSpaceIException overloaded constructor
///\brief Creates a DataSpaceIException with the name of the function,
@@ -407,7 +430,7 @@ DataSpaceIException::~DataSpaceIException() throw() {}
// Function: DataTypeIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-DataTypeIException::DataTypeIException():Exception(){}
+DataTypeIException::DataTypeIException() : LocationException(){}
//--------------------------------------------------------------------------
// Function: DataTypeIException overloaded constructor
///\brief Creates a DataTypeIException with the name of the function,
@@ -415,7 +438,7 @@ DataTypeIException::DataTypeIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_string& message) : LocationException(func, message) {}
//--------------------------------------------------------------------------
// Function: DataTypeIException destructor
///\brief Noop destructor.
@@ -430,7 +453,7 @@ DataTypeIException::~DataTypeIException() throw() {}
// Function: PropListIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-PropListIException::PropListIException():Exception(){}
+PropListIException::PropListIException() : Exception(){}
//--------------------------------------------------------------------------
// Function: PropListIException overloaded constructor
///\brief Creates a PropListIException with the name of the function,
@@ -453,7 +476,7 @@ PropListIException::~PropListIException() throw() {}
// Function: DataSetIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-DataSetIException::DataSetIException():Exception(){}
+DataSetIException::DataSetIException() : LocationException(){}
//--------------------------------------------------------------------------
// Function: DataSetIException overloaded constructor
///\brief Creates a DataSetIException with the name of the function,
@@ -461,7 +484,7 @@ DataSetIException::DataSetIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataSetIException::DataSetIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+DataSetIException::DataSetIException(const H5std_string& func, const H5std_string& message) : LocationException(func, message) {}
//--------------------------------------------------------------------------
// Function: DataSetIException destructor
///\brief Noop destructor.
@@ -476,7 +499,7 @@ DataSetIException::~DataSetIException() throw() {}
// Function: AttributeIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-AttributeIException::AttributeIException():Exception(){}
+AttributeIException::AttributeIException() : LocationException(){}
//--------------------------------------------------------------------------
// Function: AttributeIException overloaded constructor
///\brief Creates an AttributeIException with the name of the function,
@@ -484,7 +507,7 @@ AttributeIException::AttributeIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-AttributeIException::AttributeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+AttributeIException::AttributeIException(const H5std_string& func, const H5std_string& message) : LocationException(func, message) {}
//--------------------------------------------------------------------------
// Function: AttributeIException destructor
///\brief Noop destructor.
@@ -499,7 +522,7 @@ AttributeIException::~AttributeIException() throw() {}
// Function: ReferenceException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-ReferenceException::ReferenceException():Exception(){}
+ReferenceException::ReferenceException() : Exception(){}
//--------------------------------------------------------------------------
// Function: ReferenceException overloaded constructor
///\brief Creates a ReferenceException with the name of the function,
@@ -522,7 +545,7 @@ ReferenceException::~ReferenceException() throw() {}
// Function: LibraryIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-LibraryIException::LibraryIException():Exception(){}
+LibraryIException::LibraryIException() : Exception(){}
//--------------------------------------------------------------------------
// Function: LibraryIException overloaded constructor
///\brief Creates a LibraryIException with the name of the function,
@@ -538,29 +561,6 @@ LibraryIException::LibraryIException(const H5std_string& func, const H5std_strin
LibraryIException::~LibraryIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: LocationException
-// Programmer Binh-Minh Ribler - 2014
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-// Function: LocationException default constructor
-///\brief Default constructor.
-//--------------------------------------------------------------------------
-LocationException::LocationException():Exception(){}
-//--------------------------------------------------------------------------
-// Function: LocationException overloaded constructor
-///\brief Creates a LocationException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
-//--------------------------------------------------------------------------
-LocationException::LocationException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
-//--------------------------------------------------------------------------
-// Function: LocationException destructor
-///\brief Noop destructor.
-//--------------------------------------------------------------------------
-LocationException::~LocationException() throw() {}
-
-//--------------------------------------------------------------------------
// Subclass: IdComponentException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h
index 7315e11..e15d81c 100644
--- a/c++/src/H5Exception.h
+++ b/c++/src/H5Exception.h
@@ -91,20 +91,27 @@ class H5_DLLCPP Exception {
H5std_string func_name;
};
-class H5_DLLCPP FileIException : public Exception {
+class H5_DLLCPP LocationException : public Exception {
public:
- FileIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- FileIException();
- virtual ~FileIException() throw();
+ LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ LocationException();
+ virtual ~LocationException() throw();
};
-class H5_DLLCPP GroupIException : public Exception {
+class H5_DLLCPP GroupIException : public LocationException {
public:
GroupIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
GroupIException();
virtual ~GroupIException() throw();
};
+class H5_DLLCPP FileIException : public GroupIException {
+ public:
+ FileIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ FileIException();
+ virtual ~FileIException() throw();
+};
+
class H5_DLLCPP DataSpaceIException : public Exception {
public:
DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
@@ -112,7 +119,7 @@ class H5_DLLCPP DataSpaceIException : public Exception {
virtual ~DataSpaceIException() throw();
};
-class H5_DLLCPP DataTypeIException : public Exception {
+class H5_DLLCPP DataTypeIException : public LocationException {
public:
DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
DataTypeIException();
@@ -126,14 +133,14 @@ class H5_DLLCPP PropListIException : public Exception {
virtual ~PropListIException() throw();
};
-class H5_DLLCPP DataSetIException : public Exception {
+class H5_DLLCPP DataSetIException : public LocationException {
public:
DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
DataSetIException();
virtual ~DataSetIException() throw();
};
-class H5_DLLCPP AttributeIException : public Exception {
+class H5_DLLCPP AttributeIException : public LocationException {
public:
AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
AttributeIException();
@@ -154,13 +161,6 @@ class H5_DLLCPP LibraryIException : public Exception {
virtual ~LibraryIException() throw();
};
-class H5_DLLCPP LocationException : public Exception {
- public:
- LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- LocationException();
- virtual ~LocationException() throw();
-};
-
class H5_DLLCPP IdComponentException : public Exception {
public:
IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 782831b..7b19c7e 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -634,23 +634,15 @@ void H5File::close()
//--------------------------------------------------------------------------
// Function: H5File::throwException
-///\brief Throws file exception - initially implemented for CommonFG
+///\brief Throws H5::FileIException.
///\param func_name - Name of the function where failure occurs
///\param msg - Message describing the failure
///\exception H5::FileIException
-// Description
-// This function is used in CommonFG implementation so that
-// proper exception can be thrown for file or group. The
-// argument func_name is a member of CommonFG and "H5File::"
-// will be inserted to indicate the function called is an
-// implementation of H5File.
-// Programmer Binh-Minh Ribler - 2000
+// December 2000
//--------------------------------------------------------------------------
void H5File::throwException(const H5std_string& func_name, const H5std_string& msg) const
{
- H5std_string full_name = func_name;
- full_name.insert(0, "H5File::");
- throw FileIException(full_name, msg);
+ throw FileIException(inMemFunc(func_name.c_str()), msg);
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index c3f390c..dd2dd48 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -165,7 +165,7 @@ void Group::p_setId(const hid_t new_id)
///\brief Closes this group.
///
///\exception H5::GroupIException
-// Programmer Binh-Minh Ribler - Mar 9, 2005
+// March 2005
//--------------------------------------------------------------------------
void Group::close()
{
@@ -187,19 +187,11 @@ void Group::close()
///\param func_name - Name of the function where failure occurs
///\param msg - Message describing the failure
///\exception H5::GroupIException
-// Description
-// This function is used in CommonFG implementation so that
-// proper exception can be thrown for file or group. The
-// argument func_name is a member of CommonFG and "Group::"
-// will be inserted to indicate the function called is an
-// implementation of Group.
-// Programmer Binh-Minh Ribler - 2000
+// December 2000
//--------------------------------------------------------------------------
void Group::throwException(const H5std_string& func_name, const H5std_string& msg) const
{
- H5std_string full_name = func_name;
- full_name.insert(0, "Group::");
- throw GroupIException(full_name, msg);
+ throw GroupIException(inMemFunc(func_name.c_str()), msg);
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index ef17b38..c54e901 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -299,11 +299,7 @@ IdComponent::IdComponent()
// Function: IdComponent::p_get_file_name (protected)
// Purpose: Gets the name of the file, in which this object belongs.
// Exception: H5::IdComponentException
-// Description:
-// This function is protected so that the user applications can
-// only have access to its code via allowable classes, namely,
-// Attribute and H5Location subclasses.
-// Programmer Binh-Minh Ribler - Jul, 2004
+// July 2004
//--------------------------------------------------------------------------
H5std_string IdComponent::p_get_file_name() const
{
@@ -312,7 +308,7 @@ H5std_string IdComponent::p_get_file_name() const
// Preliminary call to H5Fget_name to get the length of the file name
ssize_t name_size = H5Fget_name(temp_id, NULL, 0);
- // If H5Aget_name returns a negative value, raise an exception,
+ // If H5Fget_name returns a negative value, raise an exception,
if(name_size < 0)
{
throw IdComponentException("", "H5Fget_name failed");
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index 9a45634..744a780 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -72,6 +72,10 @@ class H5_DLLCPP IdComponent {
// Gets the identifier of this object.
virtual hid_t getId () const = 0;
+ // For subclasses to throw appropriate exception, used in H5Location,
+ // H5CommonFG, and H5Object.
+ virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const {};
+
// Pure virtual function for there are various H5*close for the
// subclasses.
virtual void close() = 0;
diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp
index 1267286..d5e7a1c 100644
--- a/c++/src/H5LaccProp.cpp
+++ b/c++/src/H5LaccProp.cpp
@@ -116,7 +116,7 @@ void LinkAccPropList::setNumLinks(size_t nlinks) const
// Throw exception if H5Pset_nlinks returns failure
if (ret_value < 0)
{
- throw PropListIException("setNumLinks", "H5Pset_nlinks failed");
+ throw PropListIException("LinkAccPropList::setNumLinks", "H5Pset_nlinks failed");
}
}
@@ -134,7 +134,7 @@ size_t LinkAccPropList::getNumLinks() const
// Throw exception if H5Pget_nlinks returns failure
if (ret_value < 0)
{
- throw PropListIException("getNumLinks", "H5Pget_nlinks failed");
+ throw PropListIException("LinkAccPropList::getNumLinks", "H5Pget_nlinks failed");
}
return(nlinks);
}
diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h
index 39fe7b8..9e7802f 100644
--- a/c++/src/H5LaccProp.h
+++ b/c++/src/H5LaccProp.h
@@ -12,9 +12,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-// Class LinkAccPropList represents the HDF5 file access property list and
-// inherits from DataType.
-
#ifndef __H5LinkAccPropList_H
#define __H5LinkAccPropList_H
diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp
index b6d6bd6..1f17f88 100644
--- a/c++/src/H5LcreatProp.cpp
+++ b/c++/src/H5LcreatProp.cpp
@@ -39,7 +39,7 @@ LinkCreatPropList* LinkCreatPropList::DEFAULT_ = 0;
// If LinkCreatPropList::DEFAULT_ already points to an allocated
// object, throw a PropListIException. This scenario should not
// happen.
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
LinkCreatPropList* LinkCreatPropList::getConstant()
{
@@ -65,7 +65,7 @@ LinkCreatPropList* LinkCreatPropList::getConstant()
// Purpose: Deletes the constant object that LinkCreatPropList::DEFAULT_
// points to.
// exception H5::PropListIException
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
void LinkCreatPropList::deleteConstants()
{
@@ -83,7 +83,7 @@ const LinkCreatPropList& LinkCreatPropList::DEFAULT = *getConstant();
//--------------------------------------------------------------------------
// Function: Default Constructor
///\brief Creates a file access property list
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
LinkCreatPropList::LinkCreatPropList() : StrCreatPropList(H5P_LINK_CREATE) {}
@@ -91,7 +91,7 @@ LinkCreatPropList::LinkCreatPropList() : StrCreatPropList(H5P_LINK_CREATE) {}
// Function: LinkCreatPropList copy constructor
///\brief Copy constructor: same HDF5 object as \a original
///\param original - IN: LinkCreatPropList instance to copy
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : StrCreatPropList(original) {}
@@ -99,14 +99,14 @@ LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : StrCre
// Function: LinkCreatPropList overloaded constructor
///\brief Creates a file access property list using the id of an
/// existing one.
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : StrCreatPropList(plist_id) {}
//--------------------------------------------------------------------------
// Function: LinkCreatPropList destructor
///\brief Noop destructor
-// May, 2018
+// May 2018
//--------------------------------------------------------------------------
LinkCreatPropList::~LinkCreatPropList() {}
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 319fa9e..43ba34c 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -388,7 +388,7 @@ int H5Location::getNumAttrs() const
H5O_info_t objinfo; /* Object info */
if(H5Oget_info(getId(), &objinfo) < 0)
- throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
+ throwException("getNumAttrs", "H5Oget_info failed");
else
return(static_cast<int>(objinfo.num_attrs));
}
@@ -398,8 +398,13 @@ int H5Location::getNumAttrs() const
///\brief Checks if a link of a given name exists in a location.
///\param name - IN: Searched name - \c char*
///\param lapl - IN: Link access property list
-///\exception H5::LocationException
-// Nov, 2016
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// Nov 2016
//--------------------------------------------------------------------------
bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
{
@@ -410,7 +415,7 @@ bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
return false;
else // Raise exception when H5Lexists returns a negative value
{
- throw LocationException(inMemFunc("nameExists"), "H5Lexists failed");
+ throwException("nameExists", "H5Lexists failed");
}
}
@@ -435,10 +440,15 @@ bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lap
/// which can be either of these values:
/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file
/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file
-///\exception H5::LocationException
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
///\par Description
/// This location is used to identify the file to be flushed.
-// Programmer Binh-Minh Ribler - 2012
+// December 2005
// Modification
// Sep 2012 - BMR
// Moved from H5File/H5Object
@@ -448,7 +458,7 @@ void H5Location::flush(H5F_scope_t scope) const
herr_t ret_value = H5Fflush(getId(), scope);
if(ret_value < 0)
{
- throw LocationException(inMemFunc("flush"), "H5Fflush failed");
+ throwException("flush", "H5Fflush failed");
}
}
@@ -456,16 +466,21 @@ void H5Location::flush(H5F_scope_t scope) const
// Function: H5Location::getFileName
///\brief Gets the name of the file, in which this HDF5 object belongs.
///\return File name
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Jul, 2004
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// July 2004
//--------------------------------------------------------------------------
H5std_string H5Location::getFileName() const
{
try {
return(p_get_file_name());
}
- catch (LocationException& E) {
- throw FileIException(inMemFunc("getFileName"), E.getDetailMsg());
+ catch (IdComponentException& E) {
+ throwException("getFileName", E.getDetailMsg());
}
}
@@ -473,15 +488,20 @@ H5std_string H5Location::getFileName() const
// Function: H5Location::getObjectInfo
///\brief Retrieve information about an object, specified by location.
///
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Aug, 2017
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// August 2017
//--------------------------------------------------------------------------
void H5Location::getObjectInfo(H5O_info_t *objinfo) const
{
herr_t ret_value = H5Oget_info(getId(), objinfo);
if (ret_value < 0)
{
- throw LocationException(inMemFunc("getObjectInfo"), "H5Oget_info failed");
+ throwException("getObjectInfo", "H5Oget_info failed");
}
}
@@ -489,8 +509,13 @@ void H5Location::getObjectInfo(H5O_info_t *objinfo) const
// Function: H5Location::getObjectInfo
///\brief Retrieve information about an object, specified by name.
///
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Aug, 2017
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// August 2017
//--------------------------------------------------------------------------
void H5Location::getObjectInfo(const char *name, H5O_info_t *objinfo,
const LinkAccPropList& lapl) const
@@ -498,7 +523,7 @@ void H5Location::getObjectInfo(const char *name, H5O_info_t *objinfo,
herr_t ret_value = H5Oget_info_by_name(getId(), name, objinfo, lapl.getId());
if (ret_value < 0)
{
- throw LocationException(inMemFunc("getObjectInfo"), "H5Oget_info_by_name failed");
+ throwException("getObjectInfo", "H5Oget_info_by_name failed");
}
}
@@ -506,8 +531,13 @@ void H5Location::getObjectInfo(const char *name, H5O_info_t *objinfo,
// Function: H5Location::getObjectInfo
///\brief Retrieve information about an object, specified by name.
///
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Aug, 2017
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// August 2017
//--------------------------------------------------------------------------
void H5Location::getObjectInfo(const H5std_string& name, H5O_info_t *objinfo,
const LinkAccPropList& lapl) const
@@ -515,7 +545,7 @@ void H5Location::getObjectInfo(const H5std_string& name, H5O_info_t *objinfo,
herr_t ret_value = H5Oget_info_by_name(getId(), name.c_str(), objinfo, lapl.getId());
if (ret_value < 0)
{
- throw LocationException(inMemFunc("getObjectInfo"), "H5Oget_info_by_name failed");
+ throwException("getObjectInfo", "H5Oget_info_by_name failed");
}
}
@@ -525,14 +555,16 @@ void H5Location::getObjectInfo(const H5std_string& name, H5O_info_t *objinfo,
///\return Object version, which can have the following values:
/// \li \c H5O_VERSION_1
/// \li \c H5O_VERSION_2
-///\exception H5::LocationException
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
/// Exception will be thrown when:
/// - an error returned by the C API
/// - version number is not one of the valid values above
-// Programmer Binh-Minh Ribler - May, 2017
-// Developer's Note
-// Maybe, this should be moved to H5Object because H5Oget_info is
-// supposed to take an object ID, so it shouldn't be a location.
+// August 2017
//--------------------------------------------------------------------------
unsigned H5Location::objVersion() const
{
@@ -544,13 +576,13 @@ unsigned H5Location::objVersion() const
// Throw exception if C API returns failure
if (ret_value < 0)
- throw LocationException(inMemFunc("objVersion"), "H5Oget_info failed");
+ throwException("objVersion", "H5Oget_info failed");
// Return a valid version or throw an exception for invalid value
else
{
version = objinfo.hdr.version;
if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
- throw LocationException(inMemFunc("objVersion"), "Invalid version for object");
+ throwException("objVersion", "Invalid version for object");
}
return(version);
}
@@ -560,7 +592,12 @@ unsigned H5Location::objVersion() const
///\brief Sets or resets the comment for an object specified by its name.
///\param name - IN: Name of the object
///\param comment - IN: New comment
-///\exception H5::LocationException
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
///\par Description
/// If \a comment is an empty string or a null pointer, the comment
/// message is removed from the object.
@@ -568,18 +605,15 @@ unsigned H5Location::objVersion() const
/// strings. They can be attached to any object that has an
/// object header, e.g., data sets, groups, named data types,
/// and data spaces, but not symbolic links.
-// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
+// July 2004
// Modification
-// 2007: QAK modified to use H5O APIs; however the first parameter is
-// no longer just file or group, this function should be moved
-// to another class to accommodate attribute, dataset, and named
-// datatype. - BMR
+// Moved from CommonFG, Sep 2013
//--------------------------------------------------------------------------
void H5Location::setComment(const char* name, const char* comment) const
{
herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT);
if(ret_value < 0)
- throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed");
+ throwException("setComment", "H5Oset_comment_by_name failed");
}
//--------------------------------------------------------------------------
@@ -587,7 +621,9 @@ void H5Location::setComment(const char* name, const char* comment) const
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
/// \c H5std_string for \a name and \a comment.
-// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
+// July 2004
+// Modification
+// Moved from CommonFG, Sep 2013
//--------------------------------------------------------------------------
void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const
{
@@ -599,14 +635,19 @@ void H5Location::setComment(const H5std_string& name, const H5std_string& commen
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it doesn't take
/// an object name.
-// Programmer Binh-Minh Ribler - Sep 2013
-// Modification
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// Sep 2013
//--------------------------------------------------------------------------
void H5Location::setComment(const char* comment) const
{
herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT);
if(ret_value < 0)
- throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed");
+ throwException("setComment", "H5Oset_comment_by_name failed");
}
//--------------------------------------------------------------------------
@@ -614,7 +655,7 @@ void H5Location::setComment(const char* comment) const
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
/// \c H5std_string for \a comment.
-// Programmer Binh-Minh Ribler - Sep 2013
+// Sep 2013
//--------------------------------------------------------------------------
void H5Location::setComment(const H5std_string& comment) const
{
@@ -625,18 +666,21 @@ void H5Location::setComment(const H5std_string& comment) const
// Function: H5Location::removeComment
///\brief Removes the comment from an object specified by its name.
///\param name - IN: Name of the object
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013)
-// 2007: QAK modified to use H5O APIs; however the first parameter is
-// no longer just file or group, this function should be moved
-// to another class to accommodate attribute, dataset, and named
-// datatype. - BMR
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// July 2004
+// Modification
+// Moved from CommonFG, Sep 2013
//--------------------------------------------------------------------------
void H5Location::removeComment(const char* name) const
{
herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT);
if(ret_value < 0)
- throw LocationException(inMemFunc("removeComment"), "H5Oset_comment_by_name failed");
+ throwException("removeComment", "H5Oset_comment_by_name failed");
}
//--------------------------------------------------------------------------
@@ -644,11 +688,13 @@ void H5Location::removeComment(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 H5std_string for \a name.
-// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013)
+// July 2004
+// Modification
+// Moved from CommonFG, Sep 2013
//--------------------------------------------------------------------------
void H5Location::removeComment(const H5std_string& name) const
{
- removeComment (name.c_str());
+ removeComment(name.c_str());
}
//--------------------------------------------------------------------------
@@ -658,13 +704,18 @@ void H5Location::removeComment(const H5std_string& name) const
///\param buf_size - IN: Length of the comment to retrieve
///\param comment - OUT: Retrieved comment
///\return Actual length of the comment
-///\exception H5::LocationException
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
///\par Description
/// This function retrieves \a buf_size characters of the comment
/// including the null terminator. Thus, if the actual length
/// of the comment is more than buf_size-1, the retrieved comment
/// will be truncated to accommodate the null terminator.
-// Programmer Binh-Minh Ribler - Mar 2014
+// March 2014
//--------------------------------------------------------------------------
ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment) const
{
@@ -676,7 +727,7 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment)
// If H5Oget_comment_by_name returns a negative value, raise an exception
if (comment_len < 0)
{
- throw LocationException(inMemFunc("getComment"), "H5Oget_comment_by_name failed");
+ throwException("getComment", "H5Oget_comment_by_name failed");
}
// If the comment is longer than the provided buffer size, the C library
// will not null terminate it
@@ -694,8 +745,15 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment)
///\param name - IN: Name of the object
///\param buf_size - IN: Length of the comment to retrieve, default to 0
///\return Comment string
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// July 2004
+// Modification
+// Moved from CommonFG, Sep 2013
//--------------------------------------------------------------------------
H5std_string H5Location::getComment(const char* name, size_t buf_size) const
{
@@ -709,7 +767,7 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
// If H5Oget_comment_by_name returns a negative value, raise an exception
if (comment_len < 0)
{
- throw LocationException(inMemFunc("getComment"), "H5Oget_comment_by_name failed");
+ throwException("getComment", "H5Oget_comment_by_name failed");
}
// If comment exists, calls C routine again to get it
@@ -730,7 +788,7 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
if (temp_len < 0)
{
delete []comment_C;
- throw LocationException(inMemFunc("getComment"), "H5Oget_comment_by_name failed");
+ throwException("getComment", "H5Oget_comment_by_name failed");
}
// Convert the C comment to return
@@ -749,7 +807,9 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
+// July 2004
+// Modification
+// Moved from CommonFG, Sep 2013
//--------------------------------------------------------------------------
H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) const
{
@@ -760,21 +820,25 @@ H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) c
// Function: H5Location::openObjId
///\brief Opens an object without knowing the object type.
///\param obj_name - IN: Path to the object
-///\param lapl - IN: Access property list for the link pointing
-/// to the object
-///\exception H5::LocationException
+///\param lapl - IN: Access plist for the link pointing to the object
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
///\par Description
/// This function opens an object at this location, using
/// H5Oopen. Thus, an object can be opened without knowing
-/// the object's type.
-// Programmer Binh-Minh Ribler - May, 2017
+/// its type.
+// May 2017
//--------------------------------------------------------------------------
hid_t H5Location::openObjId(const char* obj_name, const LinkAccPropList& lapl) const
{
hid_t ret_value = H5Oopen(getId(), obj_name, lapl.getId());
if (ret_value < 0)
{
- throw LocationException(inMemFunc("openObjId"), "H5Oopen failed");
+ throwException("openObjId", "H5Oopen failed");
}
return(ret_value);
}
@@ -787,7 +851,7 @@ hid_t H5Location::openObjId(const char* obj_name, const LinkAccPropList& lapl) c
///\param lapl - IN: Access property list for the link pointing to
/// the object
///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - May, 2017
+// May 2017
//--------------------------------------------------------------------------
hid_t H5Location::openObjId(const H5std_string& obj_name, const LinkAccPropList& lapl) const
{
@@ -799,14 +863,14 @@ hid_t H5Location::openObjId(const H5std_string& obj_name, const LinkAccPropList&
///\brief Closes an object, which was opened with H5Location::openObjId
///
///\exception H5::LocationException
-// May, 2017
+// May 2017
//--------------------------------------------------------------------------
void H5Location::closeObjId(hid_t obj_id)
{
herr_t ret_value = H5Oclose(obj_id);
if (ret_value < 0)
{
- throw Exception("closeObjId", "H5Oclose failed");
+ throw LocationException("closeObjId", "H5Oclose failed");
}
}
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 8fe8e56..4697d9c 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -11,6 +11,12 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef OLD_HEADER_FILENAME
+#include <iostream.h>
+#else
+#include <iostream>
+#endif
+
#include <string>
#include "H5private.h" // for HDmemset
@@ -28,6 +34,11 @@
namespace H5 {
+#ifndef H5_NO_STD
+ using std::cerr;
+ using std::endl;
+#endif // H5_NO_STD
+
#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
@@ -299,10 +310,10 @@ void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newna
//--------------------------------------------------------------------------
int H5Object::getNumAttrs() const
{
- H5O_info_t oinfo; /* Object info */
+ H5O_info_t oinfo; /* Object info */
if(H5Oget_info(getId(), &oinfo) < 0)
- throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
+ throwException("getNumAttrs", "H5Oget_info failed");
else
return(static_cast<int>(oinfo.num_attrs));
}
@@ -321,11 +332,11 @@ ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const
// If H5Iget_name returns a negative value, raise an exception
if (name_size < 0)
{
- throw Exception(inMemFunc("getObjName"), "H5Iget_name failed");
+ throwException("getObjName", "H5Iget_name failed");
}
else if (name_size == 0)
{
- throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0");
+ throwException("getObjName", "Object must have a name, but name length is 0");
}
// Return length of the name
return(name_size);
@@ -337,7 +348,6 @@ ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const
///\return Name of the object
///\exception H5::Exception
// Programmer Binh-Minh Ribler - Mar, 2014
-// Modification
//--------------------------------------------------------------------------
H5std_string H5Object::getObjName() const
{
@@ -349,11 +359,11 @@ H5std_string H5Object::getObjName() const
// If H5Iget_name failed, throw exception
if (name_size < 0)
{
- throw Exception(inMemFunc("getObjName"), "H5Iget_name failed");
+ throwException("getObjName", "H5Iget_name failed");
}
else if (name_size == 0)
{
- throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0");
+ throwException("getObjName", "Object must have a name, but name length is 0");
}
// Object's name exists, retrieve it
else if (name_size > 0)
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index afeea7d..4d40415 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -48,6 +48,9 @@ class H5_DLLCPP H5Object : public H5Location {
// Given its index, opens the attribute that belongs to this object.
Attribute openAttribute(const unsigned int idx) const;
+ // Determines the number of attributes belong to this object.
+ int getNumAttrs() const;
+
// Checks whether the named attribute exists for this object.
bool attrExists(const char* name) const;
bool attrExists(const H5std_string& name) const;
@@ -60,9 +63,6 @@ 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;
diff --git a/c++/src/H5StrcreatProp.cpp b/c++/src/H5StrcreatProp.cpp
index 6237e2b..79749d8 100644
--- a/c++/src/H5StrcreatProp.cpp
+++ b/c++/src/H5StrcreatProp.cpp
@@ -25,7 +25,7 @@ namespace H5 {
// Function: StrCreatPropList::setCharEncoding
///\brief Sets the character encoding of the string.
///\exception H5::PropListIException
-// March, 2018
+// March 2018
//--------------------------------------------------------------------------
void StrCreatPropList::setCharEncoding(H5T_cset_t encoding) const
{
@@ -33,7 +33,7 @@ void StrCreatPropList::setCharEncoding(H5T_cset_t encoding) const
// Throw exception if H5Pset_char_encoding returns failure
if (ret_value < 0)
{
- throw PropListIException("setCharEncoding", "H5Pset_char_encoding failed");
+ throw PropListIException("StrCreatPropList::setCharEncoding", "H5Pset_char_encoding failed");
}
}
@@ -41,7 +41,7 @@ void StrCreatPropList::setCharEncoding(H5T_cset_t encoding) const
// Function: StrCreatPropList::getCharEncoding
///\brief Gets the character encoding of the string.
///\exception H5::PropListIException
-// March, 2018
+// March 2018
//--------------------------------------------------------------------------
H5T_cset_t StrCreatPropList::getCharEncoding() const
{
@@ -50,7 +50,7 @@ H5T_cset_t StrCreatPropList::getCharEncoding() const
// Throw exception if H5Pget_char_encoding returns failure
if (ret_value < 0)
{
- throw PropListIException("getCharEncoding", "H5Pget_char_encoding failed");
+ throw PropListIException("StrCreatPropList::getCharEncoding", "H5Pget_char_encoding failed");
}
return(encoding);
}