Accelerator Independent Data Access / PVAccess 2.0
AIDA-PVA is the latest version of the AIDA framework. Built on top of EPICS 7 it enables client applications to programmatically access and manage any device or database on the SLAC Network using simple channel names.
Loading...
Searching...
No Matches
aida_pva_types.h
Go to the documentation of this file.
1/** @file
2 * @brief The Header File for the type enumerations, unions, and typedefs.
3 * **CMS**=C_INC
4 */
5#ifndef aida_pva_types_h
6#define aida_pva_types_h
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#include <jni.h>
12#include <stdbool.h>
13#include "aida_pva_json.h"
14#include "aida_pva.h"
15
16/**
17 * The definition of Aida Types.
18 * Defines the permissible types of fields. This enumerated type defines all the possible AIDA-PVA types and classes.
19 */
20typedef enum
21{
22 AIDA_NO_TYPE, ///< Used to indicate that no type was provided as an argument
23 AIDA_VOID_TYPE, ///< Used when no return value is to be returned from a channel
24
25 AIDA_BOOLEAN_TYPE, ///< Represents a boolean
26 AIDA_BYTE_TYPE, ///< Represents a byte
27 AIDA_SHORT_TYPE, ///< Represents a short
28 AIDA_INTEGER_TYPE, ///< Represents an integer
29 AIDA_LONG_TYPE, ///< Represents a long
30 AIDA_FLOAT_TYPE, ///< Represents a float
31 AIDA_DOUBLE_TYPE, ///< Represents a double
32 AIDA_STRING_TYPE, ///< Represents a string
33 AIDA_BOOLEAN_ARRAY_TYPE, ///< Represents a boolean array
34 AIDA_BYTE_ARRAY_TYPE, ///< Represents a byte array
35 AIDA_SHORT_ARRAY_TYPE, ///< Represents a short array
36 AIDA_INTEGER_ARRAY_TYPE, ///< Represents an integer array
37 AIDA_LONG_ARRAY_TYPE, ///< Represents a long array
38 AIDA_FLOAT_ARRAY_TYPE, ///< Represents a float array
39 AIDA_DOUBLE_ARRAY_TYPE, ///< Represents a double array
40 AIDA_STRING_ARRAY_TYPE, ///< Represents a string array
41 AIDA_TABLE_TYPE, ///< Represents a table
42 AIDA_JSON_TYPE, ///< Argument was provided as JSON text
43
44 ///< Internal use only: DO NOT USE IN SERVICE IMPLEMENTATIONS!!
45 AIDA_UNSIGNED_SHORT_TYPE, ///< Represents an internal type of unsigned short
46 AIDA_UNSIGNED_INTEGER_TYPE, ///< Represents an internal type of unsigned integer
47 AIDA_UNSIGNED_LONG_TYPE, ///< Represents an internal type of unsigned long
48 AIDA_UNSIGNED_SHORT_ARRAY_TYPE, ///< Represents an internal type of unsigned short array
49 AIDA_UNSIGNED_INTEGER_ARRAY_TYPE, ///< Represents an internal type of unsigned integer array
50 AIDA_UNSIGNED_LONG_ARRAY_TYPE ///< Represents an internal type of unsigned long array
52
53/**
54 * This union stores the value part of a FloatingPointValue.
55 * The `floatValue` member stores the float.
56 * The `doubleValue` member stores the double.
57 */
58typedef union
59{
60 float floatValue; ///< The single precision floating point value
61 double doubleValue; ///< The double precision floating point value
63
64/**
65 * Represents a floating point number.
66 * This can be either a single or double precision value.
67 * The `isFloat` flag
68 * is set to `true` if this is a single precision value and the value can be accessed
69 * via the `value.floatValue`.
70 * If the `isFloat` flag
71 * is set to `false` then this is a double precision value and the value can be accessed
72 * via the `value.doubleValue`.
73 *
74 */
75typedef struct
76{
77 char* path; ///< The string path from the root of the json structure in which this value is found
78 bool isFloat; ///< Determines whether the value is a single or double precision floating point value
79 FloatOrDoubleValue value; ///< The floating point value
81
82/**
83 * A single request argument.
84 * This is passed to an API endpoint in an Arguments structure.
85 * It contains a `name` `value` pair representing a single argument that was included in the
86 * PVAccess request. The `value` is a string.
87 */
88typedef struct
89{
90 char* name; ///< The name of the argument
91 char* value; ///< The string value of the argument
92} Argument;
93
94/**
95 * This union stores either the string or the json_value of a Value.
96 * An Value can be a string or can be a json structure. If json is detected it
97 * is automatically parsed and placed in the ValueContents union under the `jsonValue`
98 * key.
99 */
100typedef union
101{
102 char* stringValue; ///< The string value of this Value if the type is AIDA_STRING_TYPE
103 json_value* jsonValue; ///< The parsed json_value of this Value if the type is AIDA_JSON_TYPE
105
106/**
107 * This special type represents a Value.
108 * A Value is a special type that is used to pass complex data to the Native Channel Provider.
109 * The value member, of type ValueContents, can hold either a simple string or a json_value.
110 */
111typedef struct
112{
113 Type type; ///< AIDA_STRING_TYPE or AIDA_JSON_TYPE
114 ValueContents value; ///< The value's contents, either a string or parsed json
115} Value;
116
117/**
118 * An Arguments structure stores all of the arguments passed from the request to the Native Channel Provider.
119 * It contains a count of the total number of arguments - #argumentCount - and a pointer
120 * to that many {@link Argument}s - #arguments.
121 * {@link Argument}s from the client are stored as strings, and converted to whatever type is required whenever
122 * they are used. But floating points are different because they require more precision and significance
123 * than string representations can give. For this reason floating points are additionally passed in the
124 * FloatingPointValue array - #floatingPointValues - where #floatingPointValuesCount is the count of how many of them there are.
125 */
126typedef struct
127{
128 int argumentCount; ///< The number of arguments sent with this request
129 int floatingPointValuesCount; ///< The number of floating point numbers in the arguments of this request
130 Argument* arguments; ///< The array of Arguments
131 FloatingPointValue* floatingPointValues; ///< The array of FloatingPointValue
132} Arguments;
133
134/**
135 * Table structure.
136 * This structure holds everything that a Native Channel Provider needs for returning a Table
137 * to the client. A table is a set of homogeneously sized vectors representing columns of data.
138 * The configuration of the table (labels, names, descriptions, etc) is handled outside of the
139 * Native Channel Provider, so all the implementation needs to do is provide the raw data for the
140 * columns.
141 * @see
142 * Implementors don't manipulate these structures directly as [AIDA-PVA Module](../../../docs/4_0_AIDA-PVA_Module.md) provides
143 * table manipulation functions:
144 * - tableCreate()
145 * - tableAddColumn()
146 * - tableAddSingleRowFloatColumn()
147 * - tableAddSingleRowLongColumn()
148 * - tableAddSingleRowBooleanColumn()
149 * - tableAddSingleRowByteColumn()
150 * - tableAddSingleRowShortColumn()
151 * - tableAddSingleRowIntegerColumn()
152 * - tableAddSingleRowDoubleColumn()
153 * - tableAddSingleRowStringColumn()
154 * - tableAddFixedWidthStringColumn()
155 * - tableAddStringColumn()
156 */
157typedef struct
158{
159 int columnCount; ///< number of columns in table
160 int rowCount; ///< number of rows in table
161 Type* types; ///< the scalar type of each column, one of BOOLEAN, BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE, or STRING
162 void** ppData; ///< the data. an array of [rows][columns]
163 char** ppFields; ///< the overridden field names. if null, not overridden. If not null then array of pointers to allocated strings
164 char** ppLabels; ///< the overridden label names. if null, not overridden. If not null then array of pointers to allocated strings
165 int _currentColumn; ///< For internal use by addColumn() etc
166 int _currentField; ///< For internal use by addField() etc
167 int _currentLabel; ///< For internal use by addLabel() etc
168} Table;
169
170/**
171 * An array of data.
172 * This is used to return an array of data to the client.
173 *
174 * When you are implementing an API that returns an array you need to fill an Array structure appropriately.
175 * Fill the `count` member with the number of elements in the array. Allocate memory for those items
176 * and set the `items` member to that pointer. The framework will automatically free up the
177 * `items` pointer memory.
178 */
179typedef struct
180{
181 int count; ///< The number of items in this array
182 void* items; ///< The items in this array
183} Array;
184
185/**
186 * An array of string data.
187 * This is used to return an array of string data to the client.
188 *
189 * When you are implementing an API that returns an array of strings you need to fill an StringArray
190 * structure appropriately.
191 * Fill the `count` member with the number of elements in the array. Allocate memory for those items
192 * and set the `items` member to that pointer. The `items` will be a `char **`
193 * meaning that it will be an array of character pointers, and each of the strings MUST be allocated
194 * as well. This is because the framework will automatically free up strings for you as well as the
195 * `items` pointer itself.
196 */
197typedef struct
198{
199 int count; ///< The number of items in this array
200 char** items; ///< The items in this array - pointers to the strings you allocate
202
203#ifdef __cplusplus
204}
205#endif
206#endif
207
The Header File for the AIDA-PVA Module functions.
Type
The definition of Aida Types.
@ AIDA_BYTE_TYPE
Represents a byte.
@ AIDA_SHORT_ARRAY_TYPE
Represents a short array.
@ AIDA_VOID_TYPE
Used when no return value is to be returned from a channel.
@ AIDA_UNSIGNED_INTEGER_TYPE
Represents an internal type of unsigned integer.
@ AIDA_UNSIGNED_LONG_ARRAY_TYPE
Represents an internal type of unsigned long array.
@ AIDA_UNSIGNED_SHORT_ARRAY_TYPE
Represents an internal type of unsigned short array.
@ AIDA_FLOAT_ARRAY_TYPE
Represents a float array.
@ AIDA_UNSIGNED_LONG_TYPE
Represents an internal type of unsigned long.
@ AIDA_BOOLEAN_ARRAY_TYPE
Represents a boolean array.
@ AIDA_INTEGER_ARRAY_TYPE
Represents an integer array.
@ AIDA_JSON_TYPE
Argument was provided as JSON text.
@ AIDA_STRING_TYPE
Represents a string.
@ AIDA_BYTE_ARRAY_TYPE
Represents a byte array.
@ AIDA_FLOAT_TYPE
Represents a float.
@ AIDA_INTEGER_TYPE
Represents an integer.
@ AIDA_SHORT_TYPE
Represents a short.
@ AIDA_LONG_ARRAY_TYPE
Represents a long array.
@ AIDA_STRING_ARRAY_TYPE
Represents a string array.
@ AIDA_LONG_TYPE
Represents a long.
@ AIDA_BOOLEAN_TYPE
Represents a boolean.
@ AIDA_UNSIGNED_INTEGER_ARRAY_TYPE
Represents an internal type of unsigned integer array.
@ AIDA_UNSIGNED_SHORT_TYPE
Represents an internal type of unsigned short.
@ AIDA_NO_TYPE
Used to indicate that no type was provided as an argument.
@ AIDA_DOUBLE_TYPE
Represents a double.
@ AIDA_DOUBLE_ARRAY_TYPE
Represents a double array.
@ AIDA_TABLE_TYPE
Represents a table.
A single request argument.
char * value
The string value of the argument.
char * name
The name of the argument.
An Arguments structure stores all of the arguments passed from the request to the Native Channel Prov...
int argumentCount
The number of arguments sent with this request.
int floatingPointValuesCount
The number of floating point numbers in the arguments of this request.
Argument * arguments
The array of Arguments.
FloatingPointValue * floatingPointValues
The array of FloatingPointValue.
An array of data.
void * items
The items in this array.
int count
The number of items in this array.
Represents a floating point number.
char * path
The string path from the root of the json structure in which this value is found.
bool isFloat
Determines whether the value is a single or double precision floating point value.
FloatOrDoubleValue value
The floating point value.
An array of string data.
int count
The number of items in this array.
char ** items
The items in this array - pointers to the strings you allocate.
Table structure.
int columnCount
number of columns in table
char ** ppLabels
the overridden label names. if null, not overridden. If not null then array of pointers to allocated ...
int _currentLabel
For internal use by addLabel() etc.
char ** ppFields
the overridden field names. if null, not overridden. If not null then array of pointers to allocated ...
Type * types
the scalar type of each column, one of BOOLEAN, BYTE, SHORT, INTEGER, LONG, FLOAT,...
void ** ppData
the data. an array of [rows][columns]
int _currentField
For internal use by addField() etc.
int rowCount
number of rows in table
int _currentColumn
For internal use by addColumn() etc.
This special type represents a Value.
ValueContents value
The value's contents, either a string or parsed json.
Type type
AIDA_STRING_TYPE or AIDA_JSON_TYPE.
This union stores the value part of a FloatingPointValue.
double doubleValue
The double precision floating point value.
float floatValue
The single precision floating point value.
This union stores either the string or the json_value of a Value.
json_value * jsonValue
The parsed json_value of this Value if the type is AIDA_JSON_TYPE.
char * stringValue
The string value of this Value if the type is AIDA_STRING_TYPE.