8 #include "xDataTOM_private.h"
10 #if defined __cplusplus
23 axes->numberOfAxes = 0;
24 if( ( axes->axis = (xDataTOM_axis *) smr_malloc2( smr, numberOfAxes *
sizeof( xDataTOM_axis ), 1,
"axes->axis" ) ) == NULL )
return( 1 );
25 axes->numberOfAxes = numberOfAxes;
35 for( i = 0; i < axes->numberOfAxes; i++ ) {
46 if( ( index < 0 ) || ( index >= axes->numberOfAxes ) ) {
50 return( axes->axis[index].label );
57 if( ( index < 0 ) || ( index >= axes->numberOfAxes ) ) {
61 return( axes->axis[index].unit );
67 enum xDataTOM_interpolationFlag *dependent,
enum xDataTOM_interpolationQualifier *qualifier ) {
69 xDataTOM_interpolation *interpolation;
71 if( ( index < 0 ) || ( index >= axes->numberOfAxes ) ) {
75 interpolation = &(axes->axis[index].interpolation);
76 *independent = interpolation->independent;
77 *dependent = interpolation->dependent;
78 *qualifier = interpolation->qualifier;
90 xDataTOM_axes *axes, xDataTOM_interpolation *interpolation ) {
97 subAxes->offset = offset;
98 if( ( offset < 0 ) || ( offset >= axes->numberOfAxes ) ) {
99 smr_setReportError2( smr,
xDataTOM_smrLibraryID, -1,
"offset = %d < 0 or >= axes->numberOfAxes = %d", offset, axes->numberOfAxes );
102 if( type == xDataTOM_subAxesType_intepolationAxes ) {
103 if( interpolation == NULL ) {
104 smr_setReportError2p( smr,
xDataTOM_smrLibraryID, -1,
"Interpolation must not be NULL for intepolationAxes" );
109 xDataTOM_interpolation_set( smr, &(subAxes->interpolation), xDataTOM_interpolationFlag_linear, xDataTOM_interpolationFlag_linear,
110 xDataTOM_interpolationQualifier_none );
112 subAxes->axes = axes;
120 subAxes->axes = NULL;
144 xDataTOM_axis *
xDataTOM_axis_new( statusMessageReporting *smr,
int index,
char const *label,
char const *unit, xDataTOM_interpolation *interpolation ) {
146 xDataTOM_axis *axis = NULL;
148 if( ( axis = (xDataTOM_axis *) smr_malloc2( smr,
sizeof( xDataTOM_axis ), 0,
"axis" ) ) == NULL )
return( NULL );
155 int xDataTOM_axis_initialize( statusMessageReporting *smr, xDataTOM_axis *axis,
int index,
char const *label,
char const *unit, xDataTOM_interpolation *interpolation ) {
158 if( ( axis->label = smr_allocateCopyString2( smr, label,
"label" ) ) == NULL )
goto err;
159 if( ( axis->unit = smr_allocateCopyString2( smr, unit,
"unit" ) ) == NULL )
goto err;
184 if( strcmp(
"lab", frame ) == 0 )
return( xDataTOM_frame_lab );
185 if( strcmp(
"centerOfMass", frame ) == 0 )
return( xDataTOM_frame_centerOfMass );
186 return( xDataTOM_frame_invalid );
194 case xDataTOM_frame_lab :
return( xDataTOM_frame_labString );
195 case xDataTOM_frame_centerOfMass :
return( xDataTOM_frame_centerOfMassString );
199 return( xDataTOM_frame_invalidString );
202 #if defined __cplusplus
int xDataTOM_interpolation_copy(statusMessageReporting *smr, xDataTOM_interpolation *desc, xDataTOM_interpolation *src)
enum xDataTOM_frame xDataTOM_axis_stringToFrame(statusMessageReporting *, char const *frame)
char const * xDataTOM_axis_frameToString(statusMessageReporting *, enum xDataTOM_frame frame)
static char const * xDataTOM_frame_labString
char const * xDataTOM_axes_getLabel(statusMessageReporting *smr, xDataTOM_axes *axes, int index)
int xDataTOM_smrLibraryID
int xDataTOM_subAxes_initialize(statusMessageReporting *smr, xDataTOM_subAxes *subAxes, enum xDataTOM_subAxesType type, int offset, xDataTOM_axes *axes, xDataTOM_interpolation *interpolation)
static char const * xDataTOM_frame_invalidString
xDataTOM_axis * xDataTOM_axis_release(statusMessageReporting *, xDataTOM_axis *axis)
int xDataTOM_axes_release(xDataTOM_axes *axes)
int xDataTOM_axes_initialize(statusMessageReporting *smr, xDataTOM_axes *axes, int numberOfAxes)
int xDataTOM_subAxes_release(xDataTOM_subAxes *subAxes)
int xDataTOM_axes_getInterpolation(statusMessageReporting *smr, xDataTOM_axes *axes, int index, enum xDataTOM_interpolationFlag *independent, enum xDataTOM_interpolationFlag *dependent, enum xDataTOM_interpolationQualifier *qualifier)
char const * xDataTOM_subAxes_getUnit(statusMessageReporting *smr, xDataTOM_subAxes *subAxes, int index)
void * smr_freeMemory(void **p)
char const * xDataTOM_axes_getUnit(statusMessageReporting *smr, xDataTOM_axes *axes, int index)
static char const * xDataTOM_frame_centerOfMassString
xDataTOM_axis * xDataTOM_axis_new(statusMessageReporting *smr, int index, char const *label, char const *unit, xDataTOM_interpolation *interpolation)
char const * xDataTOM_subAxes_getLabel(statusMessageReporting *smr, xDataTOM_subAxes *subAxes, int index)
int xDataTOM_axis_initialize(statusMessageReporting *smr, xDataTOM_axis *axis, int index, char const *label, char const *unit, xDataTOM_interpolation *interpolation)
int xDataTOM_interpolation_set(statusMessageReporting *smr, xDataTOM_interpolation *interpolation, enum xDataTOM_interpolationFlag independent, enum xDataTOM_interpolationFlag dependent, enum xDataTOM_interpolationQualifier qualifier)