17 #ifndef OSFI_C_INTERFACE
18 #define OSFI_C_INTERFACE 1
26 #if __STDC_VERSION__ >= 202311L
27 #define OSFI_NO_RETURN [[noreturn]]
28 #elif __STDC_VERSION__ >= 201112L
29 #define OSFI_NO_RETURN _Noreturn
31 #define OSFI_NO_RETURN
36 #if __STDC_VERSION__ >= 202311L
37 #define OSFI_DEPRECATED(reason) [[deprecated(reason)]]
39 #define OSFI_DEPRECATED(reason)
251 #define OSFI_STRTYPE struct {\
264 #define OSFI_VECTYPE(T) struct {\
284 #define OSFI_MATTYPE(T) struct {\
341 #if __STDC_VERSION__ >= 201112L
364 #define osfiConFmParamValue(dest, pr, param) \
366 int32_t*: osfiConFmParamValueInteger,\
367 double*: osfiConFmParamValueDouble,\
368 bool*: osfiConFmParamValueBoolean,\
369 osfi_timevalue_t*: osfiConFmParamValueTime,\
370 osfi_ownstr_t**: osfiConFmParamValueString,\
371 osfi_ownfile_t**: osfiConFmParamValueFile,\
372 osfi_vecInteger_t**: osfiConFmParamVectorInteger,\
373 osfi_vecDouble_t**: osfiConFmParamVectorDouble,\
374 osfi_vecBoolean_t**: osfiConFmParamVectorBoolean,\
375 osfi_vecTime_t**: osfiConFmParamVectorTime,\
376 osfi_vecString_t**: osfiConFmParamVectorString,\
377 osfi_vecFile_t**: osfiConFmParamVectorFile,\
378 osfi_matInteger_t**: osfiConFmParamMatrixInteger,\
379 osfi_matDouble_t**: osfiConFmParamMatrixDouble,\
380 osfi_matBoolean_t**: osfiConFmParamMatrixBoolean,\
381 osfi_matTime_t**: osfiConFmParamMatrixTime,\
382 osfi_matString_t**: osfiConFmParamMatrixString,\
383 osfi_matFile_t**: osfiConFmParamMatrixFile\
384 )((dest), (pr), (param))
407 #define osfiConFmParamArrayLeaf(dest, pr, param, depth, node) \
409 osfi_vecInteger_t**: osfiConFmParamArrayLeafInteger,\
410 osfi_vecDouble_t**: osfiConFmParamArrayLeafDouble,\
411 osfi_vecBoolean_t**: osfiConFmParamArrayLeafBoolean,\
412 osfi_vecTime_t**: osfiConFmParamArrayLeafTime,\
413 osfi_vecString_t**: osfiConFmParamArrayLeafString,\
414 osfi_vecFile_t**: osfiConFmParamArrayLeafFile\
415 )((dest), (pr), (param), (depth), (node))
549 #define OSFI_DECL_TYPED_GETTERS(Type, Tsc) \
550 bool osfiConFmParamValue##Type(Tsc* dest, osfi_paramreader_t* pr, const char* param); \
551 bool osfiConFmParamVector##Type(osfi_vec##Type##_t** dest, osfi_paramreader_t* pr, const char* param); \
552 bool osfiConFmParamMatrix##Type(osfi_mat##Type##_t** dest, osfi_paramreader_t* pr, const char* param); \
553 bool osfiConFmParamArrayLeaf##Type(osfi_vec##Type##_t** dest, osfi_paramreader_t* pr, \
554 const char* param, int depth, const int node[depth]);
556 OSFI_DECL_TYPED_GETTERS(Integer, int32_t)
557 OSFI_DECL_TYPED_GETTERS(Double,
double)
558 OSFI_DECL_TYPED_GETTERS(Boolean,
bool)
563 #undef OSFI_DECL_TYPED_GETTERS
584 #define MAX_LENGTH_FILE_NAME 255
606 OSFI_DEPRECATED("Modules with a single configuration file are deprecated.")
654 # define MAX_LENGTH_STRING 255
655 # define MAX_PARAMETER_FIELD_SIZE 255
656 # define MAX_PARAMETER_NAME_SIZE 255
657 # define MAX_PARAMETER_DESC_SIZE 255
713 OSFI_DEPRECATED(
"Use osfiConFMReadConfigFile() followed by osfiConFMValidateAgainst()")
820 const
char *paramName);
881 const
char *paramName,
int node[],
int depth);
985 int *columns, const
char *paramName);
997 const
char *paramName);
1009 const
char *paramName);
#define OSFI_DEPRECATED(reason)
Definition: OSFIC.h:39
#define OSFI_NO_RETURN
Definition: OSFIC.h:29
osfi_clp_args_t * osfiClpParseArgs(int argc, char *argv[])
Parse the command-line arguments provided to the module.
void osfiClpFree(osfi_clp_args_t *p)
Release a previously allocated result returned by osfiClpParseArgs().
struct osfi_clp_args osfi_clp_args_t
Result of parsing CLI arguments, contains the files of each type passed to the module.
struct osfi_clp_files osfi_clp_files_t
List of files of a specific type, allocated by osfiClpParseArgs().
bool osfiConFmParamExists(osfi_paramreader_t *pr, const char *param)
Finds a parameter in the given configuration file.
bool osfiConFmGetChildParams(osfi_vecString_t **out, osfi_paramreader_t *pr, const char *group)
Retrieves the path of all parameters that are children of the given group.
bool osfiConFmParamNodeIsLeaf(osfi_paramreader_t *pr, const char *param, int depth, const int node[depth])
Checks whether the given array node in a parameter has no children (is a leaf node).
enum osfi_confm_param_type osfiConFmParamElementType(osfi_paramreader_t *pr, const char *param)
Returns the value type of the given parameter.
#define osfiConFmParamArrayLeaf(dest, pr, param, depth, node)
Value getter for ARRAY parameters.
Definition: OSFIC.h:407
void osfiConFmParamPrint(osfi_paramreader_t *pr, const char *param)
Writes information about the chosen parameter to the standard output.
int osfiTimevalue_cmp(const osfi_timevalue_t *a, const osfi_timevalue_t *b)
Compares two values of a TIME parameter.
struct osfi_timevalue osfi_timevalue_t
Representation of the value of a TIME parameter.
void osfiConFmCfgFileClose(osfi_paramreader_t *pr)
Closes the configuration file pointed by pr and releases all resources tied to it.
struct osfi_paramreader osfi_paramreader_t
Opaque type representing an open configuration file.
Definition: OSFIC.h:211
bool osfiConFmParamDimensions(osfi_vecInteger_t **out, osfi_paramreader_t *pr, const char *param)
Retrieves the dimensions of the given parameter.
#define osfiConFmParamValue(dest, pr, param)
Value getter for non-ARRAY parameters.
Definition: OSFIC.h:364
enum osfi_confm_val_res osfiConFmValidateSchema(osfi_paramreader_t *pr, const char *schemaFile)
Performs validation of the given configuration file against a schema document.
bool osfiConFmGetAllParams(osfi_vecString_t **out, osfi_paramreader_t *pr)
Retrieves the path of every parameter in the given configuration file.
osfi_confm_param_type
Types of parameter values.
Definition: OSFIC.h:179
osfi_paramreader_t * osfiConFmCfgFileOpen(const char *path)
Parses the configuration file at path and returns a handle to it.
int osfiConFmParamNodeSize(osfi_paramreader_t *pr, const char *param, int depth, const int node[depth])
Returns the number of elements (if a leaf) or children of an array node in a parameter.
bool osfiConFmParamIsArray(osfi_paramreader_t *pr, const char *param)
Checks if the given parameter is of type ARRAY.
osfi_confm_val_res
Return values for the function that validates a configuration file against a schema.
Definition: OSFIC.h:217
@ OSFI_CONFM_PT_FILE
Definition: OSFIC.h:199
@ OSFI_CONFM_PT_INTEGER
Integral number with the value range of its associated type int32_t.
Definition: OSFIC.h:181
@ OSFI_CONFM_PT_STRING
Definition: OSFIC.h:193
@ OSFI_CONFM_PT_DOUBLE
Definition: OSFIC.h:186
@ OSFI_CONFM_PT_TIME
Definition: OSFIC.h:207
@ OSFI_CONFM_PT_BOOLEAN
Truth value, its associated type is bool.
Definition: OSFIC.h:188
@ OSFI_CONFM_PT_FOLDER
Path to a folder, with the same rules and representation as OSFI_CONFM_PT_FILE.
Definition: OSFIC.h:201
@ OSFI_CONFM_VAL_PASSED
Definition: OSFIC.h:219
@ OSFI_CONFM_VAL_INVALID
Definition: OSFIC.h:221
@ OSFI_CONFM_VAL_ERRORS
Definition: OSFIC.h:223
void osfiLoggerQualityDouble(const char *name, double value)
void osfiLoggerInfo(const char *format,...)
void osfiLoggerQuality(const char *name, const char *value)
void osfiLoggerError(const char *format,...)
_Noreturn void osfiLoggerFinishExecution(int errorCode)
void osfiLoggerProgress(int n, int m)
void osfiLoggerDebug(const char *format,...)
void osfiLoggerWarning(const char *format,...)
void osfiCLPGetConfFile(char *fileName, int *length)
void osfiCLPGetOutputFiles(char *outputFiles[], int *noFiles)
void osfiCLPGetConfFiles(char *confFiles[], int *noFiles)
void osfiCLPGetInputFiles(char *inputFiles[], int *noFiles)
int osfiCLP(int argc, char *argv[])
int osfiConFMGetColumns(const char *paramName)
void osfiConFMGetMatrixDoubleValues(double *doubleMatrix, int *rows, int *columns, const char *paramName)
void osfiConFMGetVectorDoubleValues(double *doubleList, int *size, const char *paramName)
void osfiConFMGetDoubleValue(double *value, const char *paramName)
void osfiConFMGetLeafVectorStringValues(char *stringList[], int *size, const char *paramName, int node[], int depth)
void osfiConFMGetVectorStringValues(char *stringList[], int *size, const char *paramName)
void osfiConFMGetStringValue(char *param, int *length, const char *paramName)
bool osfiConFMReadConfigFile(const char *fileName)
void osfiConFMfileExist(bool *booleanMatrix, int *rows, int *columns, const char *paramName)
void osfiConFMGetNodeDimension(const char *paramName, int node[], int depth, int *size)
void osfiConFMGetVectorTimeValues(osfi_timevalue_t *list, int *size, const char *paramName)
void osfiConFMGetIntegerValue(int *value, const char *paramName)
void osfiConFMGetFileValue(char *param, int *length, const char *paramName)
void osfiConFMGetParameter(osfiParameter *param, const char *paramName)
void osfiConFMGetLeafVectorFileValues(char *fileList[], int *size, const char *paramName, int node[], int depth)
ParamType
Internal definition of parameter types.
Definition: OSFIC.h:664
void osfiConFMGetMatrixStringValues(char *stringMatrix[], int *rows, int *columns, const char *paramName)
bool osfiConFMIsLeaf(const char *paramName, int node[], int depth)
void osfiConFMGetVectorBooleanValues(bool *boolList, int *size, const char *paramName)
void osfiConFMGetLeafVectorTimeValues(osfi_timevalue_t *list, int *size, const char *paramName, int node[], int depth)
void osfiConFMGetTimeValue(osfi_timevalue_t *value, const char *paramName)
int osfiConFMGetRows(const char *paramName)
void osfiConFMGetMatrixBooleanValues(bool *booleanMatrix, int *rows, int *columns, const char *paramName)
void osfiConFMGetDimension(const char *paramName, int index, int *size)
void osfiConFMGetLeafVectorIntegerValues(int *intList, int *size, const char *paramName, int node[], int depth)
void osfiConFMPrintParameter(const char *paramName)
void osfiConFMPrintParameters()
bool osfiConFMGetBoolValue(const char *paramName)
void osfiConFMGetVectorFileValues(char *fileList[], int *size, const char *paramName)
void osfiConFMGetVectorIntegerValues(int *intList, int *size, const char *paramName)
void osfiConFMGetMatrixTimeValues(osfi_timevalue_t *intMatrix, int *rows, int *columns, const char *paramName)
bool osfiConFMExistParameter(const char *paramName)
bool osfiConFMIsArray(const char *paramName)
Returns true if the named parameter is of ARRAY type. Note that MATRIX parameters are not considered ...
void osfiConFMGetMatrixIntegerValues(int *intMatrix, int *rows, int *columns, const char *paramName)
void osfiConFMGetLeafVectorBooleanValues(bool *boolList, int *size, const char *paramName, int node[], int depth)
enum osfi_confm_val_res osfiConFMValidateAgainst(const char *schemaFile)
int osfiConFMParamReader(const char *fileName, const char *schemaName)
void osfiConFMGetLeafVectorDoubleValues(double *doubleList, int *size, const char *paramName, int node[], int depth)
void osfiConFMGetMatrixFileValues(char *fileMatrix[], int *rows, int *columns, const char *paramName)
ParamType osfiConFMGetElementType(const char *paramName)
Returns the element type of the given parameter, or a default value if not found.
@ ParamDouble
Floating point number, in decimal representation with the range of IEEE754 binary64.
Definition: OSFIC.h:668
@ ParamFile
Definition: OSFIC.h:680
@ ParamInteger
Integral number, with the value range of int32_t.
Definition: OSFIC.h:666
@ ParamBoolean
Truth value. Per the E2E-ICD, only TRUE or FALSE are accepted, capitalized.
Definition: OSFIC.h:670
@ ParamFolder
Path to a folder, with the same rules as ParamFile.
Definition: OSFIC.h:682
@ ParamString
Definition: OSFIC.h:675
@ ParamTime
Definition: OSFIC.h:688
Result of parsing CLI arguments, contains the files of each type passed to the module.
Definition: OSFIC.h:139
osfi_clp_files_t * output
Output files, never null.
Definition: OSFIC.h:152
osfi_clp_files_t * config
Configuration files, never null.
Definition: OSFIC.h:148
osfi_clp_files_t * input
Input files, never null.
Definition: OSFIC.h:150
List of files of a specific type, allocated by osfiClpParseArgs().
Definition: OSFIC.h:122
const char * files[]
Path of each file, contains count valid entries and one final NULL entry.
Definition: OSFIC.h:126
int count
Number of valid pointers to strings in files.
Definition: OSFIC.h:124
Matrix of Boolean values, with dimension sizes and contents.
Definition: OSFIC.h:298
Matrix of floating point values, with dimension sizes and contents.
Definition: OSFIC.h:296
Matrix of file/folder values, with dimension sizes and contents.
Definition: OSFIC.h:306
Matrix of integer values, with dimension sizes and contents.
Definition: OSFIC.h:294
Matrix of string values, with dimension sizes and contents.
Definition: OSFIC.h:302
Matrix of time values, with dimension sizes and contents.
Definition: OSFIC.h:300
String allocated by OSFI.
Definition: OSFIC.h:261
String allocated by OSFI.
Definition: OSFIC.h:257
Representation of the value of a TIME parameter.
Definition: OSFIC.h:232
int8_t hour
Hour of day, from 0 to 23.
Definition: OSFIC.h:236
int16_t year
Year number, from 1 to 9999 inclusive.
Definition: OSFIC.h:233
int8_t dom
Day of month, from 1 to the appropriate length according to the year.
Definition: OSFIC.h:235
int32_t nanosec
Fraction of second in ns resolution, from 0 to 999999999.
Definition: OSFIC.h:239
int8_t sec
Second of minute, from 0 to 60 to allow for leap seconds.
Definition: OSFIC.h:238
int8_t month
Month number, from 1 to 12.
Definition: OSFIC.h:234
int8_t minute
Minute of hour, from 0 to 59.
Definition: OSFIC.h:237
Vector of Boolean values, with size and contents.
Definition: OSFIC.h:273
Vector of floating point values, with size and contents.
Definition: OSFIC.h:271
Vector of file/folder values, with size and contents.
Definition: OSFIC.h:281
Vector of integer values, with size and contents.
Definition: OSFIC.h:269
Vector of string values, with size and contents.
Definition: OSFIC.h:277
Vector of time values, with size and contents.
Definition: OSFIC.h:275