Geant4 Cross Reference |
1 /* 1 2 # <<BEGIN-copyright>> 3 # <<END-copyright>> 4 */ 5 6 #include <string.h> 7 8 #include "xDataTOM_private.h" 9 10 #if defined __cplusplus 11 namespace GIDI { 12 using namespace GIDI; 13 #endif 14 15 static char const *xDataTOM_frame_labString = 16 static char const *xDataTOM_frame_centerOfMass 17 static char const *xDataTOM_frame_invalidStrin 18 /* 19 ********************************************** 20 */ 21 int xDataTOM_axes_initialize( statusMessageRep 22 23 axes->numberOfAxes = 0; 24 if( ( axes->axis = (xDataTOM_axis *) smr_m 25 axes->numberOfAxes = numberOfAxes; 26 return( 0 ); 27 } 28 /* 29 ********************************************** 30 */ 31 int xDataTOM_axes_release( xDataTOM_axes *axes 32 33 int i; 34 35 for( i = 0; i < axes->numberOfAxes; i++ ) 36 xDataTOM_axis_release( NULL, &(axes->a 37 } 38 smr_freeMemory( (void **) &(axes->axis) ); 39 return( 0 ); 40 } 41 /* 42 ********************************************** 43 */ 44 char const *xDataTOM_axes_getLabel( statusMess 45 46 if( ( index < 0 ) || ( index >= axes->numb 47 smr_setReportError2( smr, xDataTOM_smr 48 return( NULL ); 49 } 50 return( axes->axis[index].label ); 51 } 52 /* 53 ********************************************** 54 */ 55 char const *xDataTOM_axes_getUnit( statusMessa 56 57 if( ( index < 0 ) || ( index >= axes->numb 58 smr_setReportError2( smr, xDataTOM_smr 59 return( NULL ); 60 } 61 return( axes->axis[index].unit ); 62 } 63 /* 64 ********************************************** 65 */ 66 int xDataTOM_axes_getInterpolation( statusMess 67 enum xDataTOM_interpolationFlag *depen 68 69 xDataTOM_interpolation *interpolation; 70 71 if( ( index < 0 ) || ( index >= axes->numb 72 smr_setReportError2( smr, xDataTOM_smr 73 return( 1 ); 74 } 75 interpolation = &(axes->axis[index].interp 76 *independent = interpolation->independent; 77 *dependent = interpolation->dependent; 78 *qualifier = interpolation->qualifier; 79 80 return( 0 ); 81 } 82 83 /* 84 c subAxes functions. 85 */ 86 /* 87 ********************************************** 88 */ 89 int xDataTOM_subAxes_initialize( statusMessage 90 xDataTOM_axes *axes, xDataTOM_interpol 91 92 subAxes->type = type; 93 if( axes == NULL ) { 94 smr_setReportError2p( smr, xDataTOM_sm 95 return( 1 ); 96 } 97 subAxes->offset = offset; 98 if( ( offset < 0 ) || ( offset >= axes->nu 99 smr_setReportError2( smr, xDataTOM_smr 100 return( 1 ); 101 } 102 if( type == xDataTOM_subAxesType_intepolat 103 if( interpolation == NULL ) { 104 smr_setReportError2p( smr, xDataTO 105 return( 1 ); 106 } 107 if( xDataTOM_interpolation_copy( smr, 108 else { /* Not used but fill in anyway 109 xDataTOM_interpolation_set( smr, &(sub 110 xDataTOM_interpolationQualifier_no 111 } 112 subAxes->axes = axes; 113 return( 0 ); 114 } 115 /* 116 ********************************************** 117 */ 118 int xDataTOM_subAxes_release( xDataTOM_subAxes 119 120 subAxes->axes = NULL; 121 return( 0 ); 122 } 123 /* 124 ********************************************** 125 */ 126 char const *xDataTOM_subAxes_getLabel( statusM 127 128 return( xDataTOM_axes_getLabel( smr, subAx 129 } 130 /* 131 ********************************************** 132 */ 133 char const *xDataTOM_subAxes_getUnit( statusMe 134 135 return( xDataTOM_axes_getUnit( smr, subAxe 136 } 137 138 /* 139 c Axis functions. 140 */ 141 /* 142 ********************************************** 143 */ 144 xDataTOM_axis *xDataTOM_axis_new( statusMessag 145 146 xDataTOM_axis *axis = NULL; 147 148 if( ( axis = (xDataTOM_axis *) smr_malloc2 149 if( xDataTOM_axis_initialize( smr, axis, i 150 return( axis ); 151 } 152 /* 153 ********************************************** 154 */ 155 int xDataTOM_axis_initialize( statusMessageRep 156 157 axis->index = index; 158 if( ( axis->label = smr_allocateCopyString 159 if( ( axis->unit = smr_allocateCopyString2 160 if( xDataTOM_interpolation_copy( smr, &(ax 161 162 return( 0 ); 163 164 err: 165 smr_freeMemory( (void **) &(axis->label) ) 166 smr_freeMemory( (void **) &(axis->unit) ); 167 return( 1 ); 168 } 169 /* 170 ********************************************** 171 */ 172 xDataTOM_axis *xDataTOM_axis_release( statusMe 173 174 axis->index = -1; 175 smr_freeMemory( (void **) &(axis->label) ) 176 smr_freeMemory( (void **) &(axis->unit) ); 177 return( NULL ); 178 } 179 /* 180 ********************************************** 181 */ 182 enum xDataTOM_frame xDataTOM_axis_stringToFram 183 184 if( strcmp( "lab", frame ) == 0 ) return( 185 if( strcmp( "centerOfMass", frame ) == 0 ) 186 return( xDataTOM_frame_invalid ); 187 } 188 /* 189 ********************************************** 190 */ 191 char const *xDataTOM_axis_frameToString( statu 192 193 switch( frame ) { 194 case xDataTOM_frame_lab : return( xDataTOM 195 case xDataTOM_frame_centerOfMass : return( 196 default : 197 break; 198 } 199 return( xDataTOM_frame_invalidString ); 200 } 201 202 #if defined __cplusplus 203 } 204 #endif 205