OSFI-C++  3.9.2
OpenSF Integration Library
ConFM.h
Go to the documentation of this file.
1 /*
2  * openSF Integration Libraries (OSFI)
3  * Deimos Space, S.L.U.
4  *
5  * This file is part of OSFI. OSFI is free software; you can redistribute it
6  * and/or modify it under the terms of the 'ESA Software Community Licence Permissive' as
7  * published by the European Space Agency; either version 2.4 of the License,
8  * or (at your option) any later version. You should have received a
9  * copy of the 'ESA Software Community Licence Permissive - v2.4' along with this program
10  * or one can be found at <http://eop-cfi.esa.int/index.php/docs-and-mission-data/licensing-documents>.
11  *
12  */
23 #ifndef OSFI_FFI_CONFM_H
24 #define OSFI_FFI_CONFM_H
25 
26 #include "ffi_base.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 // TODO: documentation! especially pre- and post- conditions, and what happens in
32 // case of a C++ exception.
33 
59 OSFI_FFI_DEPRECATED("Use the create_noval constructor instead and then call validate.")
60 OSFI_ParamReader* osfi_param_reader_create(const char* fileName, const char* schema);
66 
75 };
79 enum osfi_ffi_confm_val_res osfi_param_reader_valagainst(const OSFI_ParamReader* obj, const char* xsdFile);
80 
84 bool osfi_confm_exist_parameter(const OSFI_ParamReader* obj, const char *paramName);
87 const OSFI_Parameter* osfi_confm_get_param(const OSFI_ParamReader* obj, const char *paramName);
88 // Nonexisting, because Parameter instances are held by ParamReader
89 // void osfi_parameter_destroy(OSFI_Parameter** obj);
90 
101 };
102 
103 #define OSFI_DECL_SCALAR_GETTER_simple(Tname, Ttype) \
104  \
105  bool osfi_confm_get_scalar_##Tname(const OSFI_Parameter* obj, Ttype* value)
106 #define OSFI_DECL_SCALAR_GETTER_str(Tname, Ttype) \
107  \
108  int osfi_confm_get_scalar_##Tname(const OSFI_Parameter* obj, Ttype buf, int bufSz)
109 
110 // Declare getter functions: this macro declares the vector type, the available operations on it and
111 // the functions that get vector objects from a parameter object. Also, declare the scalar getter.
112 #define OSFI_DECL_GETTERS(Tname, Ttype, kind) \
113  OSFI_DECL_SCALAR_GETTER_ ## kind(Tname, Ttype); \
114  OSFI_DECL_VECTOR(Tname, Ttype, kind); \
115  \
116  OSFI_VEC_T(Tname) * osfi_confm_get_vector_##Tname##_vals(const OSFI_Parameter* obj, int* size); \
117  \
118  OSFI_VEC_T(Tname) * osfi_confm_get_leaf_vector_##Tname##_vals(const OSFI_Parameter* obj, int node[], int depth, int* size); \
119  \
121  OSFI_VEC_T(Tname) * osfi_confm_get_matrix_##Tname##_vals(const OSFI_Parameter* obj, enum osfi_confm_arrayorder aeo, int* size);
122 
123 OSFI_DECL_GETTERS(boolean, bool, simple);
124 OSFI_DECL_GETTERS(integer, int, simple);
125 OSFI_DECL_GETTERS(double, double, simple);
126 OSFI_DECL_GETTERS(time, OSFI_TimeValue, simple);
127 OSFI_DECL_GETTERS(file, char*, str); // NOTE: this could use the same type as OSFI_Vec_Tstring
128 OSFI_DECL_GETTERS(string, char*, str);
129 
131 OSFI_VEC_T(boolean) * osfi_confm_file_exist(const OSFI_Parameter* p, enum osfi_confm_arrayorder aeo, int *size);
132 
133 // Parameter information
135 int osfi_param_get_local_name(const OSFI_Parameter* obj, char* buf, int bufSz);
137 int osfi_param_get_path(const OSFI_Parameter* obj, char* buf, int bufSz);
138 // TODO: implement other similar functions wrapping getDescription, getMin, etc.
139 
142 enum OSFI_ParamElemType {
143  OSFI_PET_INTEGER = 1,
144  OSFI_PET_FLOAT,
145  OSFI_PET_BOOLEAN,
146  OSFI_PET_STRING,
147  OSFI_PET_FILE,
148  OSFI_PET_FOLDER,
149  OSFI_PET_TIME,
150 };
153 
155 bool osfi_param_is_array(const OSFI_Parameter* obj);
156 
163 int osfi_confm_get_dimension(const OSFI_Parameter* obj, int index);
170 int osfi_confm_get_node_dimension(const OSFI_Parameter* obj, int node[], int depth);
173 bool osfi_confm_is_leaf(const OSFI_Parameter* obj, int node[], int depth);
174 
175 // Miscellaneous Parameter-related functions
177 OSFI_FFI_DEPRECATED("unsafe function, writes into unknown-sized char buffers")
178 void osfi_confm_get_parameter(const OSFI_Parameter* obj, char *name, char *description, char* value,
179  char *units, int *dims, char *max, char *min, int *type);
183 
191 
194 #ifdef __cplusplus
195 } // For the extern "C"
196 #endif
197 
198 #endif /* OSFI_FFI_CONFM_H */
osfi_confm_get_dimension
int osfi_confm_get_dimension(const OSFI_Parameter *obj, int index)
osfi_confm_file_exist
OSFI_Vec_Tboolean * osfi_confm_file_exist(const OSFI_Parameter *p, enum osfi_confm_arrayorder aeo, int *size)
OSFI_ParamElemType
OSFI_ParamElemType
Definition: ConFM.h:141
OSFI_Parameter
struct OSFI_Parameter_t OSFI_Parameter
Definition: ConFM.h:53
OSFI_FFI_CONFM_VAL_INVALID
@ OSFI_FFI_CONFM_VAL_INVALID
Definition: ConFM.h:72
osfi_param_reader_valagainst
enum osfi_ffi_confm_val_res osfi_param_reader_valagainst(const OSFI_ParamReader *obj, const char *xsdFile)
OSFI_VEC_T
struct OSFI_Vec_Tboolean_t OSFI_VEC_T(boolean)
osfi_param_reader_create_noval
OSFI_ParamReader * osfi_param_reader_create_noval(const char *fileName)
OSFI_CONFM_AO_LAST_CONTIG
@ OSFI_CONFM_AO_LAST_CONTIG
Definition: ConFM.h:96
osfi_param_get_element_type
enum OSFI_ParamElemType osfi_param_get_element_type(const OSFI_Parameter *obj)
osfi_param_reader_destroy
void osfi_param_reader_destroy(OSFI_ParamReader **obj)
osfi_confm_is_leaf
bool osfi_confm_is_leaf(const OSFI_Parameter *obj, int node[], int depth)
ffi_base.h
Internal header used by the foreign-function interface to OSFI-C++.
OSFI_TimeValue
struct OSFI_TimeValue_t OSFI_TimeValue
Definition: ffi_base.h:108
osfi_confm_get_node_dimension
int osfi_confm_get_node_dimension(const OSFI_Parameter *obj, int node[], int depth)
osfi_ffi_confm_val_res
osfi_ffi_confm_val_res
Definition: ConFM.h:68
osfi_param_reader_create
OSFI_ParamReader * osfi_param_reader_create(const char *fileName, const char *schema)
OSFI_CONFM_AO_FIRST_CONTIG
@ OSFI_CONFM_AO_FIRST_CONTIG
Definition: ConFM.h:100
osfi_param_is_array
bool osfi_param_is_array(const OSFI_Parameter *obj)
osfi_confm_get_param
const OSFI_Parameter * osfi_confm_get_param(const OSFI_ParamReader *obj, const char *paramName)
osfi_confm_exist_parameter
bool osfi_confm_exist_parameter(const OSFI_ParamReader *obj, const char *paramName)
osfi_confm_print_parameter
void osfi_confm_print_parameter(const OSFI_Parameter *obj)
osfi_confm_get_num_dims
int osfi_confm_get_num_dims(const OSFI_Parameter *obj)
OSFI_FFI_CONFM_VAL_ERRORS
@ OSFI_FFI_CONFM_VAL_ERRORS
Definition: ConFM.h:74
osfi_param_get_path
int osfi_param_get_path(const OSFI_Parameter *obj, char *buf, int bufSz)
OSFI_FFI_CONFM_VAL_PASSED
@ OSFI_FFI_CONFM_VAL_PASSED
Definition: ConFM.h:70
osfi_confm_get_parameter
void osfi_confm_get_parameter(const OSFI_Parameter *obj, char *name, char *description, char *value, char *units, int *dims, char *max, char *min, int *type)
osfi_confm_arrayorder
osfi_confm_arrayorder
Definition: ConFM.h:92
OSFI_ParamReader
struct OSFI_ParamReader_t OSFI_ParamReader
Definition: ConFM.h:52
OSFI_FFI_DECL_PLACEHOLDER
#define OSFI_FFI_DECL_PLACEHOLDER(name)
Definition: ffi_base.h:58
osfi_param_get_local_name
int osfi_param_get_local_name(const OSFI_Parameter *obj, char *buf, int bufSz)
osfi_confm_compare_timevalue
int osfi_confm_compare_timevalue(const OSFI_TimeValue *a, const OSFI_TimeValue *b)
osfi_confm_print_parameters
void osfi_confm_print_parameters(const OSFI_ParamReader *obj)