Closed davidjwbbc closed 8 months ago
The addition of the "_VAL" into the values of enums is to cope with the DataAggregationFunctionType enum which contains a "NULL" value in the enum which would clash with the default NULL value added by the openapi-generator template. The new template gives:
typedef enum {
dcaf_api_data_aggregation_function_type_NULL = 0,
dcaf_api_data_aggregation_function_type_VAL_NULL,
dcaf_api_data_aggregation_function_type_VAL_COUNT,
dcaf_api_data_aggregation_function_type_VAL_MEAN,
dcaf_api_data_aggregation_function_type_VAL_MAXIMUM,
dcaf_api_data_aggregation_function_type_VAL_MINIMUM,
dcaf_api_data_aggregation_function_type_VAL_SUM
} dcaf_api_data_aggregation_function_type_e;
This now have a different value for the "NULL" value and the NULL value.
Sorry. Coming a bit late to the party.
@davidjwbbc: I think these templates should live at the top level of the repository rather than under 5gms/
since they are shared with projects that aren't necessarily to do with 5G Media Streaming.
We should promote this move on Friday's call to ensure that everyone is aware.
The 5GMS Application Function (rt-5gms-application-function) contains a set of templates for converting the OpenAPI YAML APIs into C structures and enums along with relevant functions to aid in manipulation of these structures or enums.
The work on the Data Collection library and AF will also need to use these templates.
This PR covers the rt-common-shared side of the move of the openapi-generator templates from the 5GMS AF to the rt-common-shared repository for reuse.
This move also includes an enhancement to the conversion of enum types as detailed in the table below.
{enum_name}_{VALUE_NAME}
{enum_name}_VAL_{VALUE_NAME}
{enum_name}_FromString()
function{enum_name}_NULL
for unrecognised strings or the NULL pointer{enum_name}_NULL
if the string was a NULL pointer, and returns -1 for unrecognised strings{enum_name}_ToString()
function{enum_name}_{value}
(includingNULL
){enum_name}_NULL
{enum_name}_VAL_{value}