Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
xDataTOM_axes.cc File Reference
#include <string.h>
#include "xDataTOM_private.h"
Include dependency graph for xDataTOM_axes.cc:

Go to the source code of this file.

Functions

int xDataTOM_axes_initialize (statusMessageReporting *smr, xDataTOM_axes *axes, int numberOfAxes)
 
int xDataTOM_axes_release (xDataTOM_axes *axes)
 
char const * xDataTOM_axes_getLabel (statusMessageReporting *smr, xDataTOM_axes *axes, int index)
 
char const * xDataTOM_axes_getUnit (statusMessageReporting *smr, xDataTOM_axes *axes, int index)
 
int xDataTOM_axes_getInterpolation (statusMessageReporting *smr, xDataTOM_axes *axes, int index, enum xDataTOM_interpolationFlag *independent, enum xDataTOM_interpolationFlag *dependent, enum xDataTOM_interpolationQualifier *qualifier)
 
int xDataTOM_subAxes_initialize (statusMessageReporting *smr, xDataTOM_subAxes *subAxes, enum xDataTOM_subAxesType type, int offset, xDataTOM_axes *axes, xDataTOM_interpolation *interpolation)
 
int xDataTOM_subAxes_release (xDataTOM_subAxes *subAxes)
 
char const * xDataTOM_subAxes_getLabel (statusMessageReporting *smr, xDataTOM_subAxes *subAxes, int index)
 
char const * xDataTOM_subAxes_getUnit (statusMessageReporting *smr, xDataTOM_subAxes *subAxes, int index)
 
xDataTOM_axisxDataTOM_axis_new (statusMessageReporting *smr, int index, char const *label, char const *unit, xDataTOM_interpolation *interpolation)
 
int xDataTOM_axis_initialize (statusMessageReporting *smr, xDataTOM_axis *axis, int index, char const *label, char const *unit, xDataTOM_interpolation *interpolation)
 
xDataTOM_axisxDataTOM_axis_release (statusMessageReporting *, xDataTOM_axis *axis)
 
enum xDataTOM_frame xDataTOM_axis_stringToFrame (statusMessageReporting *, char const *frame)
 
char const * xDataTOM_axis_frameToString (statusMessageReporting *, enum xDataTOM_frame frame)
 

Variables

static char const * xDataTOM_frame_labString = "lab"
 
static char const * xDataTOM_frame_centerOfMassString = "centerOfMass"
 
static char const * xDataTOM_frame_invalidString = "invalid"
 

Function Documentation

int xDataTOM_axes_getInterpolation ( statusMessageReporting smr,
xDataTOM_axes axes,
int  index,
enum xDataTOM_interpolationFlag independent,
enum xDataTOM_interpolationFlag dependent,
enum xDataTOM_interpolationQualifier qualifier 
)

Definition at line 66 of file xDataTOM_axes.cc.

67  {
68 
69  xDataTOM_interpolation *interpolation;
70 
71  if( ( index < 0 ) || ( index >= axes->numberOfAxes ) ) {
72  smr_setReportError2( smr, xDataTOM_smrLibraryID, -1, "invalid axes index = %d", index );
73  return( 1 );
74  }
75  interpolation = &(axes->axis[index].interpolation);
76  *independent = interpolation->independent;
77  *dependent = interpolation->dependent;
78  *qualifier = interpolation->qualifier;
79 
80  return( 0 );
81 }
enum xDataTOM_interpolationFlag independent dependent
Definition: xDataTOM.h:57
enum xDataTOM_interpolationQualifier qualifier
Definition: xDataTOM.h:58
int xDataTOM_smrLibraryID
Definition: xDataTOM.cc:34
int numberOfAxes
Definition: xDataTOM.h:69
xDataTOM_interpolation interpolation
Definition: xDataTOM.h:65
xDataTOM_axis * axis
Definition: xDataTOM.h:70
#define smr_setReportError2(smr, libraryID, code, fmt,...)

Here is the caller graph for this function:

char const* xDataTOM_axes_getLabel ( statusMessageReporting smr,
xDataTOM_axes axes,
int  index 
)

Definition at line 44 of file xDataTOM_axes.cc.

44  {
45 
46  if( ( index < 0 ) || ( index >= axes->numberOfAxes ) ) {
47  smr_setReportError2( smr, xDataTOM_smrLibraryID, -1, "invalid axes index = %d", index );
48  return( NULL );
49  }
50  return( axes->axis[index].label );
51 }
int xDataTOM_smrLibraryID
Definition: xDataTOM.cc:34
int numberOfAxes
Definition: xDataTOM.h:69
char * label
Definition: xDataTOM.h:63
xDataTOM_axis * axis
Definition: xDataTOM.h:70
#define smr_setReportError2(smr, libraryID, code, fmt,...)

Here is the caller graph for this function:

char const* xDataTOM_axes_getUnit ( statusMessageReporting smr,
xDataTOM_axes axes,
int  index 
)

Definition at line 55 of file xDataTOM_axes.cc.

55  {
56 
57  if( ( index < 0 ) || ( index >= axes->numberOfAxes ) ) {
58  smr_setReportError2( smr, xDataTOM_smrLibraryID, -1, "invalid axes index = %d", index );
59  return( NULL );
60  }
61  return( axes->axis[index].unit );
62 }
int xDataTOM_smrLibraryID
Definition: xDataTOM.cc:34
int numberOfAxes
Definition: xDataTOM.h:69
xDataTOM_axis * axis
Definition: xDataTOM.h:70
#define smr_setReportError2(smr, libraryID, code, fmt,...)
char * unit
Definition: xDataTOM.h:64

Here is the caller graph for this function:

int xDataTOM_axes_initialize ( statusMessageReporting smr,
xDataTOM_axes axes,
int  numberOfAxes 
)

Definition at line 21 of file xDataTOM_axes.cc.

21  {
22 
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;
26  return( 0 );
27 }
int numberOfAxes
Definition: xDataTOM.h:69
xDataTOM_axis * axis
Definition: xDataTOM.h:70
#define smr_malloc2(smr, size, zero, forItem)

Here is the caller graph for this function:

int xDataTOM_axes_release ( xDataTOM_axes axes)

Definition at line 31 of file xDataTOM_axes.cc.

31  {
32 
33  int i;
34 
35  for( i = 0; i < axes->numberOfAxes; i++ ) {
36  xDataTOM_axis_release( NULL, &(axes->axis[i]) );
37  }
38  smr_freeMemory( (void **) &(axes->axis) );
39  return( 0 );
40 }
int numberOfAxes
Definition: xDataTOM.h:69
xDataTOM_axis * axis
Definition: xDataTOM.h:70
xDataTOM_axis * xDataTOM_axis_release(statusMessageReporting *smr, xDataTOM_axis *axis)
void * smr_freeMemory(void **p)

Here is the call graph for this function:

Here is the caller graph for this function:

char const* xDataTOM_axis_frameToString ( statusMessageReporting ,
enum xDataTOM_frame  frame 
)

Definition at line 191 of file xDataTOM_axes.cc.

191  {
192 
193  switch( frame ) {
196  default :
197  break;
198  }
200 }
static char const * xDataTOM_frame_labString
static char const * xDataTOM_frame_invalidString
static char const * xDataTOM_frame_centerOfMassString
int xDataTOM_axis_initialize ( statusMessageReporting smr,
xDataTOM_axis axis,
int  index,
char const *  label,
char const *  unit,
xDataTOM_interpolation interpolation 
)

Definition at line 155 of file xDataTOM_axes.cc.

155  {
156 
157  axis->index = index;
158  if( ( axis->label = smr_allocateCopyString2( smr, label, "label" ) ) == NULL ) goto err;
159  if( ( axis->unit = smr_allocateCopyString2( smr, unit, "unit" ) ) == NULL ) goto err;
160  if( xDataTOM_interpolation_copy( smr, &(axis->interpolation), interpolation ) != 0 ) goto err;
161 
162  return( 0 );
163 
164 err:
165  smr_freeMemory( (void **) &(axis->label) );
166  smr_freeMemory( (void **) &(axis->unit) );
167  return( 1 );
168 }
#define smr_allocateCopyString2(smr, s, forItem)
char * label
Definition: xDataTOM.h:63
xDataTOM_interpolation interpolation
Definition: xDataTOM.h:65
char * unit
Definition: xDataTOM.h:64
void * smr_freeMemory(void **p)
int xDataTOM_interpolation_copy(statusMessageReporting *smr, xDataTOM_interpolation *desc, xDataTOM_interpolation *src)

Here is the call graph for this function:

Here is the caller graph for this function:

xDataTOM_axis* xDataTOM_axis_new ( statusMessageReporting smr,
int  index,
char const *  label,
char const *  unit,
xDataTOM_interpolation interpolation 
)

Definition at line 144 of file xDataTOM_axes.cc.

144  {
145 
146  xDataTOM_axis *axis = NULL;
147 
148  if( ( axis = (xDataTOM_axis *) smr_malloc2( smr, sizeof( xDataTOM_axis ), 0, "axis" ) ) == NULL ) return( NULL );
149  if( xDataTOM_axis_initialize( smr, axis, index, label, unit, interpolation ) != 0 ) smr_freeMemory( (void **) &axis );
150  return( axis );
151 }
int xDataTOM_axis_initialize(statusMessageReporting *smr, xDataTOM_axis *axis, int index, char const *label, char const *unit, xDataTOM_interpolation *interpolation)
#define smr_malloc2(smr, size, zero, forItem)
void * smr_freeMemory(void **p)

Here is the call graph for this function:

xDataTOM_axis* xDataTOM_axis_release ( statusMessageReporting ,
xDataTOM_axis axis 
)

Definition at line 172 of file xDataTOM_axes.cc.

172  {
173 
174  axis->index = -1;
175  smr_freeMemory( (void **) &(axis->label) );
176  smr_freeMemory( (void **) &(axis->unit) );
177  return( NULL );
178 }
char * label
Definition: xDataTOM.h:63
char * unit
Definition: xDataTOM.h:64
void * smr_freeMemory(void **p)

Here is the call graph for this function:

Here is the caller graph for this function:

enum xDataTOM_frame xDataTOM_axis_stringToFrame ( statusMessageReporting ,
char const *  frame 
)

Definition at line 182 of file xDataTOM_axes.cc.

182  {
183 
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 );
187 }

Here is the caller graph for this function:

char const* xDataTOM_subAxes_getLabel ( statusMessageReporting smr,
xDataTOM_subAxes subAxes,
int  index 
)

Definition at line 126 of file xDataTOM_axes.cc.

126  {
127 
128  return( xDataTOM_axes_getLabel( smr, subAxes->axes, index + subAxes->offset ) );
129 }
xDataTOM_axes * axes
Definition: xDataTOM.h:76
char const * xDataTOM_axes_getLabel(statusMessageReporting *smr, xDataTOM_axes *axes, int index)

Here is the call graph for this function:

char const* xDataTOM_subAxes_getUnit ( statusMessageReporting smr,
xDataTOM_subAxes subAxes,
int  index 
)

Definition at line 133 of file xDataTOM_axes.cc.

133  {
134 
135  return( xDataTOM_axes_getUnit( smr, subAxes->axes, index + subAxes->offset ) );
136 }
xDataTOM_axes * axes
Definition: xDataTOM.h:76
char const * xDataTOM_axes_getUnit(statusMessageReporting *smr, xDataTOM_axes *axes, int index)

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOM_subAxes_initialize ( statusMessageReporting smr,
xDataTOM_subAxes subAxes,
enum xDataTOM_subAxesType  type,
int  offset,
xDataTOM_axes axes,
xDataTOM_interpolation interpolation 
)

Definition at line 89 of file xDataTOM_axes.cc.

90  {
91 
92  subAxes->type = type;
93  if( axes == NULL ) {
94  smr_setReportError2p( smr, xDataTOM_smrLibraryID, -1, "Axes must not be NULL" );
95  return( 1 );
96  }
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 );
100  return( 1 );
101  }
103  if( interpolation == NULL ) {
104  smr_setReportError2p( smr, xDataTOM_smrLibraryID, -1, "Interpolation must not be NULL for intepolationAxes" );
105  return( 1 );
106  }
107  if( xDataTOM_interpolation_copy( smr, &(subAxes->interpolation), interpolation ) ) return( 1 ); }
108  else { /* Not used but fill in anyway. */
111  }
112  subAxes->axes = axes;
113  return( 0 );
114 }
xDataTOM_interpolation interpolation
Definition: xDataTOM.h:77
xDataTOM_axes * axes
Definition: xDataTOM.h:76
int xDataTOM_smrLibraryID
Definition: xDataTOM.cc:34
int numberOfAxes
Definition: xDataTOM.h:69
#define smr_setReportError2p(smr, libraryID, code, fmt)
#define smr_setReportError2(smr, libraryID, code, fmt,...)
int xDataTOM_interpolation_set(statusMessageReporting *smr, xDataTOM_interpolation *interpolation, enum xDataTOM_interpolationFlag independent, enum xDataTOM_interpolationFlag dependent, enum xDataTOM_interpolationQualifier qualifier)
enum xDataTOM_subAxesType type
Definition: xDataTOM.h:74
int xDataTOM_interpolation_copy(statusMessageReporting *smr, xDataTOM_interpolation *desc, xDataTOM_interpolation *src)

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOM_subAxes_release ( xDataTOM_subAxes subAxes)

Definition at line 118 of file xDataTOM_axes.cc.

118  {
119 
120  subAxes->axes = NULL;
121  return( 0 );
122 }
xDataTOM_axes * axes
Definition: xDataTOM.h:76

Here is the caller graph for this function:

Variable Documentation

char const* xDataTOM_frame_centerOfMassString = "centerOfMass"
static

Definition at line 16 of file xDataTOM_axes.cc.

char const* xDataTOM_frame_invalidString = "invalid"
static

Definition at line 17 of file xDataTOM_axes.cc.

char const* xDataTOM_frame_labString = "lab"
static

Definition at line 15 of file xDataTOM_axes.cc.