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