diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-04-26 04:39:08 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-04-26 04:39:08 (GMT) |
commit | c599e0f6b442f4a155760e8170900bf2bca1f781 (patch) | |
tree | c313865a005934ba5334e14fa5304148b9ffa425 | |
parent | 261ec9bae41f59b4a78d93823e7f658b51a30939 (diff) | |
download | hdf5-c599e0f6b442f4a155760e8170900bf2bca1f781.zip hdf5-c599e0f6b442f4a155760e8170900bf2bca1f781.tar.gz hdf5-c599e0f6b442f4a155760e8170900bf2bca1f781.tar.bz2 |
[svn-r29804] Purpose: Code improvement
Description:
The constructor FL_PacketTable added in 1.10.0 did not have good
prototype; it didn't allow the property list to be default. Marked
it deprecated and added this one:
FL_PacketTable(hid_t fileID, const char* name, hid_t dtypeID,
hsize_t chunkSize = 0, hid_t plistID = H5P_DEFAULT);
Merged from trunk r29803.
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (platypus)
Darwin (osx1010test)
-rw-r--r-- | hl/c++/src/H5PacketTable.cpp | 17 | ||||
-rw-r--r-- | hl/c++/src/H5PacketTable.h | 10 | ||||
-rw-r--r-- | hl/c++/test/ptableTest.cpp | 17 |
3 files changed, 30 insertions, 14 deletions
diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp index b033790..c4d7bbf 100644 --- a/hl/c++/src/H5PacketTable.cpp +++ b/hl/c++/src/H5PacketTable.cpp @@ -172,9 +172,22 @@ * the property list to specify compression, the name of the packet table, * the ID of the datatype, and the size of a memory chunk used in chunking. */ - FL_PacketTable::FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize) + FL_PacketTable::FL_PacketTable(hid_t fileID, const char* name, hid_t dtypeID, hsize_t chunkSize, hid_t plistID) { - table_id = H5PTcreate(fileID, name, dtypeID, chunkSize, plist_id); + table_id = H5PTcreate(fileID, name, dtypeID, chunkSize, plistID); + } + + /* Constructor - deprecated + * Creates a packet table to store either fixed- or variable-length packets. + * Takes the ID of the file the packet table will be created in, the ID of + * the property list to specify compression, the name of the packet table, + * the ID of the datatype, and the size of a memory chunk used in chunking. + * Note: The above constructor has a better prototype, which allows default + * values to be used. This constructor was only released in 1.10.0. + */ + FL_PacketTable::FL_PacketTable(hid_t fileID, hid_t plistID, const char* name, hid_t dtypeID, hsize_t chunkSize) + { + table_id = H5PTcreate(fileID, name, dtypeID, chunkSize, plistID); } /* Constructor diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h index bdd669d..be0b130 100644 --- a/hl/c++/src/H5PacketTable.h +++ b/hl/c++/src/H5PacketTable.h @@ -139,17 +139,19 @@ public: * the property list to specify compression, the name of the packet table, * the ID of the datatype, and the size of a memory chunk used in chunking. */ - FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize); + FL_PacketTable(hid_t fileID, const char* name, hid_t dtypeID, hsize_t chunkSize = 0, hid_t plistID = H5P_DEFAULT); - /* Constructor + /* Constructors - deprecated * Creates a packet table in which to store fixed length packets. * Takes the ID of the file the packet table will be created in, the name of * the packet table, the ID of the datatype of the set, the size * of a memory chunk used in chunking, and the desired compression level * (0-9, or -1 for no compression). - * Note: this overload will be deprecated in favor of the constructor above. + * Note: these overloaded constructors will be deprecated in favor of the + * constructor above. */ - FL_PacketTable(hid_t fileID, char* name, hid_t dtypeID, hsize_t chunkSize, int compression = -1); + FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize); + FL_PacketTable(hid_t fileID, char* name, hid_t dtypeID, hsize_t chunkSize, int compression = 0); /* "Open" Constructor * Opens an existing fixed-length packet table. diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 18bf421..dd3d2ba 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -279,7 +279,7 @@ int TestCompress() dscreatplist.setDeflate(6); /* Create packet table with compression. */ - FL_PacketTable wrapper(fileID, dscreatplist.getId(), COMPRESS_PT, H5T_NATIVE_CHAR, 100); + FL_PacketTable wrapper(fileID, COMPRESS_PT, H5T_NATIVE_CHAR, 100, dscreatplist.getId()); /* Close the property list */ dscreatplist.close(); @@ -320,8 +320,9 @@ int TestGetPacket() int i; TESTING("GetPacket") - /* Create a dataset. Explicitly specify no compression */ - FL_PacketTable wrapper(fileID, H5P_DEFAULT, PT_TESTGETPT, H5T_NATIVE_INT, 1); + /* Create a dataset. Does not need to specify property list because + there is no compression. */ + FL_PacketTable wrapper(fileID, PT_TESTGETPT, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) goto error; @@ -358,7 +359,7 @@ int TestErrors() TESTING("error conditions") /* Create a dataset */ - FL_PacketTable wrapper(fileID, H5P_DEFAULT, PT_TESTERROR, H5T_NATIVE_INT, 1); + FL_PacketTable wrapper(fileID, PT_TESTERROR, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) goto error; @@ -480,7 +481,7 @@ int SystemTest() int e; } compoundType; - dtypeID1 = H5Tcreate( H5T_COMPOUND, sizeof(compoundType)); + dtypeID1 = H5Tcreate(H5T_COMPOUND, sizeof(compoundType)); H5Tinsert(dtypeID1, "abbey", HOFFSET( compoundType, a ), H5T_NATIVE_SHORT); H5Tinsert(dtypeID1, "bert", HOFFSET( compoundType, b ), H5T_NATIVE_SHORT); @@ -493,7 +494,7 @@ int SystemTest() compoundType g; } cType2; - dtypeID2 = H5Tcreate ( H5T_COMPOUND, sizeof(cType2)); + dtypeID2 = H5Tcreate(H5T_COMPOUND, sizeof(cType2)); H5Tinsert(dtypeID2, "f", HOFFSET( cType2, f ), H5T_NATIVE_CHAR); H5Tinsert(dtypeID2, "g", HOFFSET( cType2, g ), dtypeID1); @@ -505,8 +506,8 @@ int SystemTest() ct2[0].g.c = 0; ct2[0].g.e = 3000; - /* Create the packet table datasets. Make one of them compressed. */ - FL_PacketTable wrapper1(fileID, H5P_DEFAULT, PT_SYSTEMTST1, dtypeID1, 1); + /* Create the packet table datasets. One used a deprecated constructor */ + FL_PacketTable wrapper1(fileID, PT_SYSTEMTST1, dtypeID1, 1); FL_PacketTable wrapper2(fileID, H5P_DEFAULT, PT_SYSTEMTST2, dtypeID2, 1); if(! wrapper1.IsValid()) |