ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
MarshaledG4VHitsCollection.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file MarshaledG4VHitsCollection.h
1
// This file was generated automatically by marshalgen.
2
3
#ifndef MarshaledG4VHitsCollection_H
4
#define MarshaledG4VHitsCollection_H
5
6
7
#include <G4VHitsCollection.hh>
8
9
10
#include <stdio.h>
11
#include <string.h>
12
#include "
MarshaledObj.h
"
13
14
class
MarshaledG4VHitsCollection
;
15
16
class
ShadowedMarshaledG4VHitsCollection
:
public
G4VHitsCollection
{
17
friend
class
MarshaledG4VHitsCollection
;
18
};
19
20
class
MarshaledG4VHitsCollection
:
public
MarshaledObj
{
21
public
:
22
G4VHitsCollection
*
param
;
23
ShadowedMarshaledG4VHitsCollection
*
Shadowed_param
;
24
public
:
25
26
27
// Function implementations
28
29
MarshaledG4VHitsCollection
(
G4VHitsCollection
* objptr) :
MarshaledObj
() {
30
msh_isUnmarshalDone
=
false
;
31
this->
param
= objptr;
32
this->
Shadowed_param
= (
ShadowedMarshaledG4VHitsCollection
*)this->
param
;
33
if
(objptr == NULL)
34
return
;
35
36
marshal1
();
37
marshal2
();
38
marshal3
();
39
}
40
41
MarshaledG4VHitsCollection
(
void
*buf,
char
chIsUnmarshaling =
'u'
)
42
:
MarshaledObj
(buf, chIsUnmarshaling) {
43
msh_isUnmarshalDone
=
false
;
44
}
45
46
~MarshaledG4VHitsCollection
() {
47
//if(msh_isUnmarshalDone && this->param != NULL) {
48
//delete this->param;
49
//}
50
}
51
52
G4VHitsCollection
*
unmarshal
() {
53
//We don't want to unmarshal the buffer is empty.
54
if
(
msh_size
<=
MSH_HEADER_SIZE
) {
55
//This is buggy, we can't always assume that
56
//obj == NULL <==> List is empty.
57
return
NULL;
58
}
else
{
59
{
60
if
(0){}
61
else
if
(
msh_typechoice
== 0){
62
param
=
new
G4THitsCollection<ExN04CalorimeterHit>
(
""
,
""
);
63
}
64
else
if
(
msh_typechoice
== 1){
65
param
=
new
G4THitsCollection<ExN04MuonHit>
(
""
,
""
);
66
}
67
else
if
(
msh_typechoice
== 2){
68
param
=
new
G4THitsCollection<ExN04TrackerHit>
(
""
,
""
);
69
}
70
}
71
this->
Shadowed_param
= (
ShadowedMarshaledG4VHitsCollection
*)this->
param
;
72
this->
msh_isUnmarshalDone
=
true
;
73
unmarshal1
();
74
unmarshal2
();
75
unmarshal3
();
76
return
this->
param
;
77
}
78
}
79
80
void
unmarshalTo
(
G4VHitsCollection
* obj) {
81
//We don't want to unmarshal the buffer is empty.
82
if
(
msh_size
<=
MSH_HEADER_SIZE
) {
83
//This is buggy, we can't always assume that
84
//obj == NULL <==> List is empty.
85
return
;
86
}
else
{
87
this->
param
= obj;
88
this->
Shadowed_param
= (
ShadowedMarshaledG4VHitsCollection
*)this->
param
;
89
this->
msh_isUnmarshalDone
=
true
;
90
unmarshal1
();
91
unmarshal2
();
92
unmarshal3
();
93
}
94
}
95
96
void
marshal1
() {
97
//declare field_size to be the size of this field
98
int
msh_currentSize = 0;
99
if
(
isUnmarshaling
())
100
throw
"Tried to marshal in obj marked isUnmarshaling == true"
;
101
102
//Copy the sizespec into msh_currentSize here:
103
{
104
// no need to declare size since msh_currentSize is already assigned
105
//in the MARSHAL field
106
107
}
108
109
//Increase the size of buffer if needed
110
EXTEND_BUFFER
(msh_currentSize +
sizeof
(
int
) +
sizeof
(
int
));
111
// 4 bytes for the total size of field, 4 bytes for the number of
112
// elements in the array (in the case of array marshaling)
113
//Mark the beginning position for this field, will write the total size
114
//of this field here later
115
msh_field_begin
=
msh_cursor
;
116
117
//Advance cursor of distance = sizeof(int)
118
msh_cursor
+=
sizeof
(
int
);
119
120
//Now just copy "get" functions here
121
{
122
G4String
anElement;
123
anElement =
param
->
GetName
();
124
MarshaledG4String
var(&anElement);
125
EXTEND_BUFFER
(var.
getBufferSize
());
126
msh_currentSize = var.
getBufferSize
();
127
memcpy(
msh_cursor
, var.
getBuffer
(), var.
getBufferSize
());
128
}
129
//Now advance the cursor
130
msh_cursor
+= msh_currentSize;
131
//Now set the size of this field
132
int
tmp
;
//use memcpy instead of *(int*)... =... to prevent bus error
133
tmp = (
msh_cursor
-
msh_field_begin
) -
sizeof
(
int
);
134
memcpy(
msh_field_begin
, &tmp,
sizeof
(
int
));
135
136
//Now set msh_size
137
msh_size
=
msh_cursor
-
msh_buffer
;
138
MSH_SET_TOTALSIZE
(
msh_size
);
MSH_SET_TYPECHOICE
(
msh_typechoice
);
139
}
140
141
void
unmarshal1
() {
142
//declare currentSize to be the size of this field
143
int
msh_currentSize = 0;
144
//copy the size of the current field into currentSize
145
memcpy(&msh_currentSize,
msh_cursor
,
sizeof
(
int
));
146
msh_cursor
+=
sizeof
(
int
);
147
//Now copy the setspec here
148
{
149
MarshaledG4String
var(
msh_cursor
,
'u'
);
150
G4String
anElement;
151
var.
unmarshalTo
(&anElement);
152
Shadowed_param
->
collectionName
=anElement;
153
154
}
155
msh_cursor
+= msh_currentSize;
156
}
157
158
void
marshal2
() {
159
//declare field_size to be the size of this field
160
int
msh_currentSize = 0;
161
if
(
isUnmarshaling
())
162
throw
"Tried to marshal in obj marked isUnmarshaling == true"
;
163
164
//Copy the sizespec into msh_currentSize here:
165
{
166
// no need to declare size since msh_currentSize is already assigned
167
// in the MARSHAL field
168
169
}
170
171
//Increase the size of buffer if needed
172
EXTEND_BUFFER
(msh_currentSize +
sizeof
(
int
) +
sizeof
(
int
));
173
// 4 bytes for the total size of field, 4 bytes for the number of
174
// elements in the array (in the case of array marshaling)
175
//Mark the beginning position for this field, will write the total size
176
//of this field here later
177
msh_field_begin
=
msh_cursor
;
178
179
//Advance cursor of distance = sizeof(int)
180
msh_cursor
+=
sizeof
(
int
);
181
182
//Now just copy "get" functions here
183
{
184
G4String
anElement;
185
anElement =
param
->
GetSDname
();
186
MarshaledG4String
var(&anElement);
187
EXTEND_BUFFER
(var.
getBufferSize
());
188
msh_currentSize = var.
getBufferSize
();
189
memcpy(
msh_cursor
, var.
getBuffer
(), var.
getBufferSize
());
190
}
191
//Now advance the cursor
192
msh_cursor
+= msh_currentSize;
193
//Now set the size of this field
194
int
tmp
;
//use memcpy instead of *(int*)... =... to prevent bus error
195
tmp = (
msh_cursor
-
msh_field_begin
) -
sizeof
(
int
);
196
memcpy(
msh_field_begin
, &tmp,
sizeof
(
int
));
197
198
//Now set msh_size
199
msh_size
=
msh_cursor
-
msh_buffer
;
200
MSH_SET_TOTALSIZE
(
msh_size
);
MSH_SET_TYPECHOICE
(
msh_typechoice
);
201
}
202
203
void
unmarshal2
() {
204
//declare currentSize to be the size of this field
205
int
msh_currentSize = 0;
206
//copy the size of the current field into currentSize
207
memcpy(&msh_currentSize,
msh_cursor
,
sizeof
(
int
));
208
msh_cursor
+=
sizeof
(
int
);
209
//Now copy the setspec here
210
{
211
MarshaledG4String
var(
msh_cursor
,
'u'
);
212
G4String
anElement;
213
var.
unmarshalTo
(&anElement);
214
Shadowed_param
->
SDname
=anElement;
215
216
}
217
msh_cursor
+= msh_currentSize;
218
}
219
220
void
marshal3
() {
221
//declare field_size to be the size of this field
222
int
msh_currentSize = 0;
223
if
(
isUnmarshaling
())
224
throw
"Tried to marshal in obj marked isUnmarshaling == true"
;
225
226
//Copy the sizespec into msh_currentSize here:
227
{
228
//code for size, just dummy code because the size will be set correctly
229
//at the end of marshaling code
230
231
}
232
233
//Increase the size of buffer if needed
234
EXTEND_BUFFER
(msh_currentSize +
sizeof
(
int
) +
sizeof
(
int
));
235
// 4 bytes for the total size of field, 4 bytes for the number of
236
// elements in the array (in the case of array marshaling)
237
//Mark the beginning position for this field, will write the total size
238
//of this field here later
239
msh_field_begin
=
msh_cursor
;
240
241
//Advance cursor of distance = sizeof(int)
242
msh_cursor
+=
sizeof
(
int
);
243
244
//Now just copy "get" functions here
245
{
246
if
(0){}
247
else
if
((
param
->
GetName
() ==
"calCollection"
) ){
248
G4THitsCollection<ExN04CalorimeterHit>
*aObj749
249
= (
G4THitsCollection<ExN04CalorimeterHit>
*)
param
;
250
MarshaledG4THitsCollection<ExN04CalorimeterHit>
marChild(aObj749);
251
EXTEND_BUFFER
(marChild.
getBufferSize
());
252
memcpy(
msh_cursor
,marChild.
getBuffer
(), marChild.
getBufferSize
());
253
msh_currentSize = marChild.
getBufferSize
();
254
msh_typechoice
= 0;
255
}
256
else
if
( (
param
->
GetName
() ==
"muonCollection"
) ){
257
G4THitsCollection<ExN04MuonHit>
*aObj749
258
= (
G4THitsCollection<ExN04MuonHit>
*)
param
;
259
MarshaledG4THitsCollection<ExN04MuonHit>
marChild(aObj749);
260
EXTEND_BUFFER
(marChild.
getBufferSize
());
261
memcpy(
msh_cursor
,marChild.
getBuffer
(), marChild.
getBufferSize
());
262
msh_currentSize = marChild.
getBufferSize
();
263
msh_typechoice
= 1;
264
}
265
else
if
(
true
){
266
G4THitsCollection<ExN04TrackerHit>
*aObj749
267
= (
G4THitsCollection<ExN04TrackerHit>
*)
param
;
268
MarshaledG4THitsCollection<ExN04TrackerHit>
marChild(aObj749);
269
EXTEND_BUFFER
(marChild.
getBufferSize
());
270
memcpy(
msh_cursor
,marChild.
getBuffer
(), marChild.
getBufferSize
());
271
msh_currentSize = marChild.
getBufferSize
();
272
msh_typechoice
= 2;
273
}
274
275
}
276
//Now advance the cursor
277
msh_cursor
+= msh_currentSize;
278
//Now set the size of this field
279
int
tmp
;
//use memcpy instead of *(int*)... =... to prevent bus error
280
tmp = (
msh_cursor
-
msh_field_begin
) -
sizeof
(
int
);
281
memcpy(
msh_field_begin
, &tmp,
sizeof
(
int
));
282
283
//Now set msh_size
284
msh_size
=
msh_cursor
-
msh_buffer
;
285
MSH_SET_TOTALSIZE
(
msh_size
);
MSH_SET_TYPECHOICE
(
msh_typechoice
);
286
}
287
288
void
unmarshal3
() {
289
//declare currentSize to be the size of this field
290
int
msh_currentSize = 0;
291
//copy the size of the current field into currentSize
292
memcpy(&msh_currentSize,
msh_cursor
,
sizeof
(
int
));
293
msh_cursor
+=
sizeof
(
int
);
294
//Now copy the setspec here
295
{
296
if
(0){}
297
else
if
(
msh_typechoice
== 0){
298
MarshaledG4THitsCollection<ExN04CalorimeterHit>
marObj(
msh_cursor
);
299
marObj.
unmarshalTo
((
G4THitsCollection<ExN04CalorimeterHit>
*)
param
);
300
}
301
else
if
(
msh_typechoice
== 1){
302
MarshaledG4THitsCollection<ExN04MuonHit>
marObj(
msh_cursor
);
303
marObj.
unmarshalTo
((
G4THitsCollection<ExN04MuonHit>
*)
param
);
304
}
305
else
if
(
msh_typechoice
== 2){
306
MarshaledG4THitsCollection<ExN04TrackerHit>
marObj(
msh_cursor
);
307
marObj.
unmarshalTo
((
G4THitsCollection<ExN04TrackerHit>
*)
param
);
308
}
309
310
}
311
msh_cursor
+= msh_currentSize;
312
}
313
314
};
315
#endif
316
geant4
tree
geant4-10.6-release
examples
extended
parallel
TopC
ParN04
include
MarshaledG4VHitsCollection.h
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:09
using
1.8.2 with
ECCE GitHub integration