Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
source
processes
hadronic
models
lend
include
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, beck6@llnl.gov.
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>
44
#include "
statusMessageReporting.h
"
45
46
#if defined __cplusplus
47
namespace
GIDI {
48
#endif
49
50
typedef
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
71
char
const
*
const
xData_oned_x_ID
=
"1d.x"
;
72
char
const
*
const
xData_twod_xy_ID
=
"2d.xy"
;
73
char
const
*
const
xData_twod_xindex_y_ID
=
"2d.xindex_y"
;
74
char
const
*
const
xData_twod_xShared_yHistogram_ID
=
"2d_xShared_yHistogram"
;
75
char
const
*
const
xData_matrix_ID
=
"matrix"
;
76
77
enum
xData_status
{
xData_statusParsing
= 1,
xData_statusCompleted
,
xData_statusError
};
78
enum
xData_errorCodes
{
xData_errNone
,
xData_errXML_ParserCreate
,
xData_errFileError
,
79
xData_errXMLParser
};
80
enum
xData_itemMode
{
xData_itemModeEnd
= 0,
xData_itemModeElement
,
xData_itemModeText
};
81
enum
xData_xDataType
{
xData_xDataType_Ok
,
xData_xDataType_ConvertingToData
,
xData_xDataType_ConvertingToString
};
82
83
typedef
struct
xData_docInfo_s
xData_docInfo
;
84
typedef
struct
xData_attribute_s
xData_attribute
;
85
typedef
struct
xData_attributionList_s
xData_attributionList
;
86
typedef
struct
xData_rootElement_s
xData_rootElement
;
87
typedef
struct
xData_element_s
xData_element
;
88
typedef
struct
xData_text_s
xData_text
;
89
typedef
struct
xDataType_s
xDataType
;
90
typedef
struct
xData_smr_s
xData_smr
;
91
typedef
struct
xData_document_s
xData_document
;
92
typedef
struct
xData_item_s
xData_item
;
93
typedef
struct
xData_2d_xindex_y_s
xData_2d_xindex_y
;
94
typedef
struct
xData_matrix_s
xData_matrix
;
95
typedef
struct
xData_matrix_rowStartEnd_s
xData_matrix_rowStartEnd
;
96
typedef
struct
xData_elementListItem_s
xData_elementListItem
;
97
typedef
struct
xData_elementList_s
xData_elementList
;
98
99
typedef
int
(*
xData_sortElementFunc
)(
const
void
*,
const
void
* );
100
101
struct
xData_2d_xindex_y_s
{
102
xData_Int
index
;
103
double
value
;
104
};
105
106
struct
xData_matrix_rowStartEnd_s
{
107
xData_Int
row,
start
, end;
108
};
109
110
struct
xData_matrix_s
{
111
xData_Int
rows
, columns;
112
xData_matrix_rowStartEnd
*
rowStartEnds
;
113
double
*
values
;
114
};
115
116
struct
xData_docInfo_s
{
117
size_t
line
;
118
size_t
column
;
119
};
120
121
struct
xData_attribute_s
{
122
char
*
name
;
123
char
*
value
;
124
};
125
126
struct
xData_attributionList_s
{
127
int
number
;
128
size_t
size
;
129
xData_attribute
*
attributes
;
130
};
131
132
struct
xData_text_s
{
133
xData_docInfo
docInfo
;
134
size_t
allocated
;
135
size_t
length
;
136
char
*
text
;
137
};
138
139
typedef
int
(*
xData_xDataTypeOk
)(
char
const
*
name
,
xData_document
*doc,
void
*
userData
);
140
typedef
int
(*
xDT_toDataFunction
)(
statusMessageReporting
*smr,
xDataType
*,
xData_attributionList
*,
const
char
* );
141
typedef
char
*(*xDT_toStringFunction)(
statusMessageReporting
*smr,
xDataType
* );
142
typedef
int
(*
xDT_releaseFunction
)(
statusMessageReporting
*smr,
xDataType
* );
143
144
struct
xData_elementListItem_s
{
145
xData_element
*
element
;
146
const
char
*
sortString
;
147
};
148
149
struct
xData_elementList_s
{
150
int
n
;
151
xData_elementListItem
*
items
;
152
};
153
154
struct
xDataType_s
{
155
enum
xData_xDataType
status;
156
const
char
*
typeString
;
157
xData_element
*
element
;
158
xDT_toDataFunction
toData
;
159
xDT_toStringFunction
toString
;
160
xDT_releaseFunction
release
;
161
signed
char
indexPresent,
startPresent
, endPresent, lengthPresent;
162
xData_Int
index
,
start
, end, length;
163
void
*
data
;
164
};
165
166
struct
xData_rootElement_s
{
167
xData_document
*
xData_doc
;
168
xData_element
*
parentElement
;
169
xData_rootElement
*
parentRoot
;
170
int
depth
;
171
int
numberOfElements
;
172
xData_element
*
children
;
173
xData_element
*
currentChild
;
174
};
175
176
struct
xData_element_s
{
177
xData_docInfo
docInfo
;
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. */
181
xData_rootElement
*
parentRoot
;
182
xData_rootElement
childrenRoot
;
183
xData_element
*
next
;
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. */
187
xDataType
xDataTypeInfo
;
188
size_t
textOffset
;
189
xData_text
text
;
190
};
191
192
struct
xData_smr_s
{
193
smr_userInterface
smrUserInterface
;
194
xData_document
*
doc
;
195
};
196
197
struct
xData_document_s
{
198
enum
xData_status
status;
199
enum
xData_errorCodes
error;
200
enum
XML_Error
err;
201
XML_Size
err_line
, err_column;
202
char
*
fileName
;
203
xData_xDataTypeOk
xDataTypeOk_userFunction
;
204
void
*
xDataTypeOk_userData
;
205
xData_smr
smrUserInterface
;
206
statusMessageReporting
*
smr
;
207
XML_Parser
xmlParser
;
208
xData_rootElement
root
;
209
xData_rootElement
*
currentRoot
;
210
};
211
212
struct
xData_item_s
{
213
xData_element
*
parentElement
;
214
xData_element
*
element
;
215
enum
xData_itemMode
mode;
216
size_t
textOffset
;
217
size_t
textLength
;
218
char
*
text
;
219
};
220
221
xData_document
*
xData_parseReadFile
(
statusMessageReporting
*smr,
const
char
*fileName,
xData_xDataTypeOk
func,
void
*
userData
);
222
xData_document
*
xData_parseString
(
statusMessageReporting
*smr,
const
char
*str,
xData_xDataTypeOk
func,
void
*
userData
);
223
xData_document
*
xData_parseMalloc
(
statusMessageReporting
*smr,
xData_xDataTypeOk
func,
void
*
userData
);
224
int
xData_parseInitialize
(
statusMessageReporting
*smr,
xData_document
*xData_doc,
xData_xDataTypeOk
func,
void
*
userData
);
225
int
xData_parseEndOfXML
(
statusMessageReporting
*smr,
xData_document
*xData_doc );
226
void
*
xData_parseFree
(
statusMessageReporting
*smr,
xData_document
*xData_doc );
227
int
xData_parse
(
xData_document
*xData_doc,
const
char
*
s
);
228
int
xData_parseIsError
(
xData_document
*xData_doc );
229
xData_element
*
xData_getDocumentsElement
(
xData_document
*xData_doc );
230
xData_element
*
xData_getFirstElement
(
xData_element
*element );
231
xData_element
*
xData_getNextElement
(
xData_element
*element );
232
enum
xData_itemMode
xData_getFirstItem
(
xData_element
*element,
xData_item
*item );
233
enum
xData_itemMode
xData_getNextItem
(
xData_item
*item );
234
char
*
xData_getAttributesValue
(
xData_attributionList
*attributes,
const
char
*
name
);
235
const
char
*
xData_getAttributesValueInElement
(
xData_element
*element,
const
char
*
name
);
236
int
xData_initializeAttributionList
(
statusMessageReporting
*smr,
xData_attributionList
*attributes );
237
int
xData_copyAttributionList
(
statusMessageReporting
*smr,
xData_attributionList
*dest,
xData_attributionList
*src );
238
int
xData_releaseAttributionList
(
statusMessageReporting
*smr,
xData_attributionList
*attributes );
239
int
xData_attributeListLength
(
xData_attributionList
*attributes );
240
xData_attribute
*
xData_attributeByIndex
(
xData_attributionList
*attributes,
int
index
);
241
xData_element
*
xData_getElements_xDataElement
(
statusMessageReporting
*smr,
xData_element
*element );
242
int
xData_getCommonData
(
statusMessageReporting
*smr,
xData_element
*element,
xData_Int
*
index
,
xData_Int
*start,
xData_Int
*end,
243
xData_Int
*length );
244
int
xData_xDataTypeConvertAttributes
(
statusMessageReporting
*smr,
xData_element
*element );
245
xData_Int
xData_convertAttributeTo_xData_Int
(
statusMessageReporting
*smr,
xData_element
*element,
const
char
*
name
,
xData_Int
*
n
);
246
int
xData_convertAttributeToDouble
(
statusMessageReporting
*smr,
xData_element
*element,
const
char
*
name
,
double
*
d
);
247
int
xData_numberOfElementsByTagName
(
statusMessageReporting
*smr,
xData_element
*element,
const
char
*tagName );
248
xData_elementList
*
xData_getElementsByTagName
(
statusMessageReporting
*smr,
xData_element
*element,
const
char
*tagName );
249
xData_elementList
*
xData_getElementsByTagNameAndSort
(
statusMessageReporting
*smr,
xData_element
*element,
const
char
*tagName,
250
const
char
*sortAttributeName,
xData_sortElementFunc
sortFunction );
251
xData_element
*
xData_getOneElementByTagName
(
statusMessageReporting
*smr,
xData_element
*element,
char
*
name
,
int
required );
252
void
xData_freeElementList
(
statusMessageReporting
*smr,
xData_elementList
*list );
253
int
xData_addToAccessed
(
statusMessageReporting
*smr,
xData_element
*element,
int
increment );
254
int
xData_getAccessed
(
statusMessageReporting
*smr,
xData_element
*element );
255
256
int
xData_init_1d_x
(
statusMessageReporting
*smr,
xData_element
*element );
257
int
xData_is_1d_x
(
statusMessageReporting
*smr,
xDataType
*xDT,
int
setMsg );
258
int
xData_isElement_1d_x
(
statusMessageReporting
*smr,
xData_element
*element,
int
setMsg );
259
int
xData_1d_x_copyData
(
statusMessageReporting
*smr,
xData_element
*element,
xData_Int
nAllocatedBytes,
double
*
d
);
260
double
*
xData_1d_x_allocateCopyData
(
statusMessageReporting
*smr,
xData_element
*element );
261
int
xData_1d_x_free_copyData
(
statusMessageReporting
*smr,
void
*
data
);
262
263
int
xData_init_2d_xindex_y
(
statusMessageReporting
*smr,
xData_element
*element );
264
int
xData_is_2d_xindex_y
(
statusMessageReporting
*smr,
xDataType
*xDT,
int
setMsg );
265
int
xData_isElement_2d_xindex_y
(
statusMessageReporting
*smr,
xData_element
*element,
int
setMsg );
266
xData_Int
*
xData_2d_xindex_y_rawIndices
(
statusMessageReporting
*smr,
xData_element
*element );
267
int
xData_2d_xindex_y_free_rawIndices
(
statusMessageReporting
*smr,
void
*
data
);
268
double
*
xData_2d_xindex_y_toXYs
(
statusMessageReporting
*smr,
xData_element
*element,
double
*Xs );
269
double
*
xData_2d_xindex_y_toFilledYs
(
statusMessageReporting
*smr,
xData_element
*element,
double
*Xs );
270
int
xData_2d_xindex_y_free_toFilledYs
(
statusMessageReporting
*smr,
void
*
data
);
271
double
*
xData_2d_xindex_y_toFilledXYs
(
statusMessageReporting
*smr,
xData_element
*element,
double
*Xs );
272
273
int
xData_init_2d_xy
(
statusMessageReporting
*smr,
xData_element
*element );
274
int
xData_is_2d_xy
(
statusMessageReporting
*smr,
xDataType
*xDT,
int
setMsg );
275
int
xData_isElement_2d_xy
(
statusMessageReporting
*smr,
xData_element
*element,
int
setMsg );
276
double
*
xData_2d_xy_allocateCopyData
(
statusMessageReporting
*smr,
xData_element
*element,
xData_Int
*length );
277
int
xData_2d_xy_free_copyData
(
statusMessageReporting
*smr,
void
*
data
);
278
279
int
xData_init_2d_xShared_yHistogram
(
statusMessageReporting
*smr,
xData_element
*element );
280
int
xData_is_2d_xShared_yHistogram
(
statusMessageReporting
*smr,
xDataType
*xDT,
int
setMsg );
281
int
xData_isElement_2d_xShared_yHistogram
(
statusMessageReporting
*smr,
xData_element
*element,
int
setMsg );
282
double
*
xData_2d_xShared_yHistogram_copyData
(
statusMessageReporting
*smr,
xData_element
*element,
xData_Int
*
n
);
283
int
xData_2d_xShared_yHistogram_free_copyData
(
statusMessageReporting
*smr,
void
*
data
);
284
double
*
xData_2d_xShared_yHistogram_toFilledXYs
(
xDataType
*xDT,
xData_Int
nXs,
double
*Xs );
285
286
int
xData_init_matrix
(
statusMessageReporting
*smr,
xData_element
*element );
287
int
xData_is_matrix
(
statusMessageReporting
*smr,
xDataType
*xDT,
int
setMsg );
288
int
xData_isElement_matrix
(
statusMessageReporting
*smr,
xData_element
*element,
int
setMsg );
289
xData_matrix
*
xData_matrix_copyData
(
statusMessageReporting
*smr,
xData_element
*element );
290
int
xData_matrix_free_copyData
(
statusMessageReporting
*smr,
void
*
data
);
291
int
getRowStartEndAtIndex
(
statusMessageReporting
*smr,
xDataType
*xDT,
xData_Int
index
,
xData_Int
*row,
xData_Int
*start,
xData_Int
*end );
292
293
int
xData_is_xDataType
(
statusMessageReporting
*smr,
xDataType
*xDT,
char
const
*
const
type,
int
setMsg );
294
char
const
*
xData_getFileName
(
xData_document
*doc );
295
int
xData_setFileName
(
statusMessageReporting
*smr,
xData_document
*doc,
char
const
*fileName );
296
xData_document
*
xData_getElementsDocument
(
xData_element
*element );
297
void
*
xData_get_smrUserInterfaceFromDocument
(
xData_document
*doc );
298
void
*
xData_get_smrUserInterfaceFromElement
(
xData_element
*element );
299
300
int
xData_stringTo_xData_Int
(
statusMessageReporting
*smr,
void
*smrUserInterface,
char
const
*
c
,
xData_Int
*
value
,
char
const
*endings,
char
**
e
);
301
int
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
*/
306
void
*
xData_malloc
(
statusMessageReporting
*smr,
size_t
size,
int
zero,
const
char
*forItem,
const
char
*
file
,
int
line );
307
void
*
xData_realloc
(
statusMessageReporting
*smr,
void
*pOld,
size_t
size,
const
char
*forItem,
const
char
*routine,
int
line );
308
void
*
xData_free
(
statusMessageReporting
*smr,
void
*
p
);
309
char
*
xDataMisc_allocateCopyString
(
statusMessageReporting
*smr,
const
char
*
s
,
const
char
*forItem,
const
char
*routine,
int
line );
310
char
*
xDataMisc_getAbsPath
(
statusMessageReporting
*smr,
const
char
*fileName );
311
int
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. */
Generated on Sat May 25 2013 14:34:00 for Geant4 by
1.8.4