File: HDFConstants.java

package info (click to toggle)
nexus 4.4.3-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,876 kB
  • sloc: cpp: 34,928; ansic: 17,317; f90: 2,326; xml: 2,071; java: 1,953; fortran: 1,529; python: 766; makefile: 532; sh: 460; tcl: 173; lisp: 169
file content (312 lines) | stat: -rw-r--r-- 12,912 bytes parent folder | download | duplicates (6)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
/****************************************************************************
 * NCSA HDF                                                                 *
 * National Comptational Science Alliance                                   *
 * University of Illinois at Urbana-Champaign                               *
 * 605 E. Springfield, Champaign IL 61820                                   *
 *                                                                          *
 * For conditions of distribution and use, see the accompanying             *
 * hdf/COPYING file.                                                        *
 *                                                                          *
 ****************************************************************************/

package ncsa.hdf.hdflib;

/**
 *  <p>
 *  This interface defines the values of constants defined
 *  by the HDF 4.1 API.
 * <p>
 *  For details of the HDF libraries, see the HDF Documentation at:
 *     <a href="http://hdf.ncsa.uiuc.edu">http://hdf.ncsa.uiuc.edu</a>
 */
public class HDFConstants
{
    /** FAIL */
    public static final int FAIL = -1;

    // file access code definitions
    public static final int     DFACC_READ = 1;
    public static final int     DFACC_WRITE= 2;
    public static final int     DFACC_RDWR = 3;
    public static final int     DFACC_CREATE=4;
    public static final int     DFACC_RDONLY=DFACC_READ;
    public static final int     DFACC_DEFAULT=000;
    public static final int     DFACC_SERIAL=001;
    public static final int     DFACC_PARALLEL=011;

    // annotation type in HDF
    public static final int     AN_DATA_LABEL  = 0;
    public static final int     AN_DATA_DESC   = AN_DATA_LABEL + 1;
    public static final int     AN_FILE_LABEL  = AN_DATA_LABEL + 2;
    public static final int     AN_FILE_DESC   = AN_DATA_LABEL + 3;

    // HDF Tag Definations

    // HDF WILDCARD
    public static final int     DFTAG_WILDCARD = 0;
    public static final int     DFREF_WILDCARD = 0;

    // File identifier
    public static final int     DFTAG_FID = 100;

    // File Description
    public static final int     DFTAG_FD  = 101;

    // Data Identifier Label
    public static final int     DFTAG_DIL = 104;

    // Data Identifier Annotation
    public static final int     DFTAG_DIA = 105;

    // 8-bits Raster image
    public static final int     DFTAG_RI8  = 202;
    public static final int     DFTAG_CI8  = 203;
    public static final int     DFTAG_II8  = 204;

    // 24-bits Raster image
    public static final int     DFTAG_RI  = 302;
    public static final int     DFTAG_CI  = 303;
    public static final int     DFTAG_RIG = 306;

    // SDS
    public static final int     DFTAG_SD  = 702;
    public static final int     DFTAG_SDG  = 700;
    public static final int     DFTAG_NDG  = 720;
    
    // Vgroup or Vdata
    public static final int     DFTAG_VH  = 1962;
    public static final int     DFTAG_VS  = 1963;
    public static final int     DFTAG_VG  = 1965;

    /** pixel interlacing scheme */
    public static final int MFGR_INTERLACE_PIXEL = 0;

    /** line interlacing scheme */
    public static final int MFGR_INTERLACE_LINE = MFGR_INTERLACE_PIXEL +1;

    /** component interlacing scheme */ 
    public static final int MFGR_INTERLACE_COMPONENT = MFGR_INTERLACE_PIXEL +2;

    /** interlacing supported by the vset.*/
    public static final int FULL_INTERLACE = 0;
    public static final int NO_INTERLACE   = 1;

    /** unsigned char */
    public static final int DFNT_UCHAR8 = 3;
    public static final int DFNT_UCHAR  = 3;

    /** char */
    public static final int DFNT_CHAR8  = 4;
    public static final int DFNT_CHAR   = 4;

    /** No supported by HDF */
    public static final int DFNT_CHAR16 = 42;
    public static final int DFNT_UCHAR16= 43;


    /** float */
    public static final int  DFNT_FLOAT32   =  5;
    public static final int  DFNT_FLOAT     =  5 ;

    //** double */
    public static final int  DFNT_FLOAT64   =  6;
    public static final int  DFNT_FLOAT128  =  7 ; 
    public static final int  DFNT_DOUBLE    =  6  ;

    /** 8-bit integer */
    public static final int  DFNT_INT8      =  20;

    /** unsigned 8-bit interger */
    public static final int  DFNT_UINT8    =  21;

    /** short */
    public static final int  DFNT_INT16    =  22;

    /** unsigned interger */
    public static final int  DFNT_UINT16   =  23;

    /** interger */
    public static final int  DFNT_INT32    =  24;

    /** unsigned interger */
    public static final int  DFNT_UINT32   =  25;

    /** No supported */
    public static final int  DFNT_INT64    =  26;
    public static final int  DFNT_UINT64   =  27;
    public static final int  DFNT_INT128   =  28;
    public static final int  DFNT_UINT128  =  30;
    public static final int  DFNT_LITEND =  0x00004000;

    public static final int DF_FORWARD  = 1;
    public static final int  DFS_MAXLEN = 255;

    public static final int COMP_NONE     =  0;
    public static final int COMP_JPEG     =  2;
    public static final int COMP_RLE      =  11;
    public static final int COMP_IMCOMP   =  12;
    public static final int COMP_CODE_NONE     =  0;
    public static final int COMP_CODE_RLE     =  1;
    public static final int COMP_CODE_NBIT     =  2;
    public static final int COMP_CODE_SKPHUFF  =  3; 
    public static final int COMP_CODE_DEFLATE  =  4;
    public static final int COMP_CODE_INVALID  =  5;
    public static final int COMP_MODEL_STDIO  =  0;

    // Interlace schemes
    public static final int DFIL_PIXEL  = 0;  /* Pixel Interlacing */
    public static final int DFIL_LINE   = 1;  /* Scan Line Interlacing */
    public static final int DFIL_PLANE  = 2;  /* Scan Plane Interlacing */

    public static final int SD_FILL  = 0;  
    public static final int SD_NOFILL  = 0x100;
    public static final int SD_DIMVAL_BW_COMP  = 1;  
    public static final int SD_DIMVAL_BW_INCOMP  = 0;

    public static final int HDF_NONE  = 0x0;
    public static final int HDF_CHUNK  = 0x1;
    public static final int HDF_COMP  = 0x3;
    public static final int HDF_NBIT  = 0x5;
    public static final int MAX_VAR_DIMS =32;

    //the names of the Vgroups created by the GR interface
    public static final String GR_NAME = "RIG0.0";
    public static final String RI_NAME = "RI0.0";
    public static final String RIGATTRNAME = "RIATTR0.0N";
    public static final String RIGATTRCLASS = "RIATTR0.0C";

    // names of classes of the Vdatas/Vgroups created by the SD interface 
    public static final String  HDF_ATTRIBUTE = "Attr0.0";
    public static final String  HDF_VARIABLE = "Var0.0";
    public static final String  HDF_DIMENSION = "Dim0.0";
    public static final String  HDF_UDIMENSION = "UDim0.0";
    public static final String  DIM_VALS = "DimVal0.0";
    public static final String  DIM_VALS01 = "DimVal0.1";
    public static final String  HDF_CHK_TBL = "_HDF_CHK_TBL_";
    public static final String  HDF_CDF = "CDF0.0";

    // names of data object types
    public static final String ANNOTATION = "HDF_ANNOTATION";
    public static final String RI8 = "HDF_RI8";
    public static final String RI24 = "HDF_RI24";
    public static final String GR = "HDF_GR";
    public static final String SDS = "HDF_SDS";
    public static final String VDATA = "HDF_VDATA";
    public static final String VGROUP = "HDF_GROUP";

    // data types represented by Strings
    public static final String UCHAR8   = "UCHAR8";
    public static final String CHAR8    = "CHAR8";
    public static final String UCHAR16  = "UCHAR16";
    public static final String CHAR16   = "CHAR16";
    public static final String FLOAT32  = "FLOAT32";
    public static final String FLOAT64  = "FLOAT64";
    public static final String FLOAT128 = "FLOAT128";
    public static final String INT8     = "INT8";
    public static final String UINT8    = "UINT8";
    public static final String INT16    = "INT16";
    public static final String UINT16   = "UINT16";
    public static final String INT32    = "INT32";
    public static final String UINT32   = "UINT32";
    public static final String INT64    = "INT64";
    public static final String UINT64   = "UINT64";
    public static final String INT128   = "INT128";
    public static final String UINT128  = "UINT128";


    /**
     *  convert number type to string type
     *  params type  the number representing the data type
     *  return the string representing the data type
     */
    public static String getType(int type)
    {
        if   (type == HDFConstants.DFNT_UCHAR8) return HDFConstants.UCHAR8;
        else if (type == HDFConstants.DFNT_CHAR8) return HDFConstants.CHAR8;
        else if (type == HDFConstants.DFNT_UCHAR16) return HDFConstants.UCHAR16;
        else if (type == HDFConstants.DFNT_CHAR16) return HDFConstants.CHAR16;
        else if (type == HDFConstants.DFNT_FLOAT32) return HDFConstants.FLOAT32;
        else if (type == HDFConstants.DFNT_FLOAT64) return HDFConstants.FLOAT64;
        else if (type == HDFConstants.DFNT_FLOAT128) return HDFConstants.FLOAT128;
        else if (type == HDFConstants.DFNT_INT8) return HDFConstants.INT8;
        else if (type == HDFConstants. DFNT_UINT8) return HDFConstants.UINT8;
        else if (type == HDFConstants.DFNT_INT16) return HDFConstants.INT16;
        else if (type == HDFConstants.DFNT_UINT16) return HDFConstants.UINT16;
        else if (type == HDFConstants.DFNT_INT32) return HDFConstants.INT32;
        else if (type == HDFConstants.DFNT_UINT32) return HDFConstants.UINT32;
        else if (type == HDFConstants.DFNT_INT64) return HDFConstants.INT64;
        else if (type == HDFConstants.DFNT_UINT64) return HDFConstants.UINT64;
        else if (type == HDFConstants.DFNT_INT128) return HDFConstants.INT128;
        else if (type == HDFConstants.DFNT_UINT128) return HDFConstants.UINT128;
        else return "Undefined Data Type";
    }

    /**
     *  convert string type to number type
     *  params type  the string representing the data type
     *  return the integer representing the data type
     */
    public static int getType(String type)
    {
        if   (type.equalsIgnoreCase(HDFConstants.UCHAR8)) return HDFConstants.DFNT_UCHAR8;
        else if (type.equalsIgnoreCase(HDFConstants.CHAR8)) return HDFConstants.DFNT_CHAR8;
        else if (type.equalsIgnoreCase(HDFConstants.UCHAR16)) return HDFConstants.DFNT_UCHAR16;
        else if (type.equalsIgnoreCase(HDFConstants.CHAR16)) return HDFConstants.DFNT_CHAR16;
        else if (type.equalsIgnoreCase(HDFConstants.FLOAT32)) return HDFConstants.DFNT_FLOAT32;
        else if (type.equalsIgnoreCase(HDFConstants.FLOAT64)) return HDFConstants.DFNT_FLOAT64;
        else if (type.equalsIgnoreCase(HDFConstants.FLOAT128)) return HDFConstants.DFNT_FLOAT128;
        else if (type.equalsIgnoreCase(HDFConstants.INT8)) return HDFConstants.DFNT_INT8;
        else if (type.equalsIgnoreCase(HDFConstants. UINT8)) return HDFConstants.DFNT_UINT8;
        else if (type.equalsIgnoreCase(HDFConstants.INT16)) return HDFConstants.DFNT_INT16;
        else if (type.equalsIgnoreCase(HDFConstants.UINT16)) return HDFConstants.DFNT_UINT16;
        else if (type.equalsIgnoreCase(HDFConstants.INT32)) return HDFConstants.DFNT_INT32;
        else if (type.equalsIgnoreCase(HDFConstants.UINT32)) return HDFConstants.DFNT_UINT32;
        else if (type.equalsIgnoreCase(HDFConstants.INT64)) return HDFConstants.DFNT_INT64;
        else if (type.equalsIgnoreCase(HDFConstants.UINT64)) return HDFConstants.DFNT_UINT64;
        else if (type.equalsIgnoreCase(HDFConstants.INT128)) return HDFConstants.DFNT_INT128;
        else if (type.equalsIgnoreCase(HDFConstants.UINT128)) return HDFConstants.DFNT_UINT128;
        else return -1;
    }

    /**
     *  gets the size of the data type in bytes,
     *  e.g size of DFNT_FLOAT32 = 4
     *
     *  the size of the data type
     */
    public static int getTypeSize(int type)
    {
        int size = 0;

        switch(type)
        {
            case HDFConstants.DFNT_UCHAR16:
            case HDFConstants.DFNT_CHAR16:
            case HDFConstants.DFNT_INT16:
            case HDFConstants.DFNT_UINT16:
                size = 2;
                break;
            case HDFConstants.DFNT_FLOAT32:
            case HDFConstants.DFNT_INT32:
            case HDFConstants.DFNT_UINT32:
                size = 4;
                break;
            case HDFConstants.DFNT_FLOAT64:
            case HDFConstants.DFNT_INT64:
            case HDFConstants.DFNT_UINT64:
                size = 8;
                break;
            case HDFConstants.DFNT_FLOAT128:
            case HDFConstants.DFNT_INT128:
            case HDFConstants.DFNT_UINT128:
                size = 16;
                break;
            default:
                size = 1;
                break;
        }

        return size;
    }

}