Пример #1
0
int main(){
  hid_t fprop;
  hid_t fid;
  hid_t vol_id = H5VL_memvol_init();
  herr_t status;

  hid_t g1, g2;
  hid_t plist;

  char name[1024];

  fprop = H5Pcreate(H5P_FILE_ACCESS);
  H5Pset_vol(fprop, vol_id, &fprop);

  fid = H5Fcreate("test", H5F_ACC_TRUNC, H5P_DEFAULT, fprop);
  H5VLget_plugin_name(fid, name, 1024);
  printf ("Using VOL %s\n", name);

  g1 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
  H5Gclose(g1);

  g2 = H5Gcreate2(fid, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
  g1 = H5Gcreate2(g2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
  H5Gclose(g1);
  H5Gclose(g2);

  // is this allowed?
  //g3 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
  //H5Gclose(g3);

  printf("Testing additional functions\n");
  g1 = H5Gopen2(fid, "g1", H5P_DEFAULT );
  plist = H5Gget_create_plist(g1);
  H5G_info_t group_info;
  H5Gget_info(g1, & group_info );

  H5Gget_info_by_idx(fid, "g1",  H5_INDEX_CRT_ORDER,  H5_ITER_NATIVE, 0, & group_info, H5P_DEFAULT ) ;
  H5Gget_info_by_idx(fid, "g1",  H5_INDEX_NAME,  H5_ITER_NATIVE, 0, & group_info, H5P_DEFAULT ) ;
  H5Gget_info_by_name(fid, "g1", & group_info, H5P_DEFAULT);
  H5Pclose(plist);

  status = H5Gclose(g1);
  g1 = H5Gopen2(fid, "g2", H5P_DEFAULT );
  H5Gclose(g1);
  //g1 = H5Gopen2(fid, "INVALID", H5P_DEFAULT );
  //H5Gclose(g1);

  g1 =  H5Gcreate_anon( fid, H5P_DEFAULT, H5P_DEFAULT );
  H5Gclose(g1);

  H5Fclose(fid);
  H5VL_memvol_finalize();


  printf("Status: %d\n", status);

  return 0;
}
Пример #2
0
/*
 * Class:     hdf_hdf5lib_H5
 * Method:    H5Gget_info_by_idx
 * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5G_info_t;
 */
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
    (JNIEnv *env, jclass cls, jlong loc_id, jstring name, jint index_type,
          jint order, jlong n, jlong lapl_id)
{
    herr_t          ret_val = -1;
    const char     *gName;
    H5G_info_t      group_info;
    H5_index_t      cindex_type = (H5_index_t)index_type;
    H5_iter_order_t corder = (H5_iter_order_t)order;

    PIN_JAVA_STRING(name, gName, NULL);

    ret_val = H5Gget_info_by_idx((hid_t)loc_id, gName, cindex_type,
            corder, (hsize_t)n, &group_info, (hid_t)lapl_id);

    UNPIN_JAVA_STRING(name, gName);

    if (ret_val < 0) {
        h5libraryError(env);
        return NULL;
    } /* end if */

    return create_H5G_info_t(env, group_info);
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx */