ADTF  3.18.2
ddl_capi.h
Go to the documentation of this file.
1 
15 #ifndef DEV_ESSENTIAL_DDL_CAPI_H_INCLUDED_
16 #define DEV_ESSENTIAL_DDL_CAPI_H_INCLUDED_
17 
19 
20 #include <stddef.h>
21 #include <stdint.h>
22 
23 #ifndef __cplusplus
24 #include <stdbool.h>
25 #else
26 extern "C" {
27 #endif
28 
34 typedef void* DDL_CAPI_Handle_T;
35 
42 
46 typedef enum {
50 
54 typedef enum {
58 } type_t;
59 
60 //---- helper functions -----
67 A_UTIL_DLL_EXPORT int32_t ddl_capi_string_free(char** const memory);
68 
79  size_t count,
80  char*** const memory);
81 
89 
97 
98 //---- functions to parse / handle a ddl -----
106 
114 
123 
132 
140 
151  size_t* const count,
152  char*** const struct_names);
153 
163  const char* name,
164  size_t* const alignment);
165 
177  const char* name,
178  size_t* const count,
179  char*** const struct_elements);
180 
199  const char* struct_name,
200  const char* element_name,
201  char** const type_name,
202  type_t* const typeOfType,
203  size_t* const arraysize,
204  size_t* const bytepos,
205  size_t* const bitpos,
206  size_t* const alignment,
207  size_t* const byteorder);
208 
221  const char* type_name,
222  bool* const predefined,
223  size_t* const numbits,
224  size_t* const arraysize);
225 
242  const char* enum_name,
243  char** const type,
244  bool* const predefined,
245  size_t* const count,
246  char*** const entry_names,
247  char*** const entry_values);
248 
249 //---- functions to modify ddl -----
259  const char* type,
260  char** const xml);
261 
262 //---- functions to code / decode data -----
271 A_UTIL_DLL_EXPORT int32_t
273  const char* struct_name,
274  const DDL_CAPI_DataRepresentation representation,
275  size_t* const data_size);
276 
290  const char* struct_name,
291  void* const data,
292  const size_t data_size,
293  const DDL_CAPI_DataRepresentation representation,
294  DDL_CAPI_Codec_Handle_T* const codec);
295 
304 
313  const char* element,
314  size_t* const index);
315 
326  const size_t index,
327  const void* data);
328 
337  const char* element,
338  const void* data);
339 
348  const char* substruct,
349  size_t* const index);
350 
361  const size_t index,
362  const void* data,
363  const size_t data_size);
364 
375  const char* substruct,
376  const void* data,
377  const size_t data_size);
378 
387  const char* array,
388  size_t* const index);
389 
398  const char* array,
399  size_t* const data_size);
400 
413  const size_t index,
414  const void* data,
415  const size_t data_size);
416 
429  const char* array,
430  const void* data,
431  const size_t data_size);
432 
442  size_t index,
443  void* const data);
444 
454  const char* element,
455  void* const data);
456 
469  const size_t index,
470  void* const data,
471  const size_t data_size);
472 
485  const char* substruct,
486  void* const data,
487  const size_t data_size);
488 
501  const size_t index,
502  void* const data,
503  const size_t size);
504 
517  const char* array,
518  void* const data,
519  const size_t size);
520 
528  const DDL_CAPI_Codec_Handle_T source);
529 
530 #ifdef __cplusplus
531 } /* extern "C" */
532 #endif
533 
534 #endif // DEV_ESSENTIAL_DDL_CAPI_H_INCLUDED_
A_UTIL_DLL_EXPORT int32_t ddl_capi_struct_buffer_size(const DDL_CAPI_Handle_T ddl, const char *struct_name, const DDL_CAPI_DataRepresentation representation, size_t *const data_size)
Returns the data_size of struct_name in the specified representation.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_element_byIndex(const DDL_CAPI_Codec_Handle_T codec, size_t index, void *const data)
Gets the data of the element specified by index.
void * DDL_CAPI_Codec_Handle_T
A handle for encoding/decoding a specific struct.
Definition: ddl_capi.h:41
A_UTIL_DLL_EXPORT int32_t ddl_capi_struct_elements(const DDL_CAPI_Handle_T ddl, const char *name, size_t *const count, char ***const struct_elements)
Retrieve all struct_elements names for a given struct name.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_array_byIndex(const DDL_CAPI_Codec_Handle_T codec, const size_t index, void *const data, const size_t size)
Copies the array specified by index into data in the format and representation specified by codec.
A_UTIL_DLL_EXPORT int32_t ddl_capi_ddl_tostring(const DDL_CAPI_Handle_T ddl, char **const xml)
Returns the xml string for a ddl handle.
A_UTIL_DLL_EXPORT int32_t ddl_capi_ddl_tofile(const DDL_CAPI_Handle_T ddl, const char *path)
Saves a ddl at the given file path.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_substruct_byIndex(const DDL_CAPI_Codec_Handle_T codec, const size_t index, void *const data, const size_t data_size)
Copies the substruct specified by index into data in the format and representation specified by codec...
A_UTIL_DLL_EXPORT int32_t ddl_capi_stringarray_free(const DDL_CAPI_Handle_T ddl, size_t count, char ***const memory)
Frees a string array at memory.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_substruct_index(const DDL_CAPI_Codec_Handle_T codec, const char *substruct, size_t *const index)
Gets the index of the specified substruct.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_array_index(const DDL_CAPI_Codec_Handle_T codec, const char *array, size_t *const index)
Gets the index of the specified array.
A_UTIL_DLL_EXPORT int32_t ddl_capi_enum_data(const DDL_CAPI_Handle_T ddl, const char *enum_name, char **const type, bool *const predefined, size_t *const count, char ***const entry_names, char ***const entry_values)
Retrieve data for a given enum enum_name.
DDL_CAPI_DataRepresentation
Enum type for the representation of the input data.
Definition: ddl_capi.h:46
@ DDL_CAPI_Data_deserialized
value for deserialized representation
Definition: ddl_capi.h:48
@ DDL_CAPI_Data_serialized
value for serialized representation
Definition: ddl_capi.h:47
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_element_byName(const DDL_CAPI_Codec_Handle_T codec, const char *element, void *const data)
Gets the data of element.
A_UTIL_DLL_EXPORT const char * ddl_capi_last_error(const DDL_CAPI_Handle_T ddl)
Returns the last error for the given ddl.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_set_element_byIndex(const DDL_CAPI_Codec_Handle_T codec, const size_t index, const void *data)
Sets the data of the element specified by index.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_element_index(const DDL_CAPI_Codec_Handle_T codec, const char *element, size_t *const index)
Gets the index of the specified element.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_free(DDL_CAPI_Codec_Handle_T *const codec)
Frees a codec handle.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_substruct_byName(const DDL_CAPI_Codec_Handle_T codec, const char *substruct, void *const data, const size_t data_size)
Copies the substruct into data in the format and representation specified by codec.
A_UTIL_DLL_EXPORT const char * ddl_capi_last_codecerror(const DDL_CAPI_Codec_Handle_T ddl)
Returns the last error for the given codec.
A_UTIL_DLL_EXPORT int32_t ddl_capi_element_data(const DDL_CAPI_Handle_T ddl, const char *struct_name, const char *element_name, char **const type_name, type_t *const typeOfType, size_t *const arraysize, size_t *const bytepos, size_t *const bitpos, size_t *const alignment, size_t *const byteorder)
Retrieve data for a given element element_name of struct struct_name.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_create(const DDL_CAPI_Handle_T ddl, const char *struct_name, void *const data, const size_t data_size, const DDL_CAPI_DataRepresentation representation, DDL_CAPI_Codec_Handle_T *const codec)
Creates a codec for the given struct_name.
A_UTIL_DLL_EXPORT int32_t ddl_capi_resolve_type(const DDL_CAPI_Handle_T ddl, const char *type, char **const xml)
Retrieve a minimalistic DDL that only resolves the specified type.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_set_element_byName(const DDL_CAPI_Codec_Handle_T codec, const char *element, const void *data)
Sets the data of element.
A_UTIL_DLL_EXPORT int32_t ddl_capi_structs(const DDL_CAPI_Handle_T ddl, size_t *const count, char ***const struct_names)
Retrieve all structs_names defined in the ddl.
A_UTIL_DLL_EXPORT int32_t ddl_capi_type_data(const DDL_CAPI_Handle_T ddl, const char *type_name, bool *const predefined, size_t *const numbits, size_t *const arraysize)
Retrieve data for a given type type_name.
A_UTIL_DLL_EXPORT int32_t ddl_capi_free(DDL_CAPI_Handle_T *const ddl)
Frees a ddl handle.
A_UTIL_DLL_EXPORT int32_t ddl_capi_load_from_file(const char *path, DDL_CAPI_Handle_T *const ddl)
Loads a ddl from a file with the given path.
A_UTIL_DLL_EXPORT int32_t ddl_capi_struct_data(const DDL_CAPI_Handle_T ddl, const char *name, size_t *const alignment)
Retrieve the alignment for a given struct name.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_set_substruct_byIndex(const DDL_CAPI_Codec_Handle_T codec, const size_t index, const void *data, const size_t data_size)
Sets the data of the sub-struct specified by index.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_set_array_byIndex(const DDL_CAPI_Codec_Handle_T codec, const size_t index, const void *data, const size_t data_size)
Stores data into the array specified by index.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_set_array_byName(const DDL_CAPI_Codec_Handle_T codec, const char *array, const void *data, const size_t data_size)
Writes data to the location of array.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_transform(const DDL_CAPI_Codec_Handle_T dest, const DDL_CAPI_Codec_Handle_T source)
Writes all elements from source into destination.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_array_size(const DDL_CAPI_Codec_Handle_T codec, const char *array, size_t *const data_size)
Gets the size of the specified array.
type_t
Enum type for the representation of struct element data type.
Definition: ddl_capi.h:54
@ enum_type
value for enum type
Definition: ddl_capi.h:56
@ data_type
value for data type
Definition: ddl_capi.h:55
@ struct_type
value for struct type
Definition: ddl_capi.h:57
void * DDL_CAPI_Handle_T
A handle for a ddl description.
Definition: ddl_capi.h:34
A_UTIL_DLL_EXPORT int32_t ddl_capi_string_free(char **const memory)
Frees a string at memory.
A_UTIL_DLL_EXPORT int32_t ddl_capi_load_from_string(const char *xml, DDL_CAPI_Handle_T *const ddl)
Loads a ddl from the xml string.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_set_substruct_byName(const DDL_CAPI_Codec_Handle_T codec, const char *substruct, const void *data, const size_t data_size)
Sets the data of substruct.
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_get_array_byName(const DDL_CAPI_Codec_Handle_T codec, const char *array, void *const data, const size_t size)
Copies the array into data in the format and representation specified by codec.
Definition of preprocessor macro A_UTIL_DLL_EXPORT.
#define A_UTIL_DLL_EXPORT
Defines standard exporting rules for symbol visibility.
Definition: dll_export.h:40