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
MarshaledG4HCofThisEvent.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file MarshaledG4HCofThisEvent.h
1
// This file was generated automatically by marshalgen.
2
3
#ifndef MarshaledG4HCofThisEvent_H
4
#define MarshaledG4HCofThisEvent_H
5
6
7
#include <G4HCofThisEvent.hh>
8
//MSH_include_begin
9
#include "
G4SDManager.hh
"
10
#include "G4THitsCollection.hh"
11
#include "
ExN02TrackerHit.hh
"
12
#include "
MarshaledExN02TrackerHit.h
"
13
#include "
MarshaledG4THitsCollection.h
"
14
#include "
MarshaledG4VHitsCollection.h
"
15
//MSH_include_end
16
17
#include <stdio.h>
18
#include <string.h>
19
#include "
MarshaledObj.h
"
20
21
class
MarshaledG4HCofThisEvent
;
22
23
class
ShadowedMarshaledG4HCofThisEvent
:
public
G4HCofThisEvent
{
24
friend
class
MarshaledG4HCofThisEvent
;
25
};
26
27
class
MarshaledG4HCofThisEvent
:
public
MarshaledObj
{
28
public
:
29
G4HCofThisEvent
*
param
;
30
ShadowedMarshaledG4HCofThisEvent
*
Shadowed_param
;
31
public
:
32
33
34
// Function implementations
35
36
MarshaledG4HCofThisEvent
(
G4HCofThisEvent
* objptr) :
MarshaledObj
() {
37
msh_isUnmarshalDone
=
false
;
38
this->
param
= objptr;
39
this->
Shadowed_param
= (
ShadowedMarshaledG4HCofThisEvent
*)this->
param
;
40
if
(objptr == NULL)
41
return
;
42
43
marshal1
();
44
}
45
46
MarshaledG4HCofThisEvent
(
void
*buf,
char
chIsUnmarshaling =
'u'
)
47
:
MarshaledObj
(buf, chIsUnmarshaling) {
48
msh_isUnmarshalDone
=
false
;
49
}
50
51
~MarshaledG4HCofThisEvent
() {
52
//if(msh_isUnmarshalDone && this->param != NULL) {
53
//delete this->param;
54
//}
55
}
56
57
G4HCofThisEvent
*
unmarshal
() {
58
//We don't want to unmarshal the buffer is empty.
59
if
(
msh_size
<=
MSH_HEADER_SIZE
) {
60
//This is buggy, we can't always assume that
61
//obj == NULL <==> List is empty.
62
return
NULL;
63
}
else
{
64
{
65
param
=
new
G4HCofThisEvent
();
66
}
67
this->
Shadowed_param
= (
ShadowedMarshaledG4HCofThisEvent
*)this->
param
;
68
this->
msh_isUnmarshalDone
=
true
;
69
unmarshal1
();
70
return
this->
param
;
71
}
72
}
73
74
void
unmarshalTo
(
G4HCofThisEvent
* obj) {
75
//We don't want to unmarshal the buffer is empty.
76
if
(
msh_size
<=
MSH_HEADER_SIZE
) {
77
//This is buggy, we can't always assume that
78
//obj == NULL <==> List is empty.
79
return
;
80
}
else
{
81
this->
param
= obj;
82
this->
Shadowed_param
= (
ShadowedMarshaledG4HCofThisEvent
*)this->
param
;
83
this->
msh_isUnmarshalDone
=
true
;
84
unmarshal1
();
85
}
86
}
87
88
void
marshal1
() {
89
//declare field_size to be the size of this field
90
int
msh_currentSize = 0;
91
if
(
isUnmarshaling
())
92
throw
"Tried to marshal in obj marked isUnmarshaling == true"
;
93
94
//Copy the sizespec into msh_currentSize here:
95
{
96
97
}
98
99
//Increase the size of buffer if needed
100
EXTEND_BUFFER
(msh_currentSize +
sizeof
(
int
) +
sizeof
(
int
));
101
// 4 bytes for the total size of field, 4 bytes for the number
102
// of elements in the array (in the case of array marshaling)
103
//Mark the beginning position for this field, will write the total
104
//size of this field here later
105
msh_field_begin
=
msh_cursor
;
106
107
//Advance cursor of distance = sizeof(int)
108
msh_cursor
+=
sizeof
(
int
);
109
110
//Now just copy "get" functions here
111
{
112
int
copy_off = 0;
113
int
elementNum;
114
elementNum =
param
->
GetNumberOfCollections
();
115
memcpy(
msh_cursor
+copy_off, &elementNum,
sizeof
(
int
));
116
copy_off +=
sizeof
(
int
);
117
for
(
int
index=0;index<elementNum;index++){
118
G4VHitsCollection
* anElement;
119
anElement =
param
->
GetHC
(index);
120
MarshaledG4VHitsCollection
marEle(anElement);
121
EXTEND_BUFFER
(marEle.
getBufferSize
());
122
memcpy(
msh_cursor
+copy_off, marEle.
getBuffer
(), marEle.
getBufferSize
());
123
copy_off += marEle.
getBufferSize
();
124
}
125
msh_currentSize = copy_off;
126
127
}
128
//Now advance the cursor
129
msh_cursor
+= msh_currentSize;
130
//Now set the size of this field
131
int
tmp
;
//use memcpy instead of *(int*)... =... to prevent bus error
132
tmp = (
msh_cursor
-
msh_field_begin
) -
sizeof
(
int
);
133
memcpy(
msh_field_begin
, &tmp,
sizeof
(
int
));
134
135
//Now set msh_size
136
msh_size
=
msh_cursor
-
msh_buffer
;
137
MSH_SET_TOTALSIZE
(
msh_size
);
MSH_SET_TYPECHOICE
(
msh_typechoice
);
138
}
139
140
void
unmarshal1
() {
141
//declare currentSize to be the size of this field
142
int
msh_currentSize = 0;
143
//copy the size of the current field into currentSize
144
memcpy(&msh_currentSize,
msh_cursor
,
sizeof
(
int
));
145
msh_cursor
+=
sizeof
(
int
);
146
//Now copy the setspec here
147
{
148
int
copy_off = 0;
149
int
elementNum;
150
memcpy(&elementNum,
msh_cursor
+copy_off,
sizeof
(
int
));
151
copy_off +=
sizeof
(
int
);
152
for
(
int
index=0;index<elementNum;index++){
153
MarshaledG4VHitsCollection
marEle(
msh_cursor
+copy_off);
154
G4VHitsCollection
* anElement = (
G4VHitsCollection
*)marEle.
unmarshal
();
155
copy_off += marEle.
getBufferSize
();
156
param
->
AddHitsCollection
(index, anElement);
157
}
158
159
}
160
msh_cursor
+= msh_currentSize;
161
}
162
163
};
164
#endif
165
geant4
tree
geant4-10.6-release
examples
extended
parallel
TopC
ParN02
include
MarshaledG4HCofThisEvent.h
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:09
using
1.8.2 with
ECCE GitHub integration