Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
xData.h
Go to the documentation of this file.
1/*
2# <<BEGIN-copyright>>
3# Copyright (c) 2010, Lawrence Livermore National Security, LLC.
4# Produced at the Lawrence Livermore National Laboratory
5# Written by Bret R. Beck, [email protected].
6# CODE-461393
7# All rights reserved.
8#
9# This file is part of GIDI. For details, see nuclear.llnl.gov.
10# Please also read the "Additional BSD Notice" at nuclear.llnl.gov.
11#
12# Redistribution and use in source and binary forms, with or without modification,
13# are permitted provided that the following conditions are met:
14#
15# 1) Redistributions of source code must retain the above copyright notice,
16# this list of conditions and the disclaimer below.
17# 2) Redistributions in binary form must reproduce the above copyright notice,
18# this list of conditions and the disclaimer (as noted below) in the
19# documentation and/or other materials provided with the distribution.
20# 3) Neither the name of the LLNS/LLNL nor the names of its contributors may be
21# used to endorse or promote products derived from this software without
22# specific prior written permission.
23#
24# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
25# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
27# SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR
28# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34# <<END-copyright>>
35*/
36#ifndef xData_h_included
37#define xData_h_included
38
39#if defined __cplusplus
40 extern "C" {
41#endif
42
43#include <expat.h>
45
46#if defined __cplusplus
47 namespace GIDI {
48#endif
49
50typedef int xData_Int;
51
52#ifndef XMLCALL
53#define XMLCALL
54#endif
55
56#ifndef XML_Char
57#define XML_Char char
58#endif
59
60#ifndef XML_Size
61#define XML_Size long
62#endif
63
64//TK move follwoing reference from source
65//extern char const * const xData_oned_x_ID;
66//extern char const * const xData_twod_xy_ID;
67//extern char const * const xData_twod_xindex_y_ID;
68//extern char const * const xData_twod_xShared_yHistogram_ID;
69//extern char const * const xData_matrix_ID;
70
71char const * const xData_oned_x_ID = "1d.x";
72char const * const xData_twod_xy_ID = "2d.xy";
73char const * const xData_twod_xindex_y_ID = "2d.xindex_y";
74char const * const xData_twod_xShared_yHistogram_ID = "2d_xShared_yHistogram";
75char const * const xData_matrix_ID = "matrix";
76
82
88typedef struct xData_text_s xData_text;
89typedef struct xDataType_s xDataType;
90typedef struct xData_smr_s xData_smr;
92typedef struct xData_item_s xData_item;
98
99typedef int (*xData_sortElementFunc)( const void *, const void * );
100
103 double value;
104};
105
107 xData_Int row, start, end;
108};
109
113 double *values;
114};
115
117 size_t line;
118 size_t column;
119};
120
122 char *name;
123 char *value;
124};
125
128 size_t size;
130};
131
134 size_t allocated;
135 size_t length;
136 char *text;
137};
138
139typedef int (*xData_xDataTypeOk)( char const *name, xData_document *doc, void *userData );
141typedef char *(*xDT_toStringFunction)( statusMessageReporting *smr, xDataType * );
143
146 const char *sortString;
147};
148
150 int n;
152};
153
156 const char *typeString;
161 signed char indexPresent, startPresent, endPresent, lengthPresent;
162 xData_Int index, start, end, length;
163 void *data;
164};
165
170 int depth;
174};
175
178 int ordinal; /* Counting from 0. */
179 int index; /* Value from "index" attribute if present or -1 */
180 int accessed; /* For the convenience of the users, not used internally. */
184 char *name; /* Allocated in xData_parseAddElementToRoot. */
185 char *fullName; /* Allocated in xData_parseAddElementToRoot. */
186 xData_attributionList attributes; /* attributes->abbributes is allocated in xData_parseAddElementToRoot. */
190};
191
195};
196
202 char *fileName;
210};
211
218 char *text;
219};
220
227int xData_parse( xData_document *xData_doc, const char *s );
228int xData_parseIsError( xData_document *xData_doc );
234char *xData_getAttributesValue( xData_attributionList *attributes, const char *name );
235const char *xData_getAttributesValueInElement( xData_element *element, const char *name );
243 xData_Int *length );
246int xData_convertAttributeToDouble( statusMessageReporting *smr, xData_element *element, const char *name, double *d );
247int xData_numberOfElementsByTagName( statusMessageReporting *smr, xData_element *element, const char *tagName );
250 const char *sortAttributeName, xData_sortElementFunc sortFunction );
251xData_element *xData_getOneElementByTagName( statusMessageReporting *smr, xData_element *element, char *name, int required );
253int xData_addToAccessed( statusMessageReporting *smr, xData_element *element, int increment );
255
257int xData_is_1d_x( statusMessageReporting *smr, xDataType *xDT, int setMsg );
258int xData_isElement_1d_x( statusMessageReporting *smr, xData_element *element, int setMsg );
259int xData_1d_x_copyData( statusMessageReporting *smr, xData_element *element, xData_Int nAllocatedBytes, double *d );
262
264int xData_is_2d_xindex_y( statusMessageReporting *smr, xDataType *xDT, int setMsg );
268double *xData_2d_xindex_y_toXYs( statusMessageReporting *smr, xData_element *element, double *Xs );
269double *xData_2d_xindex_y_toFilledYs( statusMessageReporting *smr, xData_element *element, double *Xs );
271double *xData_2d_xindex_y_toFilledXYs( statusMessageReporting *smr, xData_element *element, double *Xs );
272
274int xData_is_2d_xy( statusMessageReporting *smr, xDataType *xDT, int setMsg );
275int xData_isElement_2d_xy( statusMessageReporting *smr, xData_element *element, int setMsg );
278
284double *xData_2d_xShared_yHistogram_toFilledXYs( xDataType *xDT, xData_Int nXs, double *Xs );
285
287int xData_is_matrix( statusMessageReporting *smr, xDataType *xDT, int setMsg );
288int xData_isElement_matrix( statusMessageReporting *smr, xData_element *element, int setMsg );
292
293int xData_is_xDataType( statusMessageReporting *smr, xDataType *xDT, char const * const type, int setMsg );
294char const *xData_getFileName( xData_document *doc );
295int xData_setFileName( statusMessageReporting *smr, xData_document *doc, char const *fileName );
299
300int xData_stringTo_xData_Int( statusMessageReporting *smr, void *smrUserInterface, char const *c, xData_Int *value, char const *endings, char **e );
301int xData_stringTo_double( statusMessageReporting *smr, void *smrUserInterface, char const *c, double *value, char const *endings, char **e );
302
303/*
304* Stuff in xDataMisc.c
305*/
306void *xData_malloc( statusMessageReporting *smr, size_t size, int zero, const char *forItem, const char *file, int line );
307void *xData_realloc( statusMessageReporting *smr, void *pOld, size_t size, const char *forItem, const char *routine, int line );
308void *xData_free( statusMessageReporting *smr, void *p );
309char *xDataMisc_allocateCopyString( statusMessageReporting *smr, const char *s, const char *forItem, const char *routine, int line );
310char *xDataMisc_getAbsPath( statusMessageReporting *smr, const char *fileName );
311int xData_setMessageError_ReturnInt( int value, statusMessageReporting *smr, void *userData, const char *file, int line, int code, const char *fmt, ... );
312
313#define xData_malloc2( smr, size, zero, forItem ) xData_malloc( smr, size, zero, forItem, __FILE__, __LINE__ )
314#define xData_realloc2( smr, old, size, forItem ) xData_realloc( smr, old, size, forItem, __FILE__, __LINE__ )
315#define xDataMisc_allocateCopyString2( smr, s, forItem ) xDataMisc_allocateCopyString( smr, s, forItem, __FILE__, __LINE__ )
316
317#if defined __cplusplus
318 }
319 }
320#endif
321
322#endif /* End of xData_h_included. */
unsigned long XML_Size
XML_Error
Definition: include/expat.h:54
int(* smr_userInterface)(void *userData, char **smr)
xData_element * element
Definition: xData.h:157
enum xData_xDataType status
Definition: xData.h:155
xDT_releaseFunction release
Definition: xData.h:160
xData_Int end
Definition: xData.h:162
const char * typeString
Definition: xData.h:156
xDT_toStringFunction toString
Definition: xData.h:159
void * data
Definition: xData.h:163
xDT_toDataFunction toData
Definition: xData.h:158
signed char endPresent
Definition: xData.h:161
xData_Int index
Definition: xData.h:102
char * name
Definition: xData.h:122
char * value
Definition: xData.h:123
xData_attribute * attributes
Definition: xData.h:129
size_t line
Definition: xData.h:117
size_t column
Definition: xData.h:118
statusMessageReporting * smr
Definition: xData.h:206
void * xDataTypeOk_userData
Definition: xData.h:204
xData_rootElement * currentRoot
Definition: xData.h:209
xData_xDataTypeOk xDataTypeOk_userFunction
Definition: xData.h:203
xData_smr smrUserInterface
Definition: xData.h:205
XML_Parser xmlParser
Definition: xData.h:207
enum XML_Error err
Definition: xData.h:200
XML_Size err_column
Definition: xData.h:201
char * fileName
Definition: xData.h:202
xData_rootElement root
Definition: xData.h:208
enum xData_errorCodes error
Definition: xData.h:199
enum xData_status status
Definition: xData.h:198
xData_element * element
Definition: xData.h:145
const char * sortString
Definition: xData.h:146
xData_elementListItem * items
Definition: xData.h:151
xData_docInfo docInfo
Definition: xData.h:177
xData_attributionList attributes
Definition: xData.h:186
char * fullName
Definition: xData.h:185
int accessed
Definition: xData.h:180
xData_element * next
Definition: xData.h:183
xData_text text
Definition: xData.h:189
char * name
Definition: xData.h:184
xData_rootElement * parentRoot
Definition: xData.h:181
size_t textOffset
Definition: xData.h:188
xData_rootElement childrenRoot
Definition: xData.h:182
xDataType xDataTypeInfo
Definition: xData.h:187
enum xData_itemMode mode
Definition: xData.h:215
char * text
Definition: xData.h:218
size_t textOffset
Definition: xData.h:216
xData_element * element
Definition: xData.h:214
size_t textLength
Definition: xData.h:217
xData_element * parentElement
Definition: xData.h:213
xData_Int columns
Definition: xData.h:111
xData_matrix_rowStartEnd * rowStartEnds
Definition: xData.h:112
double * values
Definition: xData.h:113
xData_document * xData_doc
Definition: xData.h:167
xData_element * currentChild
Definition: xData.h:173
xData_element * children
Definition: xData.h:172
xData_rootElement * parentRoot
Definition: xData.h:169
int numberOfElements
Definition: xData.h:171
xData_element * parentElement
Definition: xData.h:168
xData_document * doc
Definition: xData.h:194
smr_userInterface smrUserInterface
Definition: xData.h:193
size_t allocated
Definition: xData.h:134
char * text
Definition: xData.h:136
size_t length
Definition: xData.h:135
xData_docInfo docInfo
Definition: xData.h:133
char const * xData_getFileName(xData_document *doc)
Definition: xData.cc:914
int xData_is_2d_xindex_y(statusMessageReporting *smr, xDataType *xDT, int setMsg)
xData_matrix * xData_matrix_copyData(statusMessageReporting *smr, xData_element *element)
Definition: xData_matrix.cc:85
int xData_convertAttributeToDouble(statusMessageReporting *smr, xData_element *element, const char *name, double *d)
Definition: xData.cc:730
void * xData_free(statusMessageReporting *smr, void *p)
Definition: xDataMisc.cc:89
int xData_stringTo_double(statusMessageReporting *smr, void *smrUserInterface, char const *c, double *value, char const *endings, char **e)
Definition: xData.cc:1044
void * xData_get_smrUserInterfaceFromElement(xData_element *element)
Definition: xData.cc:952
enum xData_itemMode xData_getFirstItem(xData_element *element, xData_item *item)
Definition: xData.cc:482
void xData_freeElementList(statusMessageReporting *smr, xData_elementList *list)
Definition: xData.cc:832
int xData_init_2d_xShared_yHistogram(statusMessageReporting *smr, xData_element *element)
int xData_isElement_matrix(statusMessageReporting *smr, xData_element *element, int setMsg)
Definition: xData_matrix.cc:78
int xData_getAccessed(statusMessageReporting *smr, xData_element *element)
Definition: xData.cc:1087
xData_document * xData_getElementsDocument(xData_element *element)
Definition: xData.cc:934
int xData_initializeAttributionList(statusMessageReporting *smr, xData_attributionList *attributes)
Definition: xData.cc:554
double * xData_2d_xindex_y_toXYs(statusMessageReporting *smr, xData_element *element, double *Xs)
char * xDataMisc_getAbsPath(statusMessageReporting *smr, const char *fileName)
Definition: xDataMisc.cc:112
char * xDataMisc_allocateCopyString(statusMessageReporting *smr, const char *s, const char *forItem, const char *routine, int line)
Definition: xDataMisc.cc:97
int getRowStartEndAtIndex(statusMessageReporting *smr, xDataType *xDT, xData_Int index, xData_Int *row, xData_Int *start, xData_Int *end)
xData_elementList * xData_getElementsByTagNameAndSort(statusMessageReporting *smr, xData_element *element, const char *tagName, const char *sortAttributeName, xData_sortElementFunc sortFunction)
Definition: xData.cc:788
int(* xData_sortElementFunc)(const void *, const void *)
Definition: xData.h:99
int xData_is_xDataType(statusMessageReporting *smr, xDataType *xDT, char const *const type, int setMsg)
Definition: xData.cc:900
int xData_1d_x_free_copyData(statusMessageReporting *smr, void *data)
Definition: xData_1d_x.cc:122
int xData_init_1d_x(statusMessageReporting *smr, xData_element *element)
Definition: xData_1d_x.cc:54
int xData_init_matrix(statusMessageReporting *smr, xData_element *element)
Definition: xData_matrix.cc:55
void * xData_get_smrUserInterfaceFromDocument(xData_document *doc)
Definition: xData.cc:944
int xData_numberOfElementsByTagName(statusMessageReporting *smr, xData_element *element, const char *tagName)
Definition: xData.cc:750
xData_itemMode
Definition: xData.h:80
@ xData_itemModeText
Definition: xData.h:80
@ xData_itemModeEnd
Definition: xData.h:80
@ xData_itemModeElement
Definition: xData.h:80
int(* xDT_toDataFunction)(statusMessageReporting *smr, xDataType *, xData_attributionList *, const char *)
Definition: xData.h:140
int xData_is_2d_xy(statusMessageReporting *smr, xDataType *xDT, int setMsg)
Definition: xData_2d_xy.cc:70
char const *const xData_matrix_ID
Definition: xData.h:75
int(* xDT_releaseFunction)(statusMessageReporting *smr, xDataType *)
Definition: xData.h:142
int xData_copyAttributionList(statusMessageReporting *smr, xData_attributionList *dest, xData_attributionList *src)
Definition: xData.cc:564
int xData_isElement_1d_x(statusMessageReporting *smr, xData_element *element, int setMsg)
Definition: xData_1d_x.cc:77
xData_attribute * xData_attributeByIndex(xData_attributionList *attributes, int index)
Definition: xData.cc:603
double * xData_2d_xindex_y_toFilledYs(statusMessageReporting *smr, xData_element *element, double *Xs)
char *(* xDT_toStringFunction)(statusMessageReporting *smr, xDataType *)
Definition: xData.h:141
int xData_isElement_2d_xShared_yHistogram(statusMessageReporting *smr, xData_element *element, int setMsg)
int(* xData_xDataTypeOk)(char const *name, xData_document *doc, void *userData)
Definition: xData.h:139
xData_status
Definition: xData.h:77
@ xData_statusError
Definition: xData.h:77
@ xData_statusCompleted
Definition: xData.h:77
@ xData_statusParsing
Definition: xData.h:77
int xData_stringTo_xData_Int(statusMessageReporting *smr, void *smrUserInterface, char const *c, xData_Int *value, char const *endings, char **e)
Definition: xData.cc:1010
int xData_1d_x_copyData(statusMessageReporting *smr, xData_element *element, xData_Int nAllocatedBytes, double *d)
Definition: xData_1d_x.cc:84
int xData_parseInitialize(statusMessageReporting *smr, xData_document *xData_doc, xData_xDataTypeOk func, void *userData)
Definition: xData.cc:157
int xData_is_2d_xShared_yHistogram(statusMessageReporting *smr, xDataType *xDT, int setMsg)
enum xData_itemMode xData_getNextItem(xData_item *item)
Definition: xData.cc:502
int xData_matrix_free_copyData(statusMessageReporting *smr, void *data)
const char * xData_getAttributesValueInElement(xData_element *element, const char *name)
Definition: xData.cc:546
int xData_is_matrix(statusMessageReporting *smr, xDataType *xDT, int setMsg)
Definition: xData_matrix.cc:71
int xData_releaseAttributionList(statusMessageReporting *smr, xData_attributionList *attributes)
Definition: xData.cc:611
char const *const xData_twod_xindex_y_ID
Definition: xData.h:73
double * xData_2d_xShared_yHistogram_toFilledXYs(xDataType *xDT, xData_Int nXs, double *Xs)
int xData_is_1d_x(statusMessageReporting *smr, xDataType *xDT, int setMsg)
Definition: xData_1d_x.cc:70
xData_element * xData_getOneElementByTagName(statusMessageReporting *smr, xData_element *element, char *name, int required)
Definition: xData.cc:810
int xData_addToAccessed(statusMessageReporting *smr, xData_element *element, int increment)
Definition: xData.cc:1078
xData_document * xData_parseString(statusMessageReporting *smr, const char *str, xData_xDataTypeOk func, void *userData)
Definition: xData.cc:123
int xData_setFileName(statusMessageReporting *smr, xData_document *doc, char const *fileName)
Definition: xData.cc:921
int xData_xDataTypeConvertAttributes(statusMessageReporting *smr, xData_element *element)
Definition: xData.cc:668
void * xData_parseFree(statusMessageReporting *smr, xData_document *xData_doc)
Definition: xData.cc:208
xData_Int xData_convertAttributeTo_xData_Int(statusMessageReporting *smr, xData_element *element, const char *name, xData_Int *n)
Definition: xData.cc:710
double * xData_2d_xShared_yHistogram_copyData(statusMessageReporting *smr, xData_element *element, xData_Int *n)
int xData_isElement_2d_xy(statusMessageReporting *smr, xData_element *element, int setMsg)
Definition: xData_2d_xy.cc:77
xData_element * xData_getNextElement(xData_element *element)
Definition: xData.cc:478
xData_elementList * xData_getElementsByTagName(statusMessageReporting *smr, xData_element *element, const char *tagName)
Definition: xData.cc:761
int xData_2d_xy_free_copyData(statusMessageReporting *smr, void *data)
Definition: xData_2d_xy.cc:101
xData_element * xData_getDocumentsElement(xData_document *xData_doc)
Definition: xData.cc:476
xData_element * xData_getFirstElement(xData_element *element)
Definition: xData.cc:477
xData_document * xData_parseReadFile(statusMessageReporting *smr, const char *fileName, xData_xDataTypeOk func, void *userData)
Definition: xData.cc:84
int xData_getCommonData(statusMessageReporting *smr, xData_element *element, xData_Int *index, xData_Int *start, xData_Int *end, xData_Int *length)
Definition: xData.cc:652
int xData_setMessageError_ReturnInt(int value, statusMessageReporting *smr, void *userData, const char *file, int line, int code, const char *fmt,...)
Definition: xDataMisc.cc:160
void * xData_malloc(statusMessageReporting *smr, size_t size, int zero, const char *forItem, const char *file, int line)
Definition: xDataMisc.cc:56
xData_errorCodes
Definition: xData.h:78
@ xData_errXML_ParserCreate
Definition: xData.h:78
@ xData_errFileError
Definition: xData.h:78
@ xData_errXMLParser
Definition: xData.h:79
@ xData_errNone
Definition: xData.h:78
int xData_2d_xindex_y_free_rawIndices(statusMessageReporting *smr, void *data)
char const *const xData_twod_xShared_yHistogram_ID
Definition: xData.h:74
char * xData_getAttributesValue(xData_attributionList *attributes, const char *name)
Definition: xData.cc:530
double * xData_2d_xy_allocateCopyData(statusMessageReporting *smr, xData_element *element, xData_Int *length)
Definition: xData_2d_xy.cc:84
int xData_parseEndOfXML(statusMessageReporting *smr, xData_document *xData_doc)
Definition: xData.cc:187
xData_document * xData_parseMalloc(statusMessageReporting *smr, xData_xDataTypeOk func, void *userData)
Definition: xData.cc:141
char const *const xData_twod_xy_ID
Definition: xData.h:72
xData_Int * xData_2d_xindex_y_rawIndices(statusMessageReporting *smr, xData_element *element)
int xData_attributeListLength(xData_attributionList *attributes)
Definition: xData.cc:596
int xData_2d_xShared_yHistogram_free_copyData(statusMessageReporting *smr, void *data)
void * xData_realloc(statusMessageReporting *smr, void *pOld, size_t size, const char *forItem, const char *routine, int line)
Definition: xDataMisc.cc:75
int xData_2d_xindex_y_free_toFilledYs(statusMessageReporting *smr, void *data)
char const *const xData_oned_x_ID
Definition: xData.h:71
int xData_init_2d_xindex_y(statusMessageReporting *smr, xData_element *element)
double * xData_2d_xindex_y_toFilledXYs(statusMessageReporting *smr, xData_element *element, double *Xs)
int xData_isElement_2d_xindex_y(statusMessageReporting *smr, xData_element *element, int setMsg)
int xData_Int
Definition: xData.h:50
xData_element * xData_getElements_xDataElement(statusMessageReporting *smr, xData_element *element)
Definition: xData.cc:622
xData_xDataType
Definition: xData.h:81
@ xData_xDataType_Ok
Definition: xData.h:81
@ xData_xDataType_ConvertingToData
Definition: xData.h:81
@ xData_xDataType_ConvertingToString
Definition: xData.h:81
double * xData_1d_x_allocateCopyData(statusMessageReporting *smr, xData_element *element)
Definition: xData_1d_x.cc:105
int xData_parse(xData_document *xData_doc, const char *s)
Definition: xData.cc:251
int xData_parseIsError(xData_document *xData_doc)
Definition: xData.cc:469
int xData_init_2d_xy(statusMessageReporting *smr, xData_element *element)
Definition: xData_2d_xy.cc:54
#define userData
Definition: xmlparse.cc:555