#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "Group.h5" );
const int RANK = 2;
extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo,
void *opdata);
int main(void)
{
hsize_t dims[2];
hsize_t cdims[2];
try
{
dims[0] = 1000;
dims[1] = 20;
cdims[0] = 20;
cdims[1] = 20;
*dataspace, ds_creatplist ));
delete dataset;
delete dataspace;
dims[0] = 500;
dims[1] = 20;
delete dataset;
delete dataspace;
delete group;
delete file;
file =
new H5File(FILE_NAME, H5F_ACC_RDWR);
try {
}
cout << " Dataset is not found." << endl;
}
cout << "dataset \"/Data/Compressed_Data\" is open" << endl;
delete dataset;
file->
link( H5L_TYPE_HARD,
"Data",
"Data_new" );
try {
}
{
cout << " Dataset is not found." << endl;
}
cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl;
delete dataset;
cout << endl << "Iterating over elements in the file" << endl;
herr_t idx = H5Literate(file->
getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL);
cout << endl;
cout << "Unlinking..." << endl;
try {
}
{
cout << " unlink failed." << endl;
}
cout << "\"Data\" is unlinked" << endl;
cout << endl << "Iterating over elements in the file again" << endl;
idx = H5Literate(file->
getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL);
cout << endl;
delete group;
delete file;
}
{
return -1;
}
{
return -1;
}
{
return -1;
}
{
return -1;
}
return 0;
}
herr_t
file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata)
{
hid_t group;
group = H5Gopen2(loc_id, name, H5P_DEFAULT);
cout << "Name : " << name << endl;
H5Gclose(group);
return 0;
}