ADTF  3.18.2
ddl_capi.h File Reference

Public C-API for Data Description Language. More...

Go to the source code of this file.

Typedefs

typedef void * DDL_CAPI_Handle_T
 A handle for a ddl description. More...
 
typedef void * DDL_CAPI_Codec_Handle_T
 A handle for encoding/decoding a specific struct. More...
 

Enumerations

enum  DDL_CAPI_DataRepresentation { DDL_CAPI_Data_serialized = 0 , DDL_CAPI_Data_deserialized }
 Enum type for the representation of the input data. More...
 
enum  type_t { data_type , enum_type , struct_type }
 Enum type for the representation of struct element data type. More...
 

Functions

A_UTIL_DLL_EXPORT int32_t ddl_capi_string_free (char **const memory)
 Frees a string at memory. More...
 
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. More...
 
A_UTIL_DLL_EXPORT const char * ddl_capi_last_error (const DDL_CAPI_Handle_T ddl)
 Returns the last error for the given ddl. More...
 
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. More...
 
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. More...
 
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. More...
 
A_UTIL_DLL_EXPORT int32_t ddl_capi_free (DDL_CAPI_Handle_T *const ddl)
 Frees a ddl handle. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_free (DDL_CAPI_Codec_Handle_T *const codec)
 Frees a codec handle. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

Public C-API for Data Description Language.

Definition in file ddl_capi.h.

Typedef Documentation

◆ DDL_CAPI_Codec_Handle_T

typedef void* DDL_CAPI_Codec_Handle_T

A handle for encoding/decoding a specific struct.

It is optained by calling ddl_capi_codec_create and must be freed using ddl_capi_codec_free.

Definition at line 41 of file ddl_capi.h.

◆ DDL_CAPI_Handle_T

typedef void* DDL_CAPI_Handle_T

A handle for a ddl description.

It is optained by calling ddl_capi_load_from_file or ddl_capi_load_from_string and must be freed using ddl_capi_free.

Definition at line 34 of file ddl_capi.h.

Enumeration Type Documentation

◆ DDL_CAPI_DataRepresentation

Enum type for the representation of the input data.

Enumerator
DDL_CAPI_Data_serialized 

value for serialized representation

DDL_CAPI_Data_deserialized 

value for deserialized representation

Definition at line 46 of file ddl_capi.h.

◆ type_t

enum type_t

Enum type for the representation of struct element data type.

Enumerator
data_type 

value for data type

enum_type 

value for enum type

struct_type 

value for struct type

Definition at line 54 of file ddl_capi.h.

Function Documentation

◆ ddl_capi_codec_create()

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.

The returned handle codec must be freed with ddl_capi_codec_free. data must be valid until the codec handle is freed. data_size must be large enough to hold the struct data (

See also
ddl_capi_struct_buffer_size)
Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]struct_namename of the struct to en-/decode
[in]datapointer to an allocated memory region of size data_size to use
[in]data_sizesize of the memory region
[in]representationrepresentation of the data
[out]codeca handle of type DDL_CAPI_Codec_Handle
Returns
0 on success.

◆ ddl_capi_codec_free()

A_UTIL_DLL_EXPORT int32_t ddl_capi_codec_free ( DDL_CAPI_Codec_Handle_T *const  codec)

Frees a codec handle.

Must be called after a successful call to function ddl_capi_codec_create to clean up memory. Successful means that ddl_capi_codec_create returns a valid pointer even if return is not 0.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
Returns
0 on success.

◆ ddl_capi_codec_get_array_byIndex()

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.

data_size bytes are copied into data which must be big enough. Additionally data_size must be the size of the array in the format and representation specified by codec.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]indexindex specifying the array
[in]datapointer to the memory where the array data should be stored
[in]sizesize of the array in bytes
Returns
0 on success.

◆ ddl_capi_codec_get_array_byName()

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.

data_size bytes are copied into data which must be big enough. Additionally data_size must be the size of the array in the format and representation specified by codec.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]arraypath to the array relative to the codec
[in]datapointer to the memory where the array data should be stored
[in]sizesize of the array in bytes
Returns
0 on success.

◆ ddl_capi_codec_get_array_index()

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.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]arraypath to the array relative to the codec
[out]indexindex of the array
Returns
0 on success.

◆ ddl_capi_codec_get_array_size()

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.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]arraypath to the array relative to the codec
[out]data_sizethe byte size of the given array
Returns
0 on success.

◆ ddl_capi_codec_get_element_byIndex()

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.

data must be big enough to store the element.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]indexindex specifying the elemenet
[in]datapointer to the memory where the element data should be stored
Returns
0 on success.

◆ ddl_capi_codec_get_element_byName()

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.

data must be big enough to store the element.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]elementpath to the element relative to the codec
[in]datapointer to the memory where the element data should be stored
Returns
0 on success.

◆ ddl_capi_codec_get_element_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.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]elementpath to the element relative to the codec
[out]indexindex of that element
Returns
0 on success.

◆ ddl_capi_codec_get_substruct_byIndex()

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.

data_size bytes are copied into data which must be big enough. Additionally data_size must be the size of the substruct in the format and representation specified by codec.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]indexindex specifying the sub-struct
[in]datapointer to the memory where the sub-struct data should be stored
[in]data_sizesize of the sub-struct in bytes
Returns
0 on success.

◆ ddl_capi_codec_get_substruct_byName()

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.

data_size bytes are copied into data which must be big enough. Additionally data_size must be the size of the substruct in the format and representation specified by codec.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]substructpath to the sub-struct relative to the codec
[in]datapointer to the memory where the sub-struct data should be stored
[in]data_sizesize of the sub-struct in bytes
Returns
0 on success.

◆ ddl_capi_codec_get_substruct_index()

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.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]substructpath to the sub-struct relative to the codec
[out]indexindex of the sub-struct
Returns
0 on success.

◆ ddl_capi_codec_set_array_byIndex()

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.

data must be in the format and representation specified by codec. Additionally data_size must be the size of the array in the format and representation specified by codec.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]indexindex of the array
[in]datapointer to the data the array should be set to
[in]data_sizesize of data in bytes
Returns
0 on success.

◆ ddl_capi_codec_set_array_byName()

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.

data must be in the format and representation specified by codec. Additionally data_size must be the size of the array in the format and representation specified by codec.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]arraypath to the array relative to the codec
[in]datapointer to the data the array should be set to
[in]data_sizesize of data in bytes
Returns
0 on success.

◆ ddl_capi_codec_set_element_byIndex()

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.

data must be a pointer to memory with at least the same size as the element specified by the index.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]indexindex of the element
[in]datapointer to the data the element should be set to
Returns
0 on success.

◆ ddl_capi_codec_set_element_byName()

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.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]elementpath to the element relative to the codec
[in]datapointer to the data the element should be set to
Returns
0 on success.

◆ ddl_capi_codec_set_substruct_byIndex()

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.

data must be in the format and representation specified by codec.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]indexindex of the sub-struct
[in]datapointer to the data the sub-struct should be set to
[in]data_sizesize of data in byte
Returns
0 on success.

◆ ddl_capi_codec_set_substruct_byName()

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.

data must be in the format and representation specified by codec.

Parameters
[in]codeca handle of type DDL_CAPI_Codec_Handle
[in]substructpath to the sub-struct relative to the codec
[in]datapointer to the data the sub-struct should be set to
[in]data_sizesize of data in byte
Returns
0 on success.

◆ ddl_capi_codec_transform()

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.

Parameters
[in]desta handle of type DDL_CAPI_Codec_Handle from which the data is read
[in]sourcea handle of type DDL_CAPI_Codec_Handle to which the data is written
Returns
0 on success.

◆ ddl_capi_ddl_tofile()

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.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]pathpath to a ddl file
Returns
0 on success.

◆ ddl_capi_ddl_tostring()

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.

The returned string xml needs to be cleaned up using ddl_capi_string_free after use.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[out]xmlxml-string containig the ddl description
Returns
0 on success.

◆ ddl_capi_element_data()

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.

For the documentation of the data please have a look in the ddl documentation. If arraysize is negative then the array is dynamic. The returned string type needs to be cleaned up using ddl_capi_string_free after use.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]struct_namename of the struct
[in]element_namename of the struct element
[out]type_namestring containing the type name of the element
[out]typeOfTypethe underlaying type of element type_name
[out]arraysizearray size of the element
[out]byteposthe byte position of the element
[out]bitposthe bit position of the element
[out]alignmentthe alignment of the element
[out]byteorderthe byte order of the element
Returns
0 on success.

◆ ddl_capi_enum_data()

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.

For the documentation of the data please have a look in the ddl documentation. The returned string type needs to be cleaned up using ddl_capi_string_free after use. The returned string arrays entry_names and entry_values of size count need to be cleaned up using ddl_capi_stringarray_free after use.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]enum_nameenum name
[out]typename of the underlying type
[out]predefinedwhether the enum is predefined
[out]countnumber of enum elements
[out]entry_namesa string array containing the names of all enum elements
[out]entry_valuesa string array containing the values of all enum elements
Returns
0 on success.

◆ ddl_capi_free()

A_UTIL_DLL_EXPORT int32_t ddl_capi_free ( DDL_CAPI_Handle_T *const  ddl)

Frees a ddl handle.

Must be called after a successful call to function ddl_capi_load_from_XXX to clean up memory. Successful means that ddl_capi_load_from_XXX returns a valid pointer even if return is not 0.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
Returns
0 on success.

◆ ddl_capi_last_codecerror()

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.

The returned string is valid until the next function call.

Parameters
[in]ddlhandle of type DDL_CAPI_Codec_Handle
Returns
a description of last occured error

◆ ddl_capi_last_error()

A_UTIL_DLL_EXPORT const char* ddl_capi_last_error ( const DDL_CAPI_Handle_T  ddl)

Returns the last error for the given ddl.

The returned string is valid until the next function call.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
Returns
a description of last occured error

◆ ddl_capi_load_from_file()

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.

Parameters
[in]pathpath to a ddl file
[out]ddlhandle of type DDL_CAPI_Handle
Returns
0 on success.

◆ ddl_capi_load_from_string()

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.

Parameters
[in]xmlxml-string with ddl
[out]ddlhandle of type DDL_CAPI_Handle
Returns
0 on success.

◆ ddl_capi_resolve_type()

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.

The returned string xml needs to be cleaned up using ddl_capi_string_free after use.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]typethe type that the new ddl resolves
[out]xmlan xml-string containing the new ddl
Returns
0 on success.

◆ ddl_capi_string_free()

A_UTIL_DLL_EXPORT int32_t ddl_capi_string_free ( char **const  memory)

Frees a string at memory.

Must be called after any call to a ddl c-api function that returns a string to clean up memory.

Parameters
[in]memorypointer to string in memory to be freed
Returns
0 on success.

◆ ddl_capi_stringarray_free()

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.

Must be called after any call to a ddl c-api function that returns a string array to clean up memory.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]countnumber of elements in string array
[in]memorypointer to array location in memory to be freed
Returns
0 on success.

◆ ddl_capi_struct_buffer_size()

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.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]struct_namename of the struct to en-/decode
[in]representationrepresentation of the data
[out]data_sizethe size of an instance of the struct in specified representation
Returns
0 on success.

◆ ddl_capi_struct_data()

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.

For the documentation of the data please have a look in the ddl documentation.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]namename of the struct
[out]alignmentthe alignment of the struct
Returns
0 on success.

◆ ddl_capi_struct_elements()

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.

The returned string array struct_elements needs to be cleaned up using ddl_capi_stringarray_free after use.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]namename of the struct
[out]countnumber of elements in the structs
[out]struct_elementsstring array containing all struct element names (fields)
Returns
0 on success.

◆ ddl_capi_structs()

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.

The returned string array struct_names needs to be cleaned up using ddl_capi_stringarray_free after use.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[out]countnumber of structs
[out]struct_namesa string array containing all struct names
Returns
0 on success.

◆ ddl_capi_type_data()

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.

arraysize is dynamic if negativ. For the documentation of the data please have a look in the ddl documentation.

Parameters
[in]ddlhandle of type DDL_CAPI_Handle
[in]type_nametype name
[out]predefinedwhether the type is predefined
[out]numbitsthe number of bits the type consists of
[out]arraysizethe array size of the type
Returns
0 on success.