mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-25 17:00:45 +08:00
[svn-r29803] 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) Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
This commit is contained in:
parent
cedc64c695
commit
75b926c96a
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user