1 /*
2  * Distributed under the OSI-approved Apache License, Version 2.0.  See
3  * accompanying file Copyright.txt for details.
4  *
5  * adios2_c_types.h : basic adios2 types
6  *
7  *  Created on: Aug 7, 2017
8  *      Author: William F Godoy godoywf@ornl.gov
9  */
10 
11 #ifndef ADIOS2_BINDINGS_C_ADIOS2_C_TYPES_H_
12 #define ADIOS2_BINDINGS_C_ADIOS2_C_TYPES_H_
13 
14 #include <limits.h> // ULLONG_MAX
15 #include <stddef.h> // size_t
16 #include <stdint.h> // uint64_t
17 
18 #include "adios2/common/ADIOSConfig.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 typedef struct adios2_adios adios2_adios;
25 typedef struct adios2_io adios2_io;
26 typedef struct adios2_variable adios2_variable;
27 typedef struct adios2_attribute adios2_attribute;
28 typedef struct adios2_engine adios2_engine;
29 typedef struct adios2_operator adios2_operator;
30 
31 /**
32  * @brief adios2_error return types for all ADIOS2 C API functions
33  * Based on the library C++ standardized exceptions
34  * https://en.cppreference.com/w/cpp/error/exception
35  * Each error will issue a more detailed description in the standard error
36  * output, stderr
37  */
38 typedef enum
39 {
40     /** success */
41     adios2_error_none = 0,
42 
43     /**
44      * user input error, on when adios2_debug_mode_on is passed to adios2_init
45      * or adios2_init_config
46      */
47     adios2_error_invalid_argument = 1,
48 
49     /** low-level system error, e.g. system IO error */
50     adios2_error_system_error = 2,
51 
52     /** runtime errors other than system errors, e.g. memory overflow */
53     adios2_error_runtime_error = 3,
54 
55     /** any other error exception */
56     adios2_error_exception = 4
57 
58 } adios2_error;
59 
60 typedef enum
61 {
62     adios2_false = 0,
63     adios2_true = 1,
64 } adios2_bool;
65 
66 typedef enum
67 {
68     adios2_debug_mode_off = 0,
69     adios2_debug_mode_on = 1,
70 } adios2_debug_mode;
71 
72 typedef enum
73 {
74     adios2_constant_dims_false = 0,
75     adios2_constant_dims_true = 1,
76 } adios2_constant_dims;
77 
78 typedef enum
79 {
80     adios2_advance_step_false = 0,
81     adios2_advance_step_true = 1,
82 } adios2_advance_step;
83 
84 typedef enum
85 {
86     adios2_type_unknown = -1,
87 
88     adios2_type_string = 0,
89     adios2_type_float = 1,
90     adios2_type_double = 2,
91     adios2_type_float_complex = 3,
92     adios2_type_double_complex = 4,
93 
94     adios2_type_int8_t = 5,
95     adios2_type_int16_t = 6,
96     adios2_type_int32_t = 7,
97     adios2_type_int64_t = 8,
98 
99     adios2_type_uint8_t = 9,
100     adios2_type_uint16_t = 10,
101     adios2_type_uint32_t = 11,
102     adios2_type_uint64_t = 12,
103     adios2_type_long_double = 13 // junmin added
104 } adios2_type;
105 
106 typedef enum
107 {
108     adios2_mode_undefined = 0,
109     adios2_mode_write = 1,
110     adios2_mode_read = 2,
111     adios2_mode_append = 3,
112 
113     adios2_mode_deferred = 4,
114     adios2_mode_sync = 5
115 } adios2_mode;
116 
117 typedef enum
118 {
119     adios2_step_mode_append = 0,
120     adios2_step_mode_update = 1,
121     adios2_step_mode_read = 2,
122 } adios2_step_mode;
123 
124 typedef enum
125 {
126     adios2_step_status_other_error = -1,
127     adios2_step_status_ok = 0,
128     adios2_step_status_not_ready = 1,
129     adios2_step_status_end_of_stream = 2
130 } adios2_step_status;
131 
132 typedef enum
133 {
134     adios2_shapeid_unknown = -1,
135     adios2_shapeid_global_value = 0,
136     adios2_shapeid_global_array = 1,
137     adios2_shapeid_joined_array = 2,
138     adios2_shapeid_local_value = 3,
139     adios2_shapeid_local_array = 4
140 } adios2_shapeid;
141 
142 static const size_t adios2_string_array_element_max_size = 4096;
143 
144 static const uint64_t adios2_local_value_dim = ULLONG_MAX - 2;
145 
146 #ifdef __cplusplus
147 } // end extern C
148 #endif
149 
150 #endif /* ADIOS2_BINDINGS_C_ADIOS2_C_TYPES_H_ */
151