summaryrefslogtreecommitdiffstats
path: root/src/H5Zprivate.h
blob: 48620be38ce17d63ed946fa96a5a318fa22f1f14 (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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html.  If you do not have     *
 * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/* Programmer:  Robb Matzke <matzke@llnl.gov>
 *              Thursday, April 16, 1998
 */

#ifndef _H5Zprivate_H
#define _H5Zprivate_H

#include "H5private.h"          /* Generic Functions                    */
#include "H5Tprivate.h"
#include "H5Eprivate.h"
#include "H5Iprivate.h"
#include "H5Zpublic.h"

/* Structure to store information about each filter's parameters */
typedef struct {
    H5Z_filter_t	id;		/*filter identification number	     */
    unsigned		flags;		/*defn and invocation flags	     */
    char		*name;		/*optional filter name		     */
    size_t		cd_nelmts;	/*number of elements in cd_values[]  */
    unsigned		*cd_values;	/*client data values		     */
} H5Z_filter_info_t;


/* Token types */
typedef enum {
    ERROR,
    H5Z_INTEGER, /* this represents an integer type in the data transform expression */
    H5Z_FLOAT,  /* this represents a floating point type in the data transform expression */
    SYMBOL,
    PLUS,
    MINUS,
    MULT,
    DIVIDE,
    LPAREN,
    RPAREN,
    END
} H5Z_token_type;

typedef union {
    char   *sym_val;
    long    int_val;
    double  float_val;
} H5Z_num_val;


typedef struct H5Z_node {
    struct H5Z_node    *lchild;
    struct H5Z_node    *rchild;
    H5Z_token_type      type;
    H5Z_num_val         value;
} H5Z_node;

typedef struct {
    char*       xform_exp;
    H5Z_node*       parse_root;
} H5Z_data_xform;

/* Special parameters for szip compression */
/* [These are aliases for the similar definitions in szlib.h, which we can't
 * include directly due to the duplication of various symbols with the zlib.h
 * header file] */
#define H5_SZIP_LSB_OPTION_MASK         8
#define H5_SZIP_MSB_OPTION_MASK         16
#define H5_SZIP_RAW_OPTION_MASK         128

struct H5O_pline_t; /*forward decl*/

/* Internal API routines */
H5_DLL herr_t H5Z_register(const H5Z_class_t *cls);
H5_DLL herr_t H5Z_unregister(H5Z_filter_t id);
H5_DLL herr_t H5Z_append(struct H5O_pline_t *pline, H5Z_filter_t filter,
        unsigned flags, size_t cd_nelmts, const unsigned int cd_values[]);
H5_DLL herr_t H5Z_modify(const struct H5O_pline_t *pline, H5Z_filter_t filter,
        unsigned flags, size_t cd_nelmts, const unsigned int cd_values[]);
H5_DLL herr_t H5Z_pipeline(const struct H5O_pline_t *pline,
			    unsigned flags, unsigned *filter_mask/*in,out*/,
 			    H5Z_EDC_t edc_read, H5Z_cb_t cb_struct,
			    size_t *nbytes/*in,out*/, size_t *buf_size/*in,out*/, 
                            void **buf/*in,out*/);
H5_DLL H5Z_class_t *H5Z_find(H5Z_filter_t id);
H5_DLL herr_t H5Z_can_apply(hid_t dcpl_id, hid_t type_id);
H5_DLL herr_t H5Z_set_local(hid_t dcpl_id, hid_t type_id);
H5_DLL H5Z_filter_info_t *H5Z_filter_info(const struct H5O_pline_t *pline,
        H5Z_filter_t filter);
H5_DLL htri_t H5Z_all_filters_avail(const struct H5O_pline_t *pline);
H5_DLL herr_t H5Z_delete(struct H5O_pline_t *pline, H5Z_filter_t filter);

/* Data Transform Functions */
H5_DLL void H5Z_xform_destroy_parse_tree(H5Z_node *tree);
H5_DLL void H5Z_xform_eval(H5Z_node *tree, void* array, hsize_t array_size, hid_t array_type);
H5_DLL void* H5Z_xform_parse(const char *expression);
H5_DLL hid_t H5Z_xform_find_type(H5T_t* type);
H5_DLL void H5Z_xform_reduce_tree(H5Z_node* tree);
H5_DLL void* H5Z_xform_copy_tree(H5Z_node* tree);


#endif