summaryrefslogtreecommitdiffstats
path: root/src/H5Xpublic.h
blob: 9b9e4950acce70dd69c917dac0eeec2300ff608d (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the files COPYING and Copyright.html.  COPYING can be found at the root   *
 * of the source code distribution tree; Copyright.html can be found at the  *
 * root level of an installed copy of the electronic HDF5 document set and   *
 * is linked from the top-level documents page.  It can also be found at     *
 * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
 * access to either file, you may request a copy from help@hdfgroup.org.     *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
 * This file contains function prototypes for each exported function in the
 * H5X module.
 */
#ifndef _H5Xpublic_H
#define _H5Xpublic_H

/* Public headers needed by this file */
#include "H5public.h"
#include "H5Ipublic.h"

/*****************/
/* Public Macros */
/*****************/

#define H5X_CLASS_T_VERS (1)

/* Plugin IDs */
#define H5X_PLUGIN_ERROR    (-1) /* no plugin             */
#define H5X_PLUGIN_NONE     0    /* reserved indefinitely */
#define H5X_PLUGIN_DUMMY    1    /* dummy                 */
#define H5X_PLUGIN_FASTBIT  2    /* fastbit               */
#define H5X_PLUGIN_ALACRITY 3    /* alacrity              */

#define H5X_PLUGIN_RESERVED 64   /* plugin ids below this value reserved */

#define H5X_PLUGIN_MAX      256  /* maximum plugin id     */
#define H5X_MAX_NPLUGINS    16   /* Maximum number of plugins allowed in a pipeline */

/*******************/
/* Public Typedefs */
/*******************/

/* Index type */
typedef enum {
    H5X_TYPE_LINK_NAME,   /* Link name index */
    H5X_TYPE_ATTR_NAME,   /* Attribute name index */
    H5X_TYPE_DATA_ELEM,   /* Dataset element index */
    H5X_TYPE_MAP_VALUE    /* Map value index */
} H5X_type_t;

typedef struct {
    hid_t field_datatype_id;
    unsigned plugin_id;
} H5X_info_t;

typedef struct {
    unsigned version;     /* Version number of the index plugin class struct */
                          /* (Should always be set to H5X_CLASS_VERSION, which
                           *  may vary between releases of HDF5 library) */
    unsigned id;          /* Index ID (assigned by The HDF Group, for now) */
    const char *idx_name; /* Index name (for debugging only, currently) */
    H5X_type_t type;      /* Type of data indexed by this plugin */

    /* Callbacks, described above */
    void * (*create)(hid_t dataset_id, hid_t xcpl_id /* TODO pass datatype id */,
            hid_t xapl_id, size_t *metadata_size, void **metadata);
    herr_t (*remove)(hid_t file_id, size_t metadata_size, void *metadata);
    void *(*open)(hid_t dataset_id, hid_t xapl_id, size_t metadata_size,
            void *metadata);
    herr_t (*close)(void *idx_handle);
    herr_t (*pre_update)(void *idx_handle, hid_t dataspace_id, hid_t xxpl_id);
    herr_t (*post_update)(void *idx_handle, const void *buf, hid_t dataspace_id,
            hid_t xxpl_id);
    hid_t  (*query)(void *idx_handle, hid_t dataspace_id, hid_t query_id, hid_t xxpl_id);
    herr_t (*refresh)(void *idx_handle, size_t *metadata_size, void **metadata);
    herr_t (*copy)(hid_t src_file_id, hid_t dest_file_id, hid_t xcpl_id,
            hid_t xapl_id, size_t src_metadata_size, void *src_metadata,
            size_t *dest_metadata_size, void **dest_metadata);
    herr_t (*get_size)(void *idx_handle, hsize_t *idx_size);
} H5X_class_t;

/********************/
/* Public Variables */
/********************/

/*********************/
/* Public Prototypes */
/*********************/
#ifdef __cplusplus
extern "C" {
#endif

/* Function prototypes */
H5_DLL herr_t H5Xregister(const H5X_class_t *idx_class);
H5_DLL herr_t H5Xunregister(unsigned plugin_id);

H5_DLL herr_t H5Xcreate(hid_t scope_id, unsigned plugin_id, hid_t xcpl_id);
H5_DLL herr_t H5Xremove(hid_t scope_id, unsigned n /* Index n to be removed */);

H5_DLL herr_t H5Xget_count(hid_t scope_id, hsize_t *idx_count);
H5_DLL herr_t H5Xget_info(hid_t scope_id, unsigned n, H5X_info_t *info);

H5_DLL hsize_t H5Xget_size(hid_t scope_id);



/*
H5_DLL herr_t H5Xget_type(hid_t object_id, hsize_t index_idx,
        unsigned *plugin_id);
*/

#ifdef __cplusplus
}
#endif

#endif /* _H5Xpublic_H */