Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
xDataTOM.cc File Reference
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include "xDataTOM_importXML_private.h"
#include "xDataTOM_private.h"
Include dependency graph for xDataTOM.cc:

Go to the source code of this file.

Macros

#define PATH_MAX   4096
 

Functions

static int xDataTOME_initializeElement (statusMessageReporting *smr, xDataTOM_element *element, xDataTOM_element *parent, int ordinal, int index, char const *name)
 
static void xDataTOME_displayTree (statusMessageReporting *smr, xDataTOM_element *element, int printAttributes, int level)
 
static int xDataTOM_initialize_xData (statusMessageReporting *smr, xDataTOM_xDataInfo *xDataInfo)
 
xDataTOM_TOMxDataTOM_importFile (statusMessageReporting *smr, const char *fileName)
 
xDataTOM_TOMxDataTOM_mallocTOM (statusMessageReporting *smr)
 
int xDataTOM_initializeTOM (statusMessageReporting *smr, xDataTOM_TOM *TOM)
 
voidxDataTOM_freeTOM (statusMessageReporting *, xDataTOM_TOM **TOM)
 
int xDataTOM_setFileNameTOM (statusMessageReporting *smr, xDataTOM_TOM *TOM, const char *fileName)
 
void xDataTOM_displayTree (statusMessageReporting *smr, xDataTOM_TOM *TOM, int printAttributes)
 
xDataTOM_elementxDataTOM_mallocElement (statusMessageReporting *smr, xDataTOM_element *parent, int ordinal, int index, char const *name)
 
void xDataTOM_freeElement (xDataTOM_element **element)
 
void xDataTOM_releaseElement (xDataTOM_element *element)
 
xDataTOM_elementxDataTOM_addElementInElement (statusMessageReporting *smr, xDataTOM_element *parent, int index, char const *name)
 
xDataTOM_elementxDataTOM_getDocumentsElement (xDataTOM_TOM *TOM)
 
xDataTOM_elementxDataTOME_getFirstElement (xDataTOM_element *element)
 
xDataTOM_elementxDataTOME_getNextElement (xDataTOM_element *element)
 
xDataTOM_elementxDataTOME_getOneElementByName (statusMessageReporting *smr, xDataTOM_element *element, char const *name, int required)
 
int xDataTOM_numberOfElementsByName (statusMessageReporting *, xDataTOM_element *element, char const *name)
 
int xDataTOME_addAttribute (statusMessageReporting *smr, xDataTOM_element *element, char const *name, char const *value)
 
char const * xDataTOM_getAttributesValueInElement (xDataTOM_element *element, char const *name)
 
int xDataTOME_copyAttributionList (statusMessageReporting *smr, xDataTOM_attributionList *desc, xDataTOM_element *element)
 
int xDataTOME_convertAttributeToInteger (statusMessageReporting *smr, xDataTOM_element *element, char const *name, int *n)
 
int xDataTOME_convertAttributeToDouble (statusMessageReporting *smr, xDataTOM_element *element, char const *name, double *d)
 
int xDataTOME_getInterpolation (statusMessageReporting *smr, xDataTOM_element *element, int index, enum xDataTOM_interpolationFlag *independent, enum xDataTOM_interpolationFlag *dependent, enum xDataTOM_interpolationQualifier *qualifier)
 
void xDataTOMAL_initial (statusMessageReporting *, xDataTOM_attributionList *attributes)
 
void xDataTOMAL_release (xDataTOM_attributionList *attributes)
 
int xDataTOMAL_addAttribute (statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, char const *value)
 
char const * xDataTOMAL_getAttributesValue (xDataTOM_attributionList *attributes, char const *name)
 
int xDataTOMAL_copyAttributionList (statusMessageReporting *smr, xDataTOM_attributionList *desc, xDataTOM_attributionList *src)
 
int xDataTOMAL_convertAttributeToInteger (statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, int *n)
 
int xDataTOMAL_convertAttributeToDouble (statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, double *d)
 
voidxData_initializeData (statusMessageReporting *smr, xDataTOM_element *TE, char const *ID, size_t size)
 
int xDataTOM_isXDataID (xDataTOM_element *TE, char const *ID)
 
xDataTOM_xDataInfoxDataTOME_getXData (xDataTOM_element *TE)
 
voidxDataTOME_getXDataIfID (statusMessageReporting *smr, xDataTOM_element *TE, char const *ID)
 

Variables

int xDataTOM_smrLibraryID = smr_unknownID
 

Macro Definition Documentation

#define PATH_MAX   4096

Definition at line 31 of file xDataTOM.cc.

Function Documentation

void* xData_initializeData ( statusMessageReporting smr,
xDataTOM_element TE,
char const *  ID,
size_t  size 
)

Definition at line 479 of file xDataTOM.cc.

479  {
480 
481  xDataTOM_xDataInfo *xDI = &(TE->xDataInfo);
482 
483  xDI->data = NULL;
484  xDI->ID = ID;
485  xDI->element = TE;
486  return( xDI->data = (void *) smr_malloc2( smr, size, 1, "xDI->data" ) );
487 }
const char * ID
Definition: xDataTOM.h:151
#define smr_malloc2(smr, size, zero, forItem)
xDataTOM_xDataInfo xDataInfo
Definition: xDataTOM.h:187
xDataTOM_element * element
Definition: xDataTOM.h:152

Here is the caller graph for this function:

xDataTOM_element* xDataTOM_addElementInElement ( statusMessageReporting smr,
xDataTOM_element parent,
int  index,
char const *  name 
)

Definition at line 188 of file xDataTOM.cc.

188  {
189 
190  xDataTOM_element *element;
191 
192  if( ( element = xDataTOM_mallocElement( smr, parent, parent->numberOfChildren, index, name ) ) == NULL ) return( NULL );
193  if( parent->children == NULL ) {
194  parent->children = element; }
195  else {
196  xDataTOM_element *last;
197 
198  for( last = parent->children; last->next != NULL; last = last->next ) ;
199  last->next = element;
200  }
201  (parent->numberOfChildren)++;
202  return( element );
203 }
const XML_Char * name
Definition: expat.h:151
xDataTOM_element * next
Definition: xDataTOM.h:182
xDataTOM_element * children
Definition: xDataTOM.h:186
xDataTOM_element * xDataTOM_mallocElement(statusMessageReporting *smr, xDataTOM_element *parent, int ordinal, int index, char const *name)
Definition: xDataTOM.cc:125

Here is the call graph for this function:

Here is the caller graph for this function:

void xDataTOM_displayTree ( statusMessageReporting smr,
xDataTOM_TOM TOM,
int  printAttributes 
)

Definition at line 114 of file xDataTOM.cc.

114  {
115 
116  if( TOM->root.children != NULL ) xDataTOME_displayTree( smr, TOM->root.children, printAttributes, 0 );
117 }
xDataTOM_element * children
Definition: xDataTOM.h:186
xDataTOM_element root
Definition: xDataTOM.h:193
static void xDataTOME_displayTree(statusMessageReporting *smr, xDataTOM_element *element, int printAttributes, int level)
Definition: xDataTOM.cc:326

Here is the call graph for this function:

void xDataTOM_freeElement ( xDataTOM_element **  element)

Definition at line 139 of file xDataTOM.cc.

139  {
140 
141  if( element == NULL ) return;
142  xDataTOM_releaseElement( *element );
143  smr_freeMemory( (void **) element );
144 }
void xDataTOM_releaseElement(xDataTOM_element *element)
Definition: xDataTOM.cc:148
void * smr_freeMemory(void **p)

Here is the call graph for this function:

Here is the caller graph for this function:

void* xDataTOM_freeTOM ( statusMessageReporting ,
xDataTOM_TOM **  TOM 
)

Definition at line 78 of file xDataTOM.cc.

78  {
79 
80  xDataTOM_TOM *TOMp;
81 
82  if( TOM == NULL ) return( NULL );
83  TOMp = *TOM;
84  if( TOMp == NULL ) return( NULL );
85  xDataTOM_releaseElement( &(TOMp->root) );
86  smr_freeMemory( (void **) &(TOMp->fileName) );
87  smr_freeMemory( (void **) &(TOMp->realFileName) );
88  smr_freeMemory( (void **) TOM );
89  return( NULL );
90 }
void xDataTOM_releaseElement(xDataTOM_element *element)
Definition: xDataTOM.cc:148
char * realFileName
Definition: xDataTOM.h:192
char * fileName
Definition: xDataTOM.h:191
void * smr_freeMemory(void **p)
xDataTOM_element root
Definition: xDataTOM.h:193

Here is the call graph for this function:

Here is the caller graph for this function:

char const* xDataTOM_getAttributesValueInElement ( xDataTOM_element element,
char const *  name 
)

Definition at line 286 of file xDataTOM.cc.

286  {
287 
288  return( xDataTOMAL_getAttributesValue( &(element->attributes), name ) );
289 }
const XML_Char * name
Definition: expat.h:151
xDataTOM_attributionList attributes
Definition: xDataTOM.h:184
char const * xDataTOMAL_getAttributesValue(xDataTOM_attributionList *attributes, char const *name)
Definition: xDataTOM.cc:403

Here is the call graph for this function:

Here is the caller graph for this function:

xDataTOM_element* xDataTOM_getDocumentsElement ( xDataTOM_TOM TOM)

Definition at line 223 of file xDataTOM.cc.

223  {
224 
225  return( TOM->root.children );
226 }
xDataTOM_element * children
Definition: xDataTOM.h:186
xDataTOM_element root
Definition: xDataTOM.h:193

Here is the caller graph for this function:

xDataTOM_TOM* xDataTOM_importFile ( statusMessageReporting smr,
const char *  fileName 
)

Definition at line 44 of file xDataTOM.cc.

44  {
45 /*
46 * Returns NULL is an error occurred.
47 */
48 
49  return( xDataXML_importFile( smr, fileName ) );
50 }
xDataTOM_TOM * xDataXML_importFile(statusMessageReporting *smr, char const *fileName)

Here is the call graph for this function:

Here is the caller graph for this function:

static int xDataTOM_initialize_xData ( statusMessageReporting smr,
xDataTOM_xDataInfo xDataInfo 
)
static

Definition at line 472 of file xDataTOM.cc.

472  {
473 
474  return( 0 );
475 }

Here is the caller graph for this function:

int xDataTOM_initializeTOM ( statusMessageReporting smr,
xDataTOM_TOM TOM 
)

Definition at line 68 of file xDataTOM.cc.

68  {
69 
70  TOM->fileName = NULL;
71  TOM->realFileName = NULL;
72  xDataTOME_initializeElement( smr, &(TOM->root), NULL, 0, 0, "" );
73  return( !smr_isOk( smr ) );
74 }
char * realFileName
Definition: xDataTOM.h:192
static int xDataTOME_initializeElement(statusMessageReporting *smr, xDataTOM_element *element, xDataTOM_element *parent, int ordinal, int index, char const *name)
Definition: xDataTOM.cc:207
char * fileName
Definition: xDataTOM.h:191
int smr_isOk(statusMessageReporting *smr)
xDataTOM_element root
Definition: xDataTOM.h:193

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOM_isXDataID ( xDataTOM_element TE,
char const *  ID 
)

Definition at line 491 of file xDataTOM.cc.

491  {
492 
493  xDataTOM_xDataInfo *xDI = &(TE->xDataInfo);
494 
495  if( xDI->ID != NULL ) {
496  return( !strcmp( xDI->ID, ID ) );
497  }
498 
499  return( 0 );
500 }
const char * ID
Definition: xDataTOM.h:151
xDataTOM_xDataInfo xDataInfo
Definition: xDataTOM.h:187
xDataTOM_element* xDataTOM_mallocElement ( statusMessageReporting smr,
xDataTOM_element parent,
int  ordinal,
int  index,
char const *  name 
)

Definition at line 125 of file xDataTOM.cc.

125  {
126 /*
127 * Returns NULL is an error occurred.
128 */
129  xDataTOM_element *element;
130 
131  if( ( element = (xDataTOM_element *) smr_malloc2( smr, sizeof( xDataTOM_element ), 1, "xDataTOM_elelument" ) ) != NULL ) {
132  if( xDataTOME_initializeElement( smr, element, parent, ordinal, index, name ) ) smr_freeMemory( (void **) &element );
133  }
134  return( element );
135 }
const XML_Char * name
Definition: expat.h:151
static int xDataTOME_initializeElement(statusMessageReporting *smr, xDataTOM_element *element, xDataTOM_element *parent, int ordinal, int index, char const *name)
Definition: xDataTOM.cc:207
#define smr_malloc2(smr, size, zero, forItem)
void * smr_freeMemory(void **p)

Here is the call graph for this function:

Here is the caller graph for this function:

xDataTOM_TOM* xDataTOM_mallocTOM ( statusMessageReporting smr)

Definition at line 54 of file xDataTOM.cc.

54  {
55 /*
56 * Returns NULL is an error occurred.
57 */
58  xDataTOM_TOM *TOM;
59 
60  if( ( TOM = (xDataTOM_TOM *) smr_malloc2( smr, sizeof( xDataTOM_TOM ), 1, "xDataTOM_TOM" ) ) != NULL ) {
61  if( xDataTOM_initializeTOM( smr, TOM ) ) smr_freeMemory( (void **) &TOM );
62  }
63  return( TOM );
64 }
int xDataTOM_initializeTOM(statusMessageReporting *smr, xDataTOM_TOM *doc)
Definition: xDataTOM.cc:68
#define smr_malloc2(smr, size, zero, forItem)
void * smr_freeMemory(void **p)

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOM_numberOfElementsByName ( statusMessageReporting ,
xDataTOM_element element,
char const *  name 
)

Definition at line 268 of file xDataTOM.cc.

268  {
269 
270  int n = 0;
271  xDataTOM_element *child;
272 
273  for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) if( !strcmp( child->name, name ) ) n++;
274  return( n );
275 }
const XML_Char * name
Definition: expat.h:151
xDataTOM_element * xDataTOME_getFirstElement(xDataTOM_element *element)
Definition: xDataTOM.cc:230
xDataTOM_element * xDataTOME_getNextElement(xDataTOM_element *element)
Definition: xDataTOM.cc:238

Here is the call graph for this function:

Here is the caller graph for this function:

void xDataTOM_releaseElement ( xDataTOM_element element)

Definition at line 148 of file xDataTOM.cc.

148  {
149 
150  xDataTOM_element *child, *nextChild;
151 
152  if( element == NULL ) return;
153  xDataTOMAL_release( &(element->attributes) );
154  for( child = element->children; child != NULL; child = nextChild ) {
155  nextChild = child->next;
156  xDataTOM_freeElement( &child );
157  }
158  if( element->xDataInfo.ID != NULL ) {
159  xDataTOM_axes_release( &(element->xDataInfo.axes) );
160  if( strcmp( element->xDataInfo.ID, xDataTOM_XYs_ID ) == 0 ) {
161  xDataTOM_XYs_free( &(element->xDataInfo ) ); }
162  else if( strcmp( element->xDataInfo.ID, xDataTOM_regionsXYs_ID ) == 0 ) {
163  xDataTOM_regionsXYs_free( &(element->xDataInfo ) ); }
164  else if( strcmp( element->xDataInfo.ID, xDataTOM_W_XYs_ID ) == 0 ) {
166  else if( strcmp( element->xDataInfo.ID, xDataTOM_V_W_XYs_ID ) == 0 ) {
167  xDataTOM_V_W_XYs_free( &(element->xDataInfo ) ); }
168  else if( strcmp( element->xDataInfo.ID, xDataTOM_W_XYs_LegendreSeries_ID ) == 0 ) {
170  else if( strcmp( element->xDataInfo.ID, xDataTOM_regionsW_XYs_LegendreSeries_ID ) == 0 ) {
172  else if( strcmp( element->xDataInfo.ID, xDataTOM_V_W_XYs_LegendreSeries_ID ) == 0 ) {
174  else if( strcmp( element->xDataInfo.ID, xDataTOM_KalbachMann_ID ) == 0 ) {
175  xDataTOM_KalbachMann_free( &(element->xDataInfo ) ); }
176  else if( strcmp( element->xDataInfo.ID, xDataTOM_polynomial_ID ) == 0 ) {
177  xDataTOM_polynomial_free( &(element->xDataInfo ) ); }
178  else {
179  printf( "not freed for %s\n", element->xDataInfo.ID );
180  }
181  }
182  element->parent = NULL;
183  smr_freeMemory( (void **) &(element->name) );
184 }
int xDataTOM_axes_release(xDataTOM_axes *axes)
int xDataTOM_polynomial_free(xDataTOM_xDataInfo *xDI)
xDataTOM_element * next
Definition: xDataTOM.h:182
int xDataTOM_regionsXYs_free(xDataTOM_xDataInfo *xDI)
char const * xDataTOM_XYs_ID
Definition: xDataTOM_XYs.cc:14
int xDataTOM_W_XYs_freeFrom_xDataInfo(xDataTOM_xDataInfo *xDI)
int xDataTOM_W_XYs_LegendreSeries_free(xDataTOM_xDataInfo *xDI)
void xDataTOM_freeElement(xDataTOM_element **element)
Definition: xDataTOM.cc:139
const char * ID
Definition: xDataTOM.h:151
xDataTOM_attributionList attributes
Definition: xDataTOM.h:184
char const * xDataTOM_V_W_XYs_ID
char const * xDataTOM_KalbachMann_ID
int xDataTOM_KalbachMann_free(xDataTOM_xDataInfo *xDI)
char const * xDataTOM_W_XYs_LegendreSeries_ID
void xDataTOMAL_release(xDataTOM_attributionList *attributes)
Definition: xDataTOM.cc:361
int xDataTOM_V_W_XYs_LegendreSeries_free(xDataTOM_xDataInfo *xDI)
int xDataTOM_regionsW_XYs_LegendreSeries_free(xDataTOM_xDataInfo *xDI)
void * smr_freeMemory(void **p)
xDataTOM_axes axes
Definition: xDataTOM.h:153
xDataTOM_element * children
Definition: xDataTOM.h:186
char const * xDataTOM_V_W_XYs_LegendreSeries_ID
int xDataTOM_V_W_XYs_free(xDataTOM_xDataInfo *xDI)
xDataTOM_xDataInfo xDataInfo
Definition: xDataTOM.h:187
char const * xDataTOM_regionsW_XYs_LegendreSeries_ID
char const * xDataTOM_W_XYs_ID
char const * xDataTOM_polynomial_ID
int xDataTOM_XYs_free(xDataTOM_xDataInfo *xDI)
Definition: xDataTOM_XYs.cc:19
char const * xDataTOM_regionsXYs_ID
xDataTOM_element * parent
Definition: xDataTOM.h:181

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOM_setFileNameTOM ( statusMessageReporting smr,
xDataTOM_TOM TOM,
const char *  fileName 
)

Definition at line 94 of file xDataTOM.cc.

94  {
95 /*
96 * Returns not zero value if error occurred.
97 */
98 
99  char realPath[PATH_MAX+1];
100 
101  smr_freeMemory( (void **) &(TOM->fileName) );
102  smr_freeMemory( (void **) &(TOM->realFileName) );
103  if( fileName != NULL ) {
104  if( ( TOM->fileName = smr_allocateCopyString2( smr, fileName, "fileName" ) ) == NULL ) return( 1 );
105  if( realpath( fileName, realPath ) != NULL ) {
106  if( ( TOM->realFileName = smr_allocateCopyString2( smr, realPath, "realFileName" ) ) == NULL ) return( 1 );
107  }
108  }
109  return( 0 );
110 }
#define smr_allocateCopyString2(smr, s, forItem)
char * realFileName
Definition: xDataTOM.h:192
#define PATH_MAX
Definition: xDataTOM.cc:31
char * fileName
Definition: xDataTOM.h:191
void * smr_freeMemory(void **p)

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOMAL_addAttribute ( statusMessageReporting smr,
xDataTOM_attributionList attributes,
char const *  name,
char const *  value 
)

Definition at line 376 of file xDataTOM.cc.

376  {
377 
378  xDataTOM_attribute *attribute;
379 
380  if( ( attribute = (xDataTOM_attribute *) smr_malloc2( smr, sizeof( xDataTOM_attribute ), 1, "xDataTOM_attribute" ) ) == NULL ) return( 1 );
381  if( ( attribute->name = smr_allocateCopyString2( smr, name, "name" ) ) == NULL ) goto err;
382  if( ( attribute->value = smr_allocateCopyString2( smr, value, "value" ) ) == NULL ) goto err;
383  if( attributes->attributes == NULL ) {
384  attributes->attributes = attribute; }
385  else {
386  xDataTOM_attribute *last;
387 
388  for( last = attributes->attributes; last->next != NULL; last = last->next ) ;
389  last->next = attribute;
390  }
391  attributes->number++;
392  return( 0 );
393 
394 err:
395  smr_freeMemory( (void **) &(attribute->name) );
396  smr_freeMemory( (void **) &(attribute->value) );
397  smr_freeMemory( (void **) &(attribute) );
398  return( 1 );
399 }
const XML_Char * name
Definition: expat.h:151
#define smr_allocateCopyString2(smr, s, forItem)
xDataTOM_attribute * attributes
Definition: xDataTOM.h:165
xDataTOM_attribute * next
Definition: xDataTOM.h:158
const XML_Char int const XML_Char * value
Definition: expat.h:331
#define smr_malloc2(smr, size, zero, forItem)
void * smr_freeMemory(void **p)

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOMAL_convertAttributeToDouble ( statusMessageReporting smr,
xDataTOM_attributionList attributes,
char const *  name,
double *  d 
)

Definition at line 450 of file xDataTOM.cc.

450  {
451 
452  char const *value = xDataTOMAL_getAttributesValue( attributes, name );
453  char *e;
454 
455  if( value != NULL ) {
456  *d = strtod( value, &e );
457  if( *e == 0 ) return( 0 );
458  smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "could not convert attribute %s's values = '%s' to a double", name, value ); }
459  else {
460  smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "no attribute named '%s'", name );
461  }
462  return( 1 );
463 }
const XML_Char * name
Definition: expat.h:151
int xDataTOM_smrLibraryID
Definition: xDataTOM.cc:34
char const * xDataTOMAL_getAttributesValue(xDataTOM_attributionList *attributes, char const *name)
Definition: xDataTOM.cc:403
#define smr_setReportError2(smr, libraryID, code, fmt,...)
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOMAL_convertAttributeToInteger ( statusMessageReporting smr,
xDataTOM_attributionList attributes,
char const *  name,
int n 
)

Definition at line 433 of file xDataTOM.cc.

433  {
434 
435  char const *value = xDataTOMAL_getAttributesValue( attributes, name );
436  char *e;
437 
438  if( value != NULL ) {
439  *n = (int) strtoll( value, &e, 10 );
440  if( *e == 0 ) return( 0 );
441  smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "could not convert attribute %s's value = '%s' to an integer", name, value ); }
442  else {
443  smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "no attribute named '%s'", name );
444  }
445  return( 1 );
446 }
const XML_Char * name
Definition: expat.h:151
int xDataTOM_smrLibraryID
Definition: xDataTOM.cc:34
char const * xDataTOMAL_getAttributesValue(xDataTOM_attributionList *attributes, char const *name)
Definition: xDataTOM.cc:403
#define smr_setReportError2(smr, libraryID, code, fmt,...)
const XML_Char int const XML_Char * value
Definition: expat.h:331
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOMAL_copyAttributionList ( statusMessageReporting smr,
xDataTOM_attributionList desc,
xDataTOM_attributionList src 
)

Definition at line 415 of file xDataTOM.cc.

415  {
416 
417  xDataTOM_attribute *attribute;
418 
419  xDataTOMAL_initial( smr, desc );
420  for( attribute = src->attributes; attribute != NULL; attribute = attribute->next ) {
421  if( xDataTOMAL_addAttribute( smr, desc, attribute->name, attribute->value ) != 0 ) goto err;
422 
423  }
424  return( 0 );
425 
426 err:
427  xDataTOMAL_release( desc );
428  return( 1 );
429 }
xDataTOM_attribute * attributes
Definition: xDataTOM.h:165
xDataTOM_attribute * next
Definition: xDataTOM.h:158
void xDataTOMAL_initial(statusMessageReporting *smr, xDataTOM_attributionList *attributes)
Definition: xDataTOM.cc:353
void xDataTOMAL_release(xDataTOM_attributionList *attributes)
Definition: xDataTOM.cc:361
int xDataTOMAL_addAttribute(statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, char const *value)
Definition: xDataTOM.cc:376

Here is the call graph for this function:

Here is the caller graph for this function:

char const* xDataTOMAL_getAttributesValue ( xDataTOM_attributionList attributes,
char const *  name 
)

Definition at line 403 of file xDataTOM.cc.

403  {
404 
405  xDataTOM_attribute *attribute;
406 
407  for( attribute = attributes->attributes; attribute != NULL; attribute = attribute->next ) {
408  if( !strcmp( attribute->name, name ) ) return( attribute->value );
409  }
410  return( NULL );
411 }
const XML_Char * name
Definition: expat.h:151
xDataTOM_attribute * attributes
Definition: xDataTOM.h:165
xDataTOM_attribute * next
Definition: xDataTOM.h:158

Here is the caller graph for this function:

void xDataTOMAL_initial ( statusMessageReporting ,
xDataTOM_attributionList attributes 
)

Definition at line 353 of file xDataTOM.cc.

353  {
354 
355  attributes->number = 0;
356  attributes->attributes = NULL;
357 }
xDataTOM_attribute * attributes
Definition: xDataTOM.h:165

Here is the caller graph for this function:

void xDataTOMAL_release ( xDataTOM_attributionList attributes)

Definition at line 361 of file xDataTOM.cc.

361  {
362 
363  xDataTOM_attribute *attribute, *next;
364 
365  for( attribute = attributes->attributes; attribute != NULL; attribute = next ) {
366  next = attribute->next;
367  smr_freeMemory( (void **) &(attribute->name) );
368  smr_freeMemory( (void **) &(attribute->value) );
369  smr_freeMemory( (void **) &(attribute) );
370  }
371  xDataTOMAL_initial( NULL, attributes );
372 }
xDataTOM_attribute * attributes
Definition: xDataTOM.h:165
xDataTOM_attribute * next
Definition: xDataTOM.h:158
void xDataTOMAL_initial(statusMessageReporting *smr, xDataTOM_attributionList *attributes)
Definition: xDataTOM.cc:353
void * smr_freeMemory(void **p)

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOME_addAttribute ( statusMessageReporting smr,
xDataTOM_element element,
char const *  name,
char const *  value 
)

Definition at line 279 of file xDataTOM.cc.

279  {
280 
281  return( xDataTOMAL_addAttribute( smr, &(element->attributes), name, value ) );
282 }
const XML_Char * name
Definition: expat.h:151
xDataTOM_attributionList attributes
Definition: xDataTOM.h:184
const XML_Char int const XML_Char * value
Definition: expat.h:331
int xDataTOMAL_addAttribute(statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, char const *value)
Definition: xDataTOM.cc:376

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOME_convertAttributeToDouble ( statusMessageReporting smr,
xDataTOM_element element,
char const *  name,
double *  d 
)

Definition at line 307 of file xDataTOM.cc.

307  {
308 
309  return( xDataTOMAL_convertAttributeToDouble( smr, &(element->attributes), name, d ) );
310 }
const XML_Char * name
Definition: expat.h:151
xDataTOM_attributionList attributes
Definition: xDataTOM.h:184
int xDataTOMAL_convertAttributeToDouble(statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, double *d)
Definition: xDataTOM.cc:450

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOME_convertAttributeToInteger ( statusMessageReporting smr,
xDataTOM_element element,
char const *  name,
int n 
)

Definition at line 300 of file xDataTOM.cc.

300  {
301 
302  return( xDataTOMAL_convertAttributeToInteger( smr, &(element->attributes), name, n ) );
303 }
const XML_Char * name
Definition: expat.h:151
xDataTOM_attributionList attributes
Definition: xDataTOM.h:184
int xDataTOMAL_convertAttributeToInteger(statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, int *n)
Definition: xDataTOM.cc:433

Here is the call graph for this function:

Here is the caller graph for this function:

int xDataTOME_copyAttributionList ( statusMessageReporting smr,
xDataTOM_attributionList desc,
xDataTOM_element element 
)

Definition at line 293 of file xDataTOM.cc.

293  {
294 
295  return( xDataTOMAL_copyAttributionList( smr, desc, &(element->attributes) ) );
296 }
int xDataTOMAL_copyAttributionList(statusMessageReporting *smr, xDataTOM_attributionList *desc, xDataTOM_attributionList *src)
Definition: xDataTOM.cc:415
xDataTOM_attributionList attributes
Definition: xDataTOM.h:184

Here is the call graph for this function:

Here is the caller graph for this function:

static void xDataTOME_displayTree ( statusMessageReporting smr,
xDataTOM_element element,
int  printAttributes,
int  level 
)
static

Definition at line 326 of file xDataTOM.cc.

326  {
327 
328  int i;
329  xDataTOM_element *child;
330 
331  for( i = 0; i < level; i++ ) printf( " " );
332  printf( "/%s", element->name );
333  if( element->index >= 0 ) printf( " (%d)", element->index );
334  if( printAttributes ) {
335  xDataTOM_attribute *attribute;
336 
337  for( attribute = element->attributes.attributes; attribute != NULL; attribute = attribute->next ) {
338  printf( " (%s, \"%s\")", attribute->name, attribute->value );
339  }
340  }
341  printf( "\n" );
342  for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) {
343  xDataTOME_displayTree( smr, child, printAttributes, level + 1 );
344  }
345 }
xDataTOM_attribute * attributes
Definition: xDataTOM.h:165
xDataTOM_element * xDataTOME_getFirstElement(xDataTOM_element *element)
Definition: xDataTOM.cc:230
xDataTOM_attribute * next
Definition: xDataTOM.h:158
xDataTOM_attributionList attributes
Definition: xDataTOM.h:184
static void xDataTOME_displayTree(statusMessageReporting *smr, xDataTOM_element *element, int printAttributes, int level)
Definition: xDataTOM.cc:326
xDataTOM_element * xDataTOME_getNextElement(xDataTOM_element *element)
Definition: xDataTOM.cc:238

Here is the call graph for this function:

Here is the caller graph for this function:

xDataTOM_element* xDataTOME_getFirstElement ( xDataTOM_element element)

Definition at line 230 of file xDataTOM.cc.

230  {
231 
232  if( element != NULL ) element = element->children;
233  return( element );
234 }
xDataTOM_element * children
Definition: xDataTOM.h:186

Here is the caller graph for this function:

int xDataTOME_getInterpolation ( statusMessageReporting smr,
xDataTOM_element element,
int  index,
enum xDataTOM_interpolationFlag independent,
enum xDataTOM_interpolationFlag dependent,
enum xDataTOM_interpolationQualifier qualifier 
)

Definition at line 314 of file xDataTOM.cc.

315  {
316 
317  xDataTOM_xDataInfo *xDI = &(element->xDataInfo);
318 
319  if( xDI->ID == NULL ) return( 1 );
320 
321  return( xDataTOM_axes_getInterpolation( smr, &(xDI->axes), index, independent, dependent, qualifier ) );
322 }
int xDataTOM_axes_getInterpolation(statusMessageReporting *smr, xDataTOM_axes *axes, int index, enum xDataTOM_interpolationFlag *independent, enum xDataTOM_interpolationFlag *dependent, enum xDataTOM_interpolationQualifier *qualifier)
const char * ID
Definition: xDataTOM.h:151
xDataTOM_axes axes
Definition: xDataTOM.h:153
xDataTOM_xDataInfo xDataInfo
Definition: xDataTOM.h:187

Here is the call graph for this function:

Here is the caller graph for this function:

xDataTOM_element* xDataTOME_getNextElement ( xDataTOM_element element)

Definition at line 238 of file xDataTOM.cc.

238  {
239 
240  if( element != NULL ) element = element->next;
241  return( element );
242 }
xDataTOM_element * next
Definition: xDataTOM.h:182

Here is the caller graph for this function:

xDataTOM_element* xDataTOME_getOneElementByName ( statusMessageReporting smr,
xDataTOM_element element,
char const *  name,
int  required 
)

Definition at line 246 of file xDataTOM.cc.

246  {
247 
248  int n = 0;
249  xDataTOM_element *child, *desired = NULL;
250 
251  for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) {
252  if( strcmp( child->name, name ) == 0 ) {
253  if( n == 0 ) desired = child;
254  n++;
255  }
256  }
257  if( n == 0 ) {
258  if( required ) smr_setReportError2( smr, smr_unknownID, 1, "elements '%s' not found in element '%s'", name, element->name ); }
259  else if( n > 1 ) {
260  smr_setReportError2( smr, smr_unknownID, 1, "multiple (= %d) elements '%s' found in element '%s'", name, element->name );
261  desired = NULL;
262  }
263  return( desired );
264 }
const XML_Char * name
Definition: expat.h:151
xDataTOM_element * xDataTOME_getFirstElement(xDataTOM_element *element)
Definition: xDataTOM.cc:230
#define smr_setReportError2(smr, libraryID, code, fmt,...)
#define smr_unknownID
xDataTOM_element * xDataTOME_getNextElement(xDataTOM_element *element)
Definition: xDataTOM.cc:238

Here is the call graph for this function:

Here is the caller graph for this function:

xDataTOM_xDataInfo* xDataTOME_getXData ( xDataTOM_element TE)

Definition at line 504 of file xDataTOM.cc.

504  {
505 
506  if( TE->xDataInfo.ID == NULL ) return( NULL );
507  return( &(TE->xDataInfo) );
508 }
const char * ID
Definition: xDataTOM.h:151
xDataTOM_xDataInfo xDataInfo
Definition: xDataTOM.h:187

Here is the caller graph for this function:

void* xDataTOME_getXDataIfID ( statusMessageReporting smr,
xDataTOM_element TE,
char const *  ID 
)

Definition at line 512 of file xDataTOM.cc.

512  {
513 
515 
516  if( xDI == NULL ) {
517  smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "element '%s' does not have xData", TE->name );
518  return( NULL );
519  }
520  if( strcmp( ID, xDI->ID ) ) {
521  smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "xData has ID = '%s' not '%s' for element %s", xDI->ID, ID, TE->name );
522  return( NULL );
523  }
524  return( xDI->data );
525 
526 }
int xDataTOM_smrLibraryID
Definition: xDataTOM.cc:34
xDataTOM_xDataInfo * xDataTOME_getXData(xDataTOM_element *TE)
Definition: xDataTOM.cc:504
const char * ID
Definition: xDataTOM.h:151
#define smr_setReportError2(smr, libraryID, code, fmt,...)

Here is the call graph for this function:

Here is the caller graph for this function:

static int xDataTOME_initializeElement ( statusMessageReporting smr,
xDataTOM_element element,
xDataTOM_element parent,
int  ordinal,
int  index,
char const *  name 
)
static

Definition at line 207 of file xDataTOM.cc.

208  {
209 
210  element->ordinal = ordinal;
211  element->index = index;
212  element->parent = parent;
213  element->next = NULL;
214  element->name = smr_allocateCopyString2( smr, name, "element->name" );
215  xDataTOMAL_initial( smr, &(element->attributes) );
216  element->numberOfChildren = 0;
217  element->children = NULL;
218  return( ( xDataTOM_initialize_xData( smr, &(element->xDataInfo) ) || ( element->name == NULL ) ) ? 1 : 0 );
219 }
const XML_Char * name
Definition: expat.h:151
#define smr_allocateCopyString2(smr, s, forItem)
xDataTOM_element * next
Definition: xDataTOM.h:182
static int xDataTOM_initialize_xData(statusMessageReporting *smr, xDataTOM_xDataInfo *xDataInfo)
Definition: xDataTOM.cc:472
xDataTOM_attributionList attributes
Definition: xDataTOM.h:184
void xDataTOMAL_initial(statusMessageReporting *smr, xDataTOM_attributionList *attributes)
Definition: xDataTOM.cc:353
xDataTOM_element * children
Definition: xDataTOM.h:186
xDataTOM_xDataInfo xDataInfo
Definition: xDataTOM.h:187
xDataTOM_element * parent
Definition: xDataTOM.h:181

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int xDataTOM_smrLibraryID = smr_unknownID

Definition at line 34 of file xDataTOM.cc.