Merge pull request #1141 in HDFFV/hdf5 from ~BMRIBLER/hdf5_bmr_cpp4:develop to develop

Fixed HDFFV-10472 and replaced the C2Cpp function mapping table with a more supported format.

* commit 'dd0a040ec807912b80a9f1779fbf46c65d01cd57':
  Fixed EED-319 Description:     - Fixed doc issue       Added an html version for the C++ function mapping table and removed       the single web page version.       Updated cpp_doc_config to use the html file.     - Added a couple more minor tests
  Fixed HDFFV-10472 Description:     Added operator!= to DataType         bool operator!=(const DataType& compared_type) Platforms tested:     Linux/64 (jelly)     Linux/32 (jam)     Darwin (osx1010test)
This commit is contained in:
Binh-Minh Ribler 2018-07-19 15:41:46 -05:00
commit 32d5a3be1c
7 changed files with 24377 additions and 35295 deletions

24268
c++/src/C2Cppfunction_map.htm Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@
Datatype Interface (H5T) DataType and subclasses
\endverbatim
*
* This <a href="./C2Cppfunction_map.mht">
* This <a href="./C2Cppfunction_map.htm">
* table </a> provides a map from the C APIs to the C++ member functions.
* <br />
* \section install_sec Installation

View File

@ -395,6 +395,20 @@ bool DataType::operator==(const DataType& compared_type) const
}
}
//--------------------------------------------------------------------------
// Function: DataType::operator!=
///\brief Compares this DataType against the given one to determines
/// whether the two objects refer to different actual datatypes.
///\param compared_type - IN: Reference to the datatype to compare
///\return true if the datatypes are not equal, and false, otherwise.
///\exception H5::DataTypeIException
// July, 2018
//--------------------------------------------------------------------------
bool DataType::operator!=(const DataType& compared_type) const
{
return !operator==(compared_type);
}
//--------------------------------------------------------------------------
// Function: DataType::p_commit (private)
//\brief Commits a transient datatype to a file, creating a new

View File

@ -90,6 +90,9 @@ class H5_DLLCPP DataType : public H5Object {
// Determines whether two datatypes are the same.
bool operator==(const DataType& compared_type) const;
// Determines whether two datatypes are not the same.
bool operator!=(const DataType& compared_type) const;
// Locks a datatype.
void lock() const;

View File

@ -1140,7 +1140,7 @@ HTML_EXTRA_STYLESHEET =
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_FILES = ./header_files/help.jpg \
./C2Cppfunction_map.mht
./C2Cppfunction_map.htm
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the stylesheet and background images according to

View File

@ -1024,6 +1024,95 @@ static void test_encode_decode()
}
}
/*-------------------------------------------------------------------------
* Function: test_operators
*
* Purpose Test datatype encode/decode functionality.
*
* Return None
*
* Programmer Binh-Minh Ribler (using C version)
* August, 2017
*-------------------------------------------------------------------------
*/
const H5std_string filename4("h5_type_operators.h5");
static void test_operators()
{
short enum_val;
SUBTEST("DataType::operator== and DataType::operator!=");
try {
// Create the file.
H5File file(filename4, H5F_ACC_TRUNC);
//
// Test with CompType
//
// Create a compound datatype
CompType cmptyp(sizeof(src_typ_t));
cmptyp.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
cmptyp.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_FLOAT);
cmptyp.insertMember("c", HOFFSET(src_typ_t, c), PredType::NATIVE_LONG);
cmptyp.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_DOUBLE);
// Copy this compound datatype
CompType clone_cmptyp(cmptyp);
// Verify that operator== and operator!= work properly
verify_val(cmptyp == clone_cmptyp, true, "DataType::operator==", __LINE__, __FILE__);
verify_val(cmptyp != clone_cmptyp, false, "DataType::operator!=", __LINE__, __FILE__);
//
// Test with EnumType
//
// Create an enumerate datatype
EnumType enumtyp(sizeof(short));
enumtyp.insert("RED", (enum_val=0,&enum_val));
enumtyp.insert("GREEN", (enum_val=1,&enum_val));
enumtyp.insert("BLUE", (enum_val=2,&enum_val));
// Verify that operator== and operator!= work properly
verify_val(cmptyp == enumtyp, false, "DataType::operator==", __LINE__, __FILE__);
verify_val(cmptyp != enumtyp, true, "DataType::operator!=", __LINE__, __FILE__);
//
// Test with compound datatype's member
//
// Create random atomic datatypes
IntType inttyp(PredType::NATIVE_INT);
FloatType flttyp(PredType::NATIVE_FLOAT);
// Get the NATIVE_INT member from the compound datatype above
IntType member_inttyp = cmptyp.getMemberIntType(0);
// Test various combinations
verify_val(inttyp == member_inttyp, true, "DataType::operator==", __LINE__, __FILE__);
verify_val(flttyp == member_inttyp, false, "DataType::operator==", __LINE__, __FILE__);
verify_val(flttyp != member_inttyp, true, "DataType::operator==", __LINE__, __FILE__);
// Get the NATIVE_LONG member from the compound datatype above
IntType member_longtyp = cmptyp.getMemberIntType(2);
// Test various combinations
verify_val(inttyp == member_longtyp, false, "DataType::operator==", __LINE__, __FILE__);
verify_val(flttyp == member_longtyp, false, "DataType::operator==", __LINE__, __FILE__);
verify_val(flttyp != member_longtyp, true, "DataType::operator==", __LINE__, __FILE__);
PASSED();
}
catch (Exception& E)
{
issue_fail_msg("test_operators", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_operators
/*-------------------------------------------------------------------------
* Function: test_types
@ -1048,6 +1137,7 @@ void test_types()
test_transient();
test_named();
test_encode_decode();
test_operators();
} // test_types()