Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
xDataTOM_importXML_regionsXYs.cc File Reference
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include "xDataTOM_importXML_private.h"

Go to the source code of this file.

Functions

int xDataXML_regionsXYsToTOM (statusMessageReporting *smr, xDataXML_element *XE, xDataTOM_element *TE)
 

Function Documentation

◆ xDataXML_regionsXYsToTOM()

int xDataXML_regionsXYsToTOM ( statusMessageReporting smr,
xDataXML_element XE,
xDataTOM_element TE 
)

Definition at line 23 of file xDataTOM_importXML_regionsXYs.cc.

23 {
24
25 int index;
26 xDataTOM_xDataInfo *xDI = &(TE->xDataInfo);
27 xDataXML_element *XMLChild;
28 xDataTOM_regionsXYs *regionsXYs;
29
30 if( ( xDI->data = xDataXML_initializeData( smr, XE, TE, xDataTOM_regionsXYs_ID, sizeof( xDataTOM_regionsXYs ) ) ) == NULL ) return( 1 );
31 regionsXYs = (xDataTOM_regionsXYs *) xDI->data;
32 regionsXYs->axes = &(xDI->axes);
33 regionsXYs->length = xDataXML_numberOfElementsByTagName( smr, XE, "region" );
34 if( ( regionsXYs->XYs = (xDataTOM_XYs *) smr_malloc2( smr, regionsXYs->length * sizeof( xDataTOM_XYs ), 1, "regionsXYs->XYs" ) ) == NULL ) goto err;
35
36
37 for( XMLChild = xDataXML_getFirstElement( XE ), index = 0; XMLChild != NULL; XMLChild = xDataXML_getNextElement( XMLChild ) ) {
38 if( strcmp( "axes", XMLChild->name ) == 0 ) {
39 continue; }
40 else if( strcmp( "region", XMLChild->name ) == 0 ) {
41 if( xDataXML_regionsXYs_regionToTOM( smr, XMLChild, &(regionsXYs->XYs[index]), regionsXYs->axes ) != 0 ) goto err;
42 index++; }
43 else {
45 "invalid element '%s' in xData 'regionsXYs'", XMLChild->name );
46 goto err;
47 }
48 }
49
50 return( 0 );
51
52err:
53/* Need to free things here?????????.*/
54 return( 1 );
55}
#define smr_setReportError3(smr, userInterface, libraryID, code, fmt,...)
#define smr_malloc2(smr, size, zero, forItem)
xDataTOM_xDataInfo xDataInfo
Definition: xDataTOM.h:187
xDataTOM_XYs * XYs
Definition: xDataTOM.h:90
xDataTOM_axes * axes
Definition: xDataTOM.h:89
xDataTOM_axes axes
Definition: xDataTOM.h:153
void * xDataXML_initializeData(statusMessageReporting *smr, xDataXML_element *XE, xDataTOM_element *TE, char const *ID, size_t size)
void * xDataXML_get_smrUserInterfaceFromElement(xDataXML_element *element)
xDataXML_element * xDataXML_getNextElement(xDataXML_element *element)
xDataXML_element * xDataXML_getFirstElement(xDataXML_element *element)
int xDataXML_numberOfElementsByTagName(statusMessageReporting *smr, xDataXML_element *element, char const *tagName)
char const * xDataTOM_regionsXYs_ID
int xDataTOM_smrLibraryID
Definition: xDataTOM.cc:34