1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use std::mem;

pub use self::H5G_storage_type_t::*;

use crate::internal_prelude::*;

use crate::h5l::{H5L_type_t, H5L_SAME_LOC, H5L_TYPE_ERROR, H5L_TYPE_HARD, H5L_TYPE_SOFT};

pub const H5G_SAME_LOC: hid_t = H5L_SAME_LOC;

pub const H5G_LINK_ERROR: H5L_type_t = H5L_TYPE_ERROR;
pub const H5G_LINK_HARD: H5L_type_t = H5L_TYPE_HARD;
pub const H5G_LINK_SOFT: H5L_type_t = H5L_TYPE_SOFT;

pub type H5G_link_t = H5L_type_t;

pub const H5G_NTYPES: c_uint = 256;
pub const H5G_NLIBTYPES: c_uint = 8;
pub const H5G_NUSERTYPES: c_uint = H5G_NTYPES - H5G_NLIBTYPES;

pub fn H5G_USERTYPE(X: c_uint) -> c_uint {
    8 + X
}

#[repr(C)]
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
pub enum H5G_storage_type_t {
    H5G_STORAGE_TYPE_UNKNOWN = -1,
    H5G_STORAGE_TYPE_SYMBOL_TABLE = 0,
    H5G_STORAGE_TYPE_COMPACT = 1,
    H5G_STORAGE_TYPE_DENSE = 2,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct H5G_info_t {
    pub storage_type: H5G_storage_type_t,
    pub nlinks: hsize_t,
    pub max_corder: int64_t,
    pub mounted: hbool_t,
}

impl Default for H5G_info_t {
    fn default() -> Self {
        unsafe { mem::zeroed() }
    }
}

extern "C" {
    pub fn H5Gcreate2(
        loc_id: hid_t, name: *const c_char, lcpl_id: hid_t, gcpl_id: hid_t, gapl_id: hid_t,
    ) -> hid_t;
    pub fn H5Gcreate_anon(loc_id: hid_t, gcpl_id: hid_t, gapl_id: hid_t) -> hid_t;
    pub fn H5Gopen2(loc_id: hid_t, name: *const c_char, gapl_id: hid_t) -> hid_t;
    pub fn H5Gget_create_plist(group_id: hid_t) -> hid_t;
    pub fn H5Gget_info(loc_id: hid_t, ginfo: *mut H5G_info_t) -> herr_t;
    pub fn H5Gget_info_by_name(
        loc_id: hid_t, name: *const c_char, ginfo: *mut H5G_info_t, lapl_id: hid_t,
    ) -> herr_t;
    pub fn H5Gget_info_by_idx(
        loc_id: hid_t, group_name: *const c_char, idx_type: H5_index_t, order: H5_iter_order_t,
        n: hsize_t, ginfo: *mut H5G_info_t, lapl_id: hid_t,
    ) -> herr_t;
    pub fn H5Gclose(group_id: hid_t) -> herr_t;
}

#[cfg(hdf5_1_10_0)]
extern "C" {
    pub fn H5Gflush(group_id: hid_t) -> herr_t;
    pub fn H5Grefresh(group_id: hid_t) -> herr_t;
}