File: coda.h.cmake.in

package info (click to toggle)
coda 2.25.5-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 10,168 kB
  • sloc: ansic: 121,489; javascript: 6,788; java: 2,369; python: 1,695; yacc: 1,007; makefile: 598; lex: 204; sh: 105; fortran: 60; xml: 5
file content (657 lines) | stat: -rw-r--r-- 30,541 bytes parent folder | download | duplicates (2)
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
/*
 * Copyright (C) 2007-2024 S[&]T, The Netherlands.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef CODA_H
#define CODA_H

/** \file */

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C"
{
#endif
/* *INDENT-ON* */

#if defined(WIN32) && defined(LIBCODADLL)
#ifdef LIBCODADLL_EXPORTS
#define LIBCODA_API __declspec(dllexport)
#else
#define LIBCODA_API __declspec(dllimport)
#endif
#else
#define LIBCODA_API
#endif

#ifndef CODA_CONFIG_H

/* These are the 'configure' defines that we need to export.   
 * However, we need to assume that the user of coda.h may also be defining
 * some of these values himself. In order to prevent double definitions each
 * define below is encapsulated by a #ifndef - #endif block.
 */

#ifndef HAVE_INTTYPES_H
#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H}
#endif
#ifndef HAVE_STDINT_H
#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H}
#endif
#ifndef HAVE_SYS_TYPES_H
#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
#endif

#ifndef int8_t
#cmakedefine int8_t ${int8_t}
#endif
#ifndef int16_t
#cmakedefine int16_t ${int16_t}
#endif
#ifndef int32_t
#cmakedefine int32_t ${int32_t}
#endif
#ifndef int64_t
#cmakedefine int64_t ${int64_t}
#endif

#ifndef uint8_t
#cmakedefine uint8_t ${uint8_t}
#endif
#ifndef uint16_t
#cmakedefine uint16_t ${uint16_t}
#endif
#ifndef uint32_t
#cmakedefine uint32_t ${uint32_t}
#endif
#ifndef uint64_t
#cmakedefine uint64_t ${uint64_t}
#endif

#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
#ifdef HAVE_STDINT_H
#include <stdint.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#endif
#endif

#if defined(WIN32) && (_MSC_VER < 1600) && !defined(__MINGW32__)
/* For Visual Studio > 2010 and MinGW we can use stdint.h
 * For earlier versions of Visual Studio we need to provide our own defines
 */
#ifndef int8_t
#define int8_t  signed char
#endif
#ifndef int16_t
#define int16_t signed short
#endif
#ifndef int32_t
#define int32_t int
#endif
#ifndef int64_t
#define int64_t __int64
#endif

#ifndef uint8_t
#define uint8_t  unsigned char
#endif
#ifndef uint16_t
#define uint16_t unsigned short
#endif
#ifndef uint32_t
#define uint32_t unsigned int
#endif
#ifndef uint64_t
#define uint64_t unsigned __int64
#endif
#endif

#endif /* CODA_CONFIG_H */

#ifndef CODA_INTERNAL

/* *CFFI-ON* */

LIBCODA_API extern const char *coda_get_libcoda_version(void);

/* *CFFI-OFF* */

#define libcoda_version (coda_get_libcoda_version())

/* *CFFI-ON* */

LIBCODA_API extern int *coda_get_errno(void);

/* *CFFI-OFF* */

#define coda_errno (*coda_get_errno())

#endif

#ifndef PRINTF_ATTR
#cmakedefine PRINTF_ATTR ${PRINTF_ATTR}
#ifndef PRINTF_ATTR
#define PRINTF_ATTR
#endif
#endif

/* *CFFI-ON* */

/** Maximum number of dimensions of a multidimensional array 
 * \ingroup coda_general
 */
#define CODA_MAX_NUM_DIMS         8

/* Defines for backward compatibility with CODA 1.x interface */

/* *CFFI-OFF* */

#define coda_ProductFile coda_product
#define coda_Cursor coda_cursor
#define coda_Type coda_type

/* *CFFI-ON* */

#define CODA_SUCCESS                                          (0)
#define CODA_ERROR_OUT_OF_MEMORY                             (-1)
#define CODA_ERROR_HDF4                                     (-10)
#define CODA_ERROR_NO_HDF4_SUPPORT                          (-11)
#define CODA_ERROR_HDF5                                     (-12)
#define CODA_ERROR_NO_HDF5_SUPPORT                          (-13)
#define CODA_ERROR_XML                                      (-14)

#define CODA_ERROR_FILE_NOT_FOUND                           (-20)
#define CODA_ERROR_FILE_OPEN                                (-21)
#define CODA_ERROR_FILE_READ                                (-22)
#define CODA_ERROR_FILE_WRITE                               (-23)

#define CODA_ERROR_INVALID_ARGUMENT                        (-100)
#define CODA_ERROR_INVALID_INDEX                           (-101)
#define CODA_ERROR_INVALID_NAME                            (-102)
#define CODA_ERROR_INVALID_FORMAT                          (-103)
#define CODA_ERROR_INVALID_DATETIME                        (-104)
#define CODA_ERROR_INVALID_TYPE                            (-105)
#define CODA_ERROR_ARRAY_NUM_DIMS_MISMATCH                 (-106)
#define CODA_ERROR_ARRAY_OUT_OF_BOUNDS                     (-107)
#define CODA_ERROR_NO_PARENT                               (-108)

#define CODA_ERROR_UNSUPPORTED_PRODUCT                     (-200)

#define CODA_ERROR_PRODUCT                                 (-300)
#define CODA_ERROR_OUT_OF_BOUNDS_READ                      (-301)

#define CODA_ERROR_DATA_DEFINITION                         (-400)
#define CODA_ERROR_EXPRESSION                              (-401)

/** \addtogroup coda_general
 * @{
 */

enum coda_array_ordering_enum
{
    coda_array_ordering_c,                  /**< C array ordering (last dimension is fastest running) */
    coda_array_ordering_fortran             /**< Fortran array ordering (first dimension is fastest running) */
};

enum coda_filefilter_status_enum
{
    coda_ffs_error,                         /**< error: General error (usually file I/O related) */
    coda_ffs_could_not_open_file,           /**< error: Could not open file */
    coda_ffs_could_not_access_directory,    /**< error: Could not recurse into directory */
    coda_ffs_unsupported_file,              /**< File can not be read by CODA */
    coda_ffs_match,                         /**< File matches filter */
    coda_ffs_no_match                       /**< File does not match filter */
};

enum coda_format_enum
{
    coda_format_ascii,                      /**< Data stored in structured ASCII format */
    coda_format_binary,                     /**< Data stored in structured binary format */
    coda_format_xml,                        /**< Data stored in XML format */
    coda_format_hdf4,                       /**< Data stored in HDF4 format */
    coda_format_hdf5,                       /**< Data stored in HDF5 format */
    coda_format_cdf,                        /**< Data stored in CDF format */
    coda_format_netcdf,                     /**< Data stored in NetCDF format */
    coda_format_grib,                       /**< Data stored in GRIB format */
    coda_format_rinex,                      /**< Data stored in RINEX format */
    coda_format_sp3                         /**< Data stored in SP3 format */
};

/** @} */

/** \addtogroup coda_types
 * @{
 */

enum coda_type_class_enum
{
    coda_record_class,                      /**< Class of all record types */
    coda_array_class,                       /**< Class of all array types */
    coda_integer_class,                     /**< Class of all integer types */
    coda_real_class,                        /**< Class of all real (floating point) types */
    coda_text_class,                        /**< Class of all text types */
    coda_raw_class,                         /**< Class of all unformatted types (data that is not interpreted) */
    coda_special_class                      /**< Class of all special data types (such as time and complex) */
};

enum coda_special_type_enum
{
    coda_special_no_data,                   /**< No data (data object is not available) */
    coda_special_vsf_integer,               /**< A compound containing a variable scale factor and an integer.
                                                 The returned double value equals: integer_value x 10^(-scale_factor) */
    coda_special_time,                      /**< Data specifying a date/time value */
    coda_special_complex                    /**< Data consisting of a real and imaginary value */
};

enum coda_native_type_enum
{
    coda_native_type_not_available = -1,    /**< native type value for compound entities that can not be read directly */
    coda_native_type_int8,                  /**< 8 bit signed integer (#coda_integer_class) */
    coda_native_type_uint8,                 /**< 8 bit unsigned integer (#coda_integer_class) */
    coda_native_type_int16,                 /**< 16 bit signed integer (#coda_integer_class) */
    coda_native_type_uint16,                /**< 16 bit unsigned integer (#coda_integer_class) */
    coda_native_type_int32,                 /**< 32 bit signed integer (#coda_integer_class) */
    coda_native_type_uint32,                /**< 32 bit unsigned integer (#coda_integer_class) */
    coda_native_type_int64,                 /**< 64 bit signed integer (#coda_integer_class) */
    coda_native_type_uint64,                /**< 64 bit unsigned integer (#coda_integer_class) */
    coda_native_type_float,                 /**< 32 bit IEEE floating point type (#coda_real_class) */
    coda_native_type_double,                /**< 64 bit IEEE floating point type (#coda_real_class) */
    coda_native_type_char,                  /**< single character (#coda_text_class) */
    coda_native_type_string,                /**< string (#coda_text_class) */
    coda_native_type_bytes                  /**< series of uninterpreted bytes (#coda_raw_class) */
};

/** @} */

/** \addtogroup coda_expression
 * @{
 */

enum coda_expression_type_enum
{
    coda_expression_boolean,
    coda_expression_integer,
    coda_expression_float,
    coda_expression_string,
    coda_expression_node,
    coda_expression_void
};

/** @} */

typedef enum coda_array_ordering_enum coda_array_ordering;
typedef enum coda_filefilter_status_enum coda_filefilter_status;
typedef enum coda_format_enum coda_format;
typedef enum coda_type_class_enum coda_type_class;
typedef enum coda_special_type_enum coda_special_type;
typedef enum coda_native_type_enum coda_native_type;
typedef enum coda_expression_type_enum coda_expression_type;

/* *CFFI-OFF* */

typedef struct coda_product_struct coda_product;
typedef struct coda_cursor_struct coda_cursor;
typedef struct coda_type_struct coda_type;

/* *CFFI-ON* */

typedef struct coda_expression_struct coda_expression;

/* CODA General */

LIBCODA_API int coda_init(void);
LIBCODA_API void coda_done(void);

LIBCODA_API int coda_set_definition_path(const char *path);
LIBCODA_API int coda_set_definition_path_conditional(const char *file, const char *searchpath,
                                                     const char *relative_location);

LIBCODA_API int coda_set_option_bypass_special_types(int enable);
LIBCODA_API int coda_get_option_bypass_special_types(void);
LIBCODA_API int coda_set_option_perform_boundary_checks(int enable);
LIBCODA_API int coda_get_option_perform_boundary_checks(void);
LIBCODA_API int coda_set_option_perform_conversions(int enable);
LIBCODA_API int coda_get_option_perform_conversions(void);
LIBCODA_API int coda_set_option_use_fast_size_expressions(int enable);
LIBCODA_API int coda_get_option_use_fast_size_expressions(void);
LIBCODA_API int coda_set_option_use_mmap(int enable);
LIBCODA_API int coda_get_option_use_mmap(void);

LIBCODA_API void coda_free(void *ptr);

LIBCODA_API double coda_NaN(void);
LIBCODA_API int coda_isNaN(double x);
LIBCODA_API double coda_PlusInf(void);
LIBCODA_API double coda_MinInf(void);
LIBCODA_API int coda_isInf(double x);
LIBCODA_API int coda_isPlusInf(double x);
LIBCODA_API int coda_isMinInf(double x);

LIBCODA_API void coda_str64(int64_t a, char *s);
LIBCODA_API void coda_str64u(uint64_t a, char *s);
LIBCODA_API void coda_strfl(double a, char *s);

LIBCODA_API long coda_c_index_to_fortran_index(int num_dims, const long dim[], long index);

LIBCODA_API int coda_match_filefilter(const char *filefilter, int num_filepaths, const char **filepaths,
                                      int (*callbackfunc)(const char *, coda_filefilter_status, const char *, void *),
                                      void *userdata);

/* CODA Time */

LIBCODA_API int coda_time_double_to_parts(double datetime, int *year, int *month, int *day, int *hour, int *minute,
                                          int *second, int *musec);
LIBCODA_API int coda_time_double_to_parts_utc(double datetime, int *year, int *month, int *day, int *hour, int *minute,
                                              int *second, int *musec);
LIBCODA_API int coda_time_parts_to_double(int year, int month, int day, int hour, int minute, int second, int musec,
                                          double *datetime);
LIBCODA_API int coda_time_parts_to_double_utc(int year, int month, int day, int hour, int minute, int second, int musec,
                                              double *datetime);

LIBCODA_API int coda_time_parts_to_string(int year, int month, int day, int hour, int minute, int second, int musec,
                                          const char *format, char *out_str);
LIBCODA_API int coda_time_string_to_parts(const char *format, const char *str, int *year, int *month, int *day,
                                          int *hour, int *minute, int *second, int *musec);

LIBCODA_API int coda_time_double_to_string(double datetime, const char *format, char *out_str);
LIBCODA_API int coda_time_double_to_string_utc(double datetime, const char *format, char *out_str);
LIBCODA_API int coda_time_string_to_double(const char *format, const char *str, double *datetime);
LIBCODA_API int coda_time_string_to_double_utc(const char *format, const char *str, double *datetime);

/* deprecated backward compatible functions */
LIBCODA_API int coda_datetime_to_double(int year, int month, int day, int hour, int minute, int second, int musec,
                                        double *datetime);
LIBCODA_API int coda_double_to_datetime(double datetime, int *year, int *month, int *day, int *hour, int *minute,
                                        int *second, int *musec);
LIBCODA_API int coda_time_to_string(double datetime, char *out_str);
LIBCODA_API int coda_string_to_time(const char *str, double *datetime);

LIBCODA_API int coda_utcdatetime_to_double(int year, int month, int day, int hour, int minute, int secon, int musec,
                                           double *datetime);
LIBCODA_API int coda_double_to_utcdatetime(double datetime, int *year, int *month, int *day, int *hour, int *minute,
                                           int *second, int *musec);
LIBCODA_API int coda_time_to_utcstring(double datetime, char *out_str);
LIBCODA_API int coda_utcstring_to_time(const char *str, double *datetime);

/* CODA Error */

/* *INDENT-OFF* */

/* *CFFI-OFF* */

LIBCODA_API void coda_set_error(int err, const char *message, ...) PRINTF_ATTR;

/* *CFFI-ON* */

/* *INDENT-ON* */
LIBCODA_API const char *coda_errno_to_string(int err);

/* CODA Product */

LIBCODA_API int coda_recognize_file(const char *filename, int64_t *file_size, coda_format *file_format,
                                    const char **product_class, const char **product_type, int *version);

LIBCODA_API int coda_open(const char *filename, coda_product **product);
LIBCODA_API int coda_open_as(const char *filename, const char *product_class, const char *product_type, int version,
                             coda_product **product);
LIBCODA_API int coda_close(coda_product *product);

LIBCODA_API int coda_get_product_filename(const coda_product *product, const char **filename);
LIBCODA_API int coda_get_product_file_size(const coda_product *product, int64_t *file_size);
LIBCODA_API int coda_get_product_format(const coda_product *product, coda_format *format);
LIBCODA_API int coda_get_product_class(const coda_product *product, const char **product_class);
LIBCODA_API int coda_get_product_type(const coda_product *product, const char **product_type);
LIBCODA_API int coda_get_product_version(const coda_product *product, int *version);
LIBCODA_API int coda_get_product_definition_file(const coda_product *product, const char **definition_file);
LIBCODA_API int coda_get_product_root_type(const coda_product *product, coda_type **type);

LIBCODA_API int coda_get_product_variable_value(coda_product *product, const char *variable, long index,
                                                int64_t *value);

/* CODA Types */

LIBCODA_API const char *coda_type_get_format_name(coda_format format);
LIBCODA_API const char *coda_type_get_class_name(coda_type_class type_class);
LIBCODA_API const char *coda_type_get_native_type_name(coda_native_type native_type);
LIBCODA_API const char *coda_type_get_special_type_name(coda_special_type special_type);

LIBCODA_API int coda_type_has_attributes(const coda_type *type, int *has_attributes);

LIBCODA_API int coda_type_get_format(const coda_type *type, coda_format *format);
LIBCODA_API int coda_type_get_class(const coda_type *type, coda_type_class *type_class);
LIBCODA_API int coda_type_get_read_type(const coda_type *type, coda_native_type *read_type);
LIBCODA_API int coda_type_get_string_length(const coda_type *type, long *length);
LIBCODA_API int coda_type_get_bit_size(const coda_type *type, int64_t *bit_size);
LIBCODA_API int coda_type_get_name(const coda_type *type, const char **name);
LIBCODA_API int coda_type_get_description(const coda_type *type, const char **description);
LIBCODA_API int coda_type_get_unit(const coda_type *type, const char **unit);
LIBCODA_API int coda_type_get_fixed_value(const coda_type *type, const char **fixed_value, long *length);
LIBCODA_API int coda_type_get_attributes(const coda_type *type, coda_type **attributes);

LIBCODA_API int coda_type_get_num_record_fields(const coda_type *type, long *num_fields);
LIBCODA_API int coda_type_get_record_field_index_from_name(const coda_type *type, const char *name, long *index);
LIBCODA_API int coda_type_get_record_field_index_from_real_name(const coda_type *type, const char *real_name,
                                                                long *index);
LIBCODA_API int coda_type_get_record_field_type(const coda_type *type, long index, coda_type **field_type);
LIBCODA_API int coda_type_get_record_field_name(const coda_type *type, long index, const char **name);
LIBCODA_API int coda_type_get_record_field_real_name(const coda_type *type, long index, const char **real_name);
LIBCODA_API int coda_type_get_record_field_hidden_status(const coda_type *type, long index, int *hidden);
LIBCODA_API int coda_type_get_record_field_available_status(const coda_type *type, long index, int *available);
LIBCODA_API int coda_type_get_record_union_status(const coda_type *type, int *is_union);

LIBCODA_API int coda_type_get_array_num_dims(const coda_type *type, int *num_dims);
LIBCODA_API int coda_type_get_array_dim(const coda_type *type, int *num_dims, long dim[]);
LIBCODA_API int coda_type_get_array_base_type(const coda_type *type, coda_type **base_type);

LIBCODA_API int coda_type_get_special_type(const coda_type *type, coda_special_type *special_type);
LIBCODA_API int coda_type_get_special_base_type(const coda_type *type, coda_type **base_type);

/* CODA Cursor */

LIBCODA_API int coda_cursor_set_product(coda_cursor *cursor, coda_product *product);

LIBCODA_API int coda_cursor_goto(coda_cursor *cursor, const char *path);

LIBCODA_API int coda_cursor_goto_first_record_field(coda_cursor *cursor);
LIBCODA_API int coda_cursor_goto_next_record_field(coda_cursor *cursor);
LIBCODA_API int coda_cursor_goto_record_field_by_index(coda_cursor *cursor, long index);
LIBCODA_API int coda_cursor_goto_record_field_by_name(coda_cursor *cursor, const char *name);
LIBCODA_API int coda_cursor_goto_available_union_field(coda_cursor *cursor);

LIBCODA_API int coda_cursor_goto_first_array_element(coda_cursor *cursor);
LIBCODA_API int coda_cursor_goto_next_array_element(coda_cursor *cursor);
LIBCODA_API int coda_cursor_goto_array_element(coda_cursor *cursor, int num_subs, const long subs[]);
LIBCODA_API int coda_cursor_goto_array_element_by_index(coda_cursor *cursor, long index);

LIBCODA_API int coda_cursor_goto_attributes(coda_cursor *cursor);

LIBCODA_API int coda_cursor_goto_root(coda_cursor *cursor);
LIBCODA_API int coda_cursor_goto_parent(coda_cursor *cursor);

LIBCODA_API int coda_cursor_use_base_type_of_special_type(coda_cursor *cursor);

LIBCODA_API int coda_cursor_has_ascii_content(const coda_cursor *cursor, int *has_ascii_content);
LIBCODA_API int coda_cursor_has_attributes(const coda_cursor *cursor, int *has_attributes);

LIBCODA_API int coda_cursor_get_string_length(const coda_cursor *cursor, long *length);
LIBCODA_API int coda_cursor_get_bit_size(const coda_cursor *cursor, int64_t *bit_size);
LIBCODA_API int coda_cursor_get_byte_size(const coda_cursor *cursor, int64_t *byte_size);
LIBCODA_API int coda_cursor_get_num_elements(const coda_cursor *cursor, long *num_elements);

LIBCODA_API int coda_cursor_get_product_file(const coda_cursor *cursor, coda_product **product);

LIBCODA_API int coda_cursor_get_depth(const coda_cursor *cursor, int *depth);
LIBCODA_API int coda_cursor_get_index(const coda_cursor *cursor, long *index);

LIBCODA_API int coda_cursor_get_file_bit_offset(const coda_cursor *cursor, int64_t *bit_offset);
LIBCODA_API int coda_cursor_get_file_byte_offset(const coda_cursor *cursor, int64_t *byte_offset);

LIBCODA_API int coda_cursor_get_format(const coda_cursor *cursor, coda_format *format);
LIBCODA_API int coda_cursor_get_type_class(const coda_cursor *cursor, coda_type_class *type_class);
LIBCODA_API int coda_cursor_get_read_type(const coda_cursor *cursor, coda_native_type *read_type);
LIBCODA_API int coda_cursor_get_special_type(const coda_cursor *cursor, coda_special_type *special_type);
LIBCODA_API int coda_cursor_get_type(const coda_cursor *cursor, coda_type **type);

LIBCODA_API int coda_cursor_get_record_field_index_from_name(const coda_cursor *cursor, const char *name, long *index);
LIBCODA_API int coda_cursor_get_record_field_available_status(const coda_cursor *cursor, long index, int *available);
LIBCODA_API int coda_cursor_get_available_union_field_index(const coda_cursor *cursor, long *index);

LIBCODA_API int coda_cursor_get_array_dim(const coda_cursor *cursor, int *num_dims, long dim[]);

LIBCODA_API int coda_cursor_print_path(const coda_cursor *cursor, int (*print)(const char *, ...));

/* read simple-type scalars */

LIBCODA_API int coda_cursor_read_int8(const coda_cursor *cursor, int8_t *dst);
LIBCODA_API int coda_cursor_read_uint8(const coda_cursor *cursor, uint8_t *dst);
LIBCODA_API int coda_cursor_read_int16(const coda_cursor *cursor, int16_t *dst);
LIBCODA_API int coda_cursor_read_uint16(const coda_cursor *cursor, uint16_t *dst);
LIBCODA_API int coda_cursor_read_int32(const coda_cursor *cursor, int32_t *dst);
LIBCODA_API int coda_cursor_read_uint32(const coda_cursor *cursor, uint32_t *dst);
LIBCODA_API int coda_cursor_read_int64(const coda_cursor *cursor, int64_t *dst);
LIBCODA_API int coda_cursor_read_uint64(const coda_cursor *cursor, uint64_t *dst);

LIBCODA_API int coda_cursor_read_float(const coda_cursor *cursor, float *dst);
LIBCODA_API int coda_cursor_read_double(const coda_cursor *cursor, double *dst);

LIBCODA_API int coda_cursor_read_char(const coda_cursor *cursor, char *dst);
LIBCODA_API int coda_cursor_read_string(const coda_cursor *cursor, char *dst, long dst_size);

LIBCODA_API int coda_cursor_read_bits(const coda_cursor *cursor, uint8_t *dst, int64_t bit_offset, int64_t bit_length);
LIBCODA_API int coda_cursor_read_bytes(const coda_cursor *cursor, uint8_t *dst, int64_t offset, int64_t length);

/* read simple-type arrays */

LIBCODA_API int coda_cursor_read_int8_array(const coda_cursor *cursor, int8_t *dst, coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_uint8_array(const coda_cursor *cursor, uint8_t *dst,
                                             coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_int16_array(const coda_cursor *cursor, int16_t *dst,
                                             coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_uint16_array(const coda_cursor *cursor, uint16_t *dst,
                                              coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_int32_array(const coda_cursor *cursor, int32_t *dst,
                                             coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_uint32_array(const coda_cursor *cursor, uint32_t *dst,
                                              coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_int64_array(const coda_cursor *cursor, int64_t *dst,
                                             coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_uint64_array(const coda_cursor *cursor, uint64_t *dst,
                                              coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_float_array(const coda_cursor *cursor, float *dst, coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_double_array(const coda_cursor *cursor, double *dst,
                                              coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_char_array(const coda_cursor *cursor, char *dst, coda_array_ordering array_ordering);

/* read simple-type arrays partially */

LIBCODA_API int coda_cursor_read_int8_partial_array(const coda_cursor *cursor, long offset, long length, int8_t *dst);
LIBCODA_API int coda_cursor_read_uint8_partial_array(const coda_cursor *cursor, long offset, long length, uint8_t *dst);
LIBCODA_API int coda_cursor_read_int16_partial_array(const coda_cursor *cursor, long offset, long length, int16_t *dst);
LIBCODA_API int coda_cursor_read_uint16_partial_array(const coda_cursor *cursor, long offset, long length,
                                                      uint16_t *dst);
LIBCODA_API int coda_cursor_read_int32_partial_array(const coda_cursor *cursor, long offset, long length, int32_t *dst);
LIBCODA_API int coda_cursor_read_uint32_partial_array(const coda_cursor *cursor, long offset, long length,
                                                      uint32_t *dst);
LIBCODA_API int coda_cursor_read_int64_partial_array(const coda_cursor *cursor, long offset, long length, int64_t *dst);
LIBCODA_API int coda_cursor_read_uint64_partial_array(const coda_cursor *cursor, long offset, long length,
                                                      uint64_t *dst);
LIBCODA_API int coda_cursor_read_float_partial_array(const coda_cursor *cursor, long offset, long length, float *dst);
LIBCODA_API int coda_cursor_read_double_partial_array(const coda_cursor *cursor, long offset, long length, double *dst);
LIBCODA_API int coda_cursor_read_char_partial_array(const coda_cursor *cursor, long offset, long length, char *dst);

/* read complex values */

LIBCODA_API int coda_cursor_read_complex_double_pair(const coda_cursor *cursor, double *dst);
LIBCODA_API int coda_cursor_read_complex_double_pairs_array(const coda_cursor *cursor, double *dst,
                                                            coda_array_ordering array_ordering);
LIBCODA_API int coda_cursor_read_complex_double_split(const coda_cursor *cursor, double *dst_re, double *dst_im);
LIBCODA_API int coda_cursor_read_complex_double_split_array(const coda_cursor *cursor, double *dst_re,
                                                            double *dst_im, coda_array_ordering array_ordering);


/* CODA Expression */

LIBCODA_API const char *coda_expression_get_type_name(coda_expression_type type);

LIBCODA_API int coda_expression_from_string(const char *exprstring, coda_expression **expr);
LIBCODA_API void coda_expression_delete(coda_expression *expr);
LIBCODA_API int coda_expression_get_type(const coda_expression *expr, coda_expression_type *type);
LIBCODA_API int coda_expression_is_constant(const coda_expression *expr);
LIBCODA_API int coda_expression_is_equal(const coda_expression *expr1, const coda_expression *expr2);

LIBCODA_API int coda_expression_eval_bool(const coda_expression *expr, const coda_cursor *cursor, int *value);
LIBCODA_API int coda_expression_eval_integer(const coda_expression *expr, const coda_cursor *cursor, int64_t *value);
LIBCODA_API int coda_expression_eval_float(const coda_expression *expr, const coda_cursor *cursor, double *value);
LIBCODA_API int coda_expression_eval_string(const coda_expression *expr, const coda_cursor *cursor, char **value,
                                            long *length);
LIBCODA_API int coda_expression_eval_node(const coda_expression *expr, coda_cursor *cursor);

LIBCODA_API int coda_expression_print(const coda_expression *expr, int (*print)(const char *, ...));

/* *CFFI-OFF* */

/* DO NOT USE ANY OF THE FIELDS CONTAINED IN THE RECORDS BELOW! */

#ifndef SWIG

#ifdef CODA_INTERNAL
#define CODA_PRIVATE_FIELD(name) name
#else
#define CODA_PRIVATE_FIELD(name) coda_private_field_ ## name
#endif

#define CODA_CURSOR_MAXDEPTH 32

struct coda_cursor_struct
{
    struct coda_product_struct *CODA_PRIVATE_FIELD(product);
    int CODA_PRIVATE_FIELD(n);
    struct
    {
        struct coda_dynamic_type_struct *type;
        long index;
        int64_t bit_offset;
    } CODA_PRIVATE_FIELD(stack)[CODA_CURSOR_MAXDEPTH];
};

#endif /* SWIG */

/* *INDENT-OFF* */
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */

#endif