OSFI-C  3.10.0
OpenSF Integration Library
OSFIC.h File Reference

OSFI-C public API header. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  osfi_clp_files
 List of files of a specific type, allocated by osfiClpParseArgs(). More...
 
struct  osfi_clp_args
 Result of parsing CLI arguments, contains the files of each type passed to the module. More...
 
struct  osfi_timevalue
 Representation of the value of a TIME parameter. More...
 
struct  osfi_ownstr_t
 String allocated by OSFI. More...
 
struct  osfi_ownfile_t
 String allocated by OSFI. More...
 
struct  osfi_vecInteger_t
 Vector of integer values, with size and contents. More...
 
struct  osfi_vecDouble_t
 Vector of floating point values, with size and contents. More...
 
struct  osfi_vecBoolean_t
 Vector of Boolean values, with size and contents. More...
 
struct  osfi_vecTime_t
 Vector of time values, with size and contents. More...
 
struct  osfi_vecString_t
 Vector of string values, with size and contents. More...
 
struct  osfi_vecFile_t
 Vector of file/folder values, with size and contents. More...
 
struct  osfi_matInteger_t
 Matrix of integer values, with dimension sizes and contents. More...
 
struct  osfi_matDouble_t
 Matrix of floating point values, with dimension sizes and contents. More...
 
struct  osfi_matBoolean_t
 Matrix of Boolean values, with dimension sizes and contents. More...
 
struct  osfi_matTime_t
 Matrix of time values, with dimension sizes and contents. More...
 
struct  osfi_matString_t
 Matrix of string values, with dimension sizes and contents. More...
 
struct  osfi_matFile_t
 Matrix of file/folder values, with dimension sizes and contents. More...
 
struct  osfiParameter
 

Macros

#define OSFI_NO_RETURN   _Noreturn /* In C11: keyword */
 
#define OSFI_DEPRECATED(reason)
 
#define MAX_LENGTH_FILE_NAME   255
 
#define MAX_LENGTH_STRING   255
 
#define MAX_PARAMETER_FIELD_SIZE   255
 
#define MAX_PARAMETER_NAME_SIZE   255
 
#define MAX_PARAMETER_DESC_SIZE   255
 

Typedefs

typedef struct osfi_clp_files osfi_clp_files_t
 List of files of a specific type, allocated by osfiClpParseArgs(). More...
 
typedef struct osfi_clp_args osfi_clp_args_t
 Result of parsing CLI arguments, contains the files of each type passed to the module. More...
 
typedef struct osfi_paramreader osfi_paramreader_t
 Opaque type representing an open configuration file.
 
typedef struct osfi_timevalue osfi_timevalue_t
 Representation of the value of a TIME parameter. More...
 

Enumerations

enum  osfi_confm_param_type {
  OSFI_CONFM_PT_INTEGER = 1 , OSFI_CONFM_PT_DOUBLE , OSFI_CONFM_PT_BOOLEAN , OSFI_CONFM_PT_STRING ,
  OSFI_CONFM_PT_FILE , OSFI_CONFM_PT_FOLDER , OSFI_CONFM_PT_TIME
}
 Types of parameter values. More...
 
enum  osfi_confm_val_res { OSFI_CONFM_VAL_PASSED = 1 , OSFI_CONFM_VAL_INVALID , OSFI_CONFM_VAL_ERRORS }
 Return values for the function that validates a configuration file against a schema. More...
 
enum  ParamType {
  ParamInteger = OSFI_CONFM_PT_INTEGER , ParamDouble = OSFI_CONFM_PT_DOUBLE , ParamBoolean = OSFI_CONFM_PT_BOOLEAN , ParamString = OSFI_CONFM_PT_STRING ,
  ParamFile = OSFI_CONFM_PT_FILE , ParamFolder = OSFI_CONFM_PT_FOLDER , ParamTime = OSFI_CONFM_PT_TIME
}
 Internal definition of parameter types. More...
 

Functions

void osfiLoggerError (const char *format,...)
 
void osfiLoggerWarning (const char *format,...)
 
void osfiLoggerInfo (const char *format,...)
 
void osfiLoggerDebug (const char *format,...)
 
void osfiLoggerProgress (int n, int m)
 
_Noreturn void osfiLoggerFinishExecution (int errorCode)
 
void osfiLoggerQuality (const char *name, const char *value)
 
void osfiLoggerQualityDouble (const char *name, double value)
 
osfi_clp_args_tosfiClpParseArgs (int argc, char *argv[])
 Parse the command-line arguments provided to the module. More...
 
void osfiClpFree (osfi_clp_args_t *p)
 Release a previously allocated result returned by osfiClpParseArgs(). More...
 
int osfiCLP (int argc, char *argv[])
 
void osfiCLPGetConfFile (char *fileName, int *length)
 
void osfiCLPGetConfFiles (char *confFiles[], int *noFiles)
 
void osfiCLPGetInputFiles (char *inputFiles[], int *noFiles)
 
void osfiCLPGetOutputFiles (char *outputFiles[], int *noFiles)
 
int osfiConFMParamReader (const char *fileName, const char *schemaName)
 
bool osfiConFMReadConfigFile (const char *fileName)
 
enum osfi_confm_val_res osfiConFMValidateAgainst (const char *schemaFile)
 
void osfiConFMPrintParameters ()
 
void osfiConFMGetIntegerValue (int *value, const char *paramName)
 
void osfiConFMGetDoubleValue (double *value, const char *paramName)
 
void osfiConFMGetTimeValue (osfi_timevalue_t *value, const char *paramName)
 
bool osfiConFMGetBoolValue (const char *paramName)
 
void osfiConFMGetFileValue (char *param, int *length, const char *paramName)
 
void osfiConFMGetStringValue (char *param, int *length, const char *paramName)
 
void osfiConFMGetParameter (osfiParameter *param, const char *paramName)
 
void osfiConFMPrintParameter (const char *paramName)
 
void osfiConFMGetVectorDoubleValues (double *doubleList, int *size, const char *paramName)
 
void osfiConFMGetVectorIntegerValues (int *intList, int *size, const char *paramName)
 
void osfiConFMGetVectorTimeValues (osfi_timevalue_t *list, int *size, const char *paramName)
 
void osfiConFMGetVectorStringValues (char *stringList[], int *size, const char *paramName)
 
void osfiConFMGetVectorFileValues (char *fileList[], int *size, const char *paramName)
 
void osfiConFMGetVectorBooleanValues (bool *boolList, int *size, const char *paramName)
 
void osfiConFMGetLeafVectorDoubleValues (double *doubleList, int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorIntegerValues (int *intList, int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorTimeValues (osfi_timevalue_t *list, int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorStringValues (char *stringList[], int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorFileValues (char *fileList[], int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorBooleanValues (bool *boolList, int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetMatrixStringValues (char *stringMatrix[], int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixFileValues (char *fileMatrix[], int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixBooleanValues (bool *booleanMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMfileExist (bool *booleanMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixDoubleValues (double *doubleMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixIntegerValues (int *intMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixTimeValues (osfi_timevalue_t *intMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMGetDimension (const char *paramName, int index, int *size)
 
void osfiConFMGetNodeDimension (const char *paramName, int node[], int depth, int *size)
 
bool osfiConFMIsLeaf (const char *paramName, int node[], int depth)
 
int osfiConFMGetRows (const char *paramName)
 
int osfiConFMGetColumns (const char *paramName)
 
bool osfiConFMExistParameter (const char *paramName)
 
ParamType osfiConFMGetElementType (const char *paramName)
 Returns the element type of the given parameter, or a default value if not found. More...
 
bool osfiConFMIsArray (const char *paramName)
 Returns true if the named parameter is of ARRAY type. Note that MATRIX parameters are not considered ARRAY-typed. More...
 
int osfiCommonClose ()
 
Queries about a configuration file
enum osfi_confm_val_res osfiConFmValidateSchema (osfi_paramreader_t *pr, const char *schemaFile)
 Performs validation of the given configuration file against a schema document. More...
 
bool osfiConFmParamExists (osfi_paramreader_t *pr, const char *param)
 Finds a parameter in the given configuration file. More...
 
bool osfiConFmGetAllParams (osfi_vecString_t **out, osfi_paramreader_t *pr)
 Retrieves the path of every parameter in the given configuration file. More...
 
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. More...
 
Non-value queries about a specific parameter
bool osfiConFmParamIsArray (osfi_paramreader_t *pr, const char *param)
 Checks if the given parameter is of type ARRAY. More...
 
bool osfiConFmParamLocalName (osfi_ownstr_t **out, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamDescription (osfi_ownstr_t **out, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamMinValue (osfi_ownstr_t **out, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamMaxValue (osfi_ownstr_t **out, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamUnits (osfi_ownstr_t **out, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamRawValue (osfi_ownstr_t **out, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamDimensions (osfi_vecInteger_t **out, osfi_paramreader_t *pr, const char *param)
 Retrieves the dimensions of the given parameter. More...
 
enum osfi_confm_param_type osfiConFmParamElementType (osfi_paramreader_t *pr, const char *param)
 Returns the value type of the given parameter. More...
 
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). More...
 
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. More...
 
void osfiConFmParamPrint (osfi_paramreader_t *pr, const char *param)
 Writes information about the chosen parameter to the standard output. More...
 
Typed value getters

Functions to retrieve the value of a parameter, depending on the element and structural type.

Note
If the library has been built with C11 support, it is much preferable to use the generic functions osfiConFmParamValue() and osfiConFmParamArrayLeaf() instead.
bool osfiConFmParamValueInteger (int32_t *dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamVectorInteger (osfi_vecInteger_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamMatrixInteger (osfi_matInteger_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamArrayLeafInteger (osfi_vecInteger_t **dest, osfi_paramreader_t *pr, const char *param, int depth, const int node[depth])
 
bool osfiConFmParamValueDouble (double *dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamVectorDouble (osfi_vecDouble_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamMatrixDouble (osfi_matDouble_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamArrayLeafDouble (osfi_vecDouble_t **dest, osfi_paramreader_t *pr, const char *param, int depth, const int node[depth])
 
bool osfiConFmParamValueBoolean (bool *dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamVectorBoolean (osfi_vecBoolean_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamMatrixBoolean (osfi_matBoolean_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamArrayLeafBoolean (osfi_vecBoolean_t **dest, osfi_paramreader_t *pr, const char *param, int depth, const int node[depth])
 
bool osfiConFmParamValueTime (osfi_timevalue_t *dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamVectorTime (osfi_vecTime_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamMatrixTime (osfi_matTime_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamArrayLeafTime (osfi_vecTime_t **dest, osfi_paramreader_t *pr, const char *param, int depth, const int node[depth])
 
bool osfiConFmParamValueString (osfi_ownstr_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamVectorString (osfi_vecString_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamMatrixString (osfi_matString_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamArrayLeafString (osfi_vecString_t **dest, osfi_paramreader_t *pr, const char *param, int depth, const int node[depth])
 
bool osfiConFmParamValueFile (osfi_ownfile_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamVectorFile (osfi_vecFile_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamMatrixFile (osfi_matFile_t **dest, osfi_paramreader_t *pr, const char *param)
 
bool osfiConFmParamArrayLeafFile (osfi_vecFile_t **dest, osfi_paramreader_t *pr, const char *param, int depth, const int node[depth])
 

Basic functionality

Essential routines used to open/close a configuration file and read parameter values.

Note
The generic parameter value getters osfiConFmParamValue() and osfiConFmParamArrayLeaf() are only available if the library was built with C11 support.
#define osfiConFmParamValue(dest, pr, param)
 Value getter for non-ARRAY parameters. More...
 
#define osfiConFmParamArrayLeaf(dest, pr, param, depth, node)
 Value getter for ARRAY parameters. More...
 
osfi_paramreader_tosfiConFmCfgFileOpen (const char *path)
 Parses the configuration file at path and returns a handle to it. More...
 
void osfiConFmCfgFileClose (osfi_paramreader_t *pr)
 Closes the configuration file pointed by pr and releases all resources tied to it. More...
 

Detailed Description

OSFI-C public API header.

Macro Definition Documentation

◆ OSFI_DEPRECATED

#define OSFI_DEPRECATED (   reason)

If supported by the compiler, indicates that the annotated element is deprecated.

◆ OSFI_NO_RETURN

#define OSFI_NO_RETURN   _Noreturn /* In C11: keyword */

If supported by the compiler, indicates that the function so annotated never returns.

Function Documentation

◆ osfiCommonClose()

int osfiCommonClose ( )

Close the OSFI parameter and Command Line parsers

Returns
FALSE (zero) if errors have occurred, nonzero otherwise.