diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-03-14 03:53:43 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-03-14 03:53:43 (GMT) |
commit | a48c9c4024e7ede0021e1a9d8c1d4c197333e0d0 (patch) | |
tree | 4f69e727c624eafc5c1a812e24cc27b71175d69f /c++/test/dsets.cpp | |
parent | 56e5b4ed05fb3bad51c226ec5b567871a45e0bce (diff) | |
download | hdf5-a48c9c4024e7ede0021e1a9d8c1d4c197333e0d0.zip hdf5-a48c9c4024e7ede0021e1a9d8c1d4c197333e0d0.tar.gz hdf5-a48c9c4024e7ede0021e1a9d8c1d4c197333e0d0.tar.bz2 |
Purpose: Add new C++ wrappers
Description:
Added wrappers for H5Iis_valid, H5Ps/get_nlinks, H5Tget_create_plist,
H5Oopen, H5Oclose and H5Pset_virtual
// Checks if the given ID is valid.
static bool isValid(hid_t an_id);
// Sets the number of soft or user-defined links that can be
// traversed before a failure occurs.
void setNumLinks(size_t nlinks) const;
// Gets the number of soft or user-defined link traversals allowed
size_t getNumLinks() const;
// Returns a copy of the creation property list of a datatype.
PropList getCreatePlist() const;
// Opens an object within a group or a file, i.e., root group.
hid_t getObjId(const char* name,...);
hid_t getObjId(const H5std_string& name,...);
// Closes an object opened by getObjId().
void closeObjId(hid_t obj_id) const;
// Maps elements of a virtual dataset to elements of the source dataset.
void setVirtual(const DataSpace& vspace, const char *src_fname,...);
void setVirtual(const DataSpace& vspace, const H5std_string src_fname,...);
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (platypus)
Darwin (osx1010test)
Diffstat (limited to 'c++/test/dsets.cpp')
-rw-r--r-- | c++/test/dsets.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 48a0c4d..970f210 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1148,6 +1148,87 @@ test_types(H5File& file) /*------------------------------------------------------------------------- + * Function: test_virtual + * + * Purpose: Tests fixed, unlimited, and printf selections in the same + * VDS + * + * Return: Success: 0 + * + * Failure: number of errors + * + * Programmer: Binh-Minh Ribler + * Friday, March 10, 2017 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +const int RANK = 2; +static herr_t +test_virtual() +{ + SUBTEST("DSetCreatPropList::setVirtual"); + + try { + // Create DCPLs + DSetCreatPropList dcpl; + DSetCreatPropList srcdcpl; + + // Set fill value + char *fill = NULL; + dcpl.setFillValue(PredType::NATIVE_INT, &fill); + + // Set chunk dimensions + hsize_t cdims[RANK]; + cdims[0] = 2; + cdims[1] = 2; + srcdcpl.setChunk(RANK, cdims); + + // Create memory space + hsize_t mdims[RANK]; + mdims[0] = 10; + mdims[1] = 10; + DataSpace memspace(RANK, mdims); + + // Get the current layout, should be default, H5D_CONTIGUOUS + H5D_layout_t layout = dcpl.getLayout(); + verify_val(layout, H5D_CONTIGUOUS, "DSetCreatPropList::getLayout", __LINE__, __FILE__); + + // Create fixed mapping + hsize_t dims[RANK]; + dims[0] = 6; + dims[1] = 6; + DataSpace vspace(RANK, dims, mdims); + + hsize_t start[RANK]; // Hyperslab start + hsize_t count[RANK]; // Hyperslab count + start[0] = start[1] = 3; + count[0] = count[1] = 3; + vspace.selectHyperslab(H5S_SELECT_SET, count, start); + + DataSpace srcspace(RANK, count); + + H5std_string src_file = "src_file_map.h5"; + H5std_string src_dset = "src_dset_fixed"; + dcpl.setVirtual(vspace, src_file, src_dset, srcspace); + + // Get and verify the new layout + layout = dcpl.getLayout(); + verify_val(layout, H5D_VIRTUAL, "DSetCreatPropList::getLayout", __LINE__, __FILE__); + + PASSED(); + return 0; + } // end top try block + + catch (Exception& E) + { + return -1; + } +} // test_virtual + + +/*------------------------------------------------------------------------- * Function: test_dset * * Purpose Tests the dataset interface (H5D) @@ -1195,6 +1276,7 @@ void test_dset() nerrors += test_nbit_compression(file) < 0 ? 1:0; nerrors += test_multiopen (file) < 0 ? 1:0; nerrors += test_types(file) < 0 ? 1:0; + nerrors += test_virtual() < 0 ? 1:0; // Close group "emit diagnostics". grp.close(); |