7 #include "xDataTOM_private.h"
9 #if defined __cplusplus
14 #define dependentAxis 1
15 #define allowByRegion 2
18 char const *str,
int flag );
22 int xDataTOM_interpolation_set( statusMessageReporting *smr, xDataTOM_interpolation *interpolation,
enum xDataTOM_interpolationFlag independent,
23 enum xDataTOM_interpolationFlag dependent,
enum xDataTOM_interpolationQualifier qualifier ) {
25 if( ( independent < xDataTOM_interpolationFlag_linear ) || ( independent > xDataTOM_interpolationFlag_byRegion ) ) {
26 smr_setReportError2( smr,
xDataTOM_smrLibraryID, -1,
"invalid independent interpolation = %d", independent );
29 if( ( dependent < xDataTOM_interpolationFlag_linear ) || ( dependent > xDataTOM_interpolationFlag_flat ) ) {
30 smr_setReportError2( smr,
xDataTOM_smrLibraryID, -1,
"invalid dependent interpolation = %d", dependent );
33 if( ( qualifier <= xDataTOM_interpolationQualifier_invalid ) || ( qualifier > xDataTOM_interpolationQualifier_correspondingPoints ) ) {
34 smr_setReportError2( smr,
xDataTOM_smrLibraryID, -1,
"invalid interpolation qualifier = %d", qualifier );
38 interpolation->independent = independent;
39 interpolation->dependent = dependent;
40 interpolation->qualifier = qualifier;
50 enum xDataTOM_interpolationQualifier qualifier = xDataTOM_interpolationQualifier_none;
51 enum xDataTOM_interpolationFlag independent, dependent;
53 if( ( c = strchr( str,
':' ) ) != NULL ) {
54 if( strncmp(
"unitBase:", str, 9 ) == 0 ) {
55 qualifier = xDataTOM_interpolationQualifier_unitBase; }
56 else if( strncmp(
"correspondingPoints:", str, 20 ) == 0 ) {
57 qualifier = xDataTOM_interpolationQualifier_correspondingPoints; }
59 smr_setReportError2( smr,
xDataTOM_smrLibraryID, -1,
"invalid interpolation string qualifier '%s'", str );
68 smr_setReportError2( smr,
xDataTOM_smrLibraryID, -1,
"missing ',' separator in interpolation string'%s'", str );
81 char const *str,
int flag ) {
83 if( strncmp(
"linear", s, 6 ) == 0 ) { *e = &(s[6]);
return( xDataTOM_interpolationFlag_linear ); }
84 if( strncmp(
"log", s, 3 ) == 0 ) { *e = &(s[3]);
return( xDataTOM_interpolationFlag_log ); }
86 if( strncmp(
"byRegion", s, 8 ) == 0 ) { *e = &(s[8]);
return( xDataTOM_interpolationFlag_byRegion ); }
89 if( strncmp(
"flat", s, 4 ) == 0 ) { *e = &(s[4]);
return( xDataTOM_interpolationFlag_flat ); }
91 smr_setReportError2( smr,
xDataTOM_smrLibraryID, -1,
"invalid interpolation component '%s' in string '%s'", s, str );
92 return( xDataTOM_interpolationFlag_invalid );
107 #if defined __cplusplus
int xDataTOM_interpolation_setFromString(statusMessageReporting *smr, xDataTOM_interpolation *interpolation, char const *str)
int xDataTOM_interpolation_copy(statusMessageReporting *smr, xDataTOM_interpolation *desc, xDataTOM_interpolation *src)
int xDataTOM_smrLibraryID
static enum xDataTOM_interpolationFlag xDataTOM_interpolation_getFromString(statusMessageReporting *smr, char const *s, char const **e, char const *str, int flag)
int xDataTOM_interpolation_set(statusMessageReporting *smr, xDataTOM_interpolation *interpolation, enum xDataTOM_interpolationFlag independent, enum xDataTOM_interpolationFlag dependent, enum xDataTOM_interpolationQualifier qualifier)