Logo Search packages:      
Sourcecode: jhdf version File versions  Download package

abstract void ncsa::hdf::object::Dataset::init (  )  [pure virtual, inherited]

Retrieves datatype and dataspace information from file and sets the dataset in memory.

The init() is designed to support lazy operation in dataset object. When a data object is retrieved from file, the datatype, dataspace and raw data are not loaded into memory. When it is asked to read the raw data from file, init() is first called to get the datatype and dataspace information, then load the raw data from file.

init() is also used to reset selection of a dataset (start, stride and count) to the default, which is the entire dataset for 1D or 2D datasets. In the following example, init() at step 1) retrieve datatype and dataspace information from file. getData() at step 3) read only one data point. init() at step 4) reset the selection to the whole dataset. getData() at step 4) reads the values of whole dataset into memory.

            dset = (Dataset)file.get(NAME_DATASET);

1) get datatype and dataspace information from file
            rank = dset.getRank(); // rank = 2, a 2D dataset
            count = dset.getSelectedDims();
            start = dset.getStartDims();
            dims = dset.getDims();

2) select only one data point
            for (int i=0; i<rank; i++) {
                start[0] = 0;
                count[i] = 1;

3)  read one data point
            data = dset.getData();

4)  reset to select the whole dataset

5) clean the memory data buffer

6) Read the whole dataset
            data = dset.getData();

Implemented in ncsa::hdf::object::fits::FitsDataset, ncsa::hdf::object::h4::H4GRImage, ncsa::hdf::object::h4::H4SDS, ncsa::hdf::object::h4::H4Vdata, ncsa::hdf::object::h5::H5CompoundDS, ncsa::hdf::object::h5::H5ScalarDS, and ncsa::hdf::object::nc2::NC2Dataset.

Referenced by ncsa::hdf::view::DefaultMetaDataView::createDatasetInfoPanel(), ncsa::hdf::view::DefaultTableView::createTable(), ncsa::hdf::view::DataOptionDialog::DataOptionDialog(), ncsa::hdf::view::DefaultImageView::getImage(), ncsa::hdf::view::DefaultTreeView::showDataContent(), test::object::TestH5Object::test_H5CompoundDS_init(), test::object::TestH5Object::test_H5CompoundDS_write_row_by_row(), test::object::TestH5Object::test_H5File_createScalarDS(), test::unittests::H5BugFixTest::testBug863(), and test::unittests::H5ScalarDSTest::testCopy().

Generated by  Doxygen 1.6.0   Back to index