Geant4_10
MarshaledExN04CalorimeterHit.h
Go to the documentation of this file.
1 // This file was generated automatically by marshalgen.
2 
3 #ifndef MarshaledExN04CalorimeterHit_H
4 #define MarshaledExN04CalorimeterHit_H
5 
6 
7 #include <ExN04CalorimeterHit.hh>
8 //MSH_include_begin
9 #include "MarshaledG4String.h"
10 //MSH_include_end
11 
12 #include <stdio.h>
13 #include <string.h>
14 #include "MarshaledObj.h"
15 
17 
20 };
21 
23 public:
26 public:
27 
28 
29 // Function implementations
30 
32  msh_isUnmarshalDone = false;
33  this->param = objptr;
35  if (objptr == NULL)
36  return;
37 
38  marshal1();
39  marshal2();
40  marshal3();
41  marshal4();
42 }
43 
44 MarshaledExN04CalorimeterHit(void *buf, char chIsUnmarshaling = 'u')
45 : MarshaledObj(buf, chIsUnmarshaling) {
46  msh_isUnmarshalDone = false;
47 }
48 
50  //if(msh_isUnmarshalDone && this->param != NULL) {
51  //delete this->param;
52  //}
53 }
54 
56  //We don't want to unmarshal the buffer is empty.
57  if(msh_size <= MSH_HEADER_SIZE) {
58  //This is buggy, we can't always assume that
59  //obj == NULL <==> List is empty.
60  return NULL;
61  } else {
62  {
63  param = new ExN04CalorimeterHit();
64  }
66  this->msh_isUnmarshalDone = true;
67  unmarshal1();
68  unmarshal2();
69  unmarshal3();
70  unmarshal4();
71  return this->param;
72  }
73 }
74 
76  //We don't want to unmarshal the buffer is empty.
77  if(msh_size <= MSH_HEADER_SIZE) {
78  //This is buggy, we can't always assume that
79  //obj == NULL <==> List is empty.
80  return;
81  } else {
82  this->param = obj;
84  this->msh_isUnmarshalDone = true;
85  unmarshal1();
86  unmarshal2();
87  unmarshal3();
88  unmarshal4();
89  }
90 }
91 
92 void marshal1() {
93  //declare field_size to be the size of this field
94  int msh_currentSize = 0;
95  if (isUnmarshaling())
96  throw "Tried to marshal in obj marked isUnmarshaling == true";
97 
98  //Copy the sizespec into msh_currentSize here:
99  {
100  msh_currentSize = sizeof(G4int);
101 
102  }
103 
104  //Increase the size of buffer if needed
105  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
106  // 4 bytes for the total size of field, 4 bytes for the number
107  // of elements in the array (in the case of array marshaling)
108  //Mark the beginning position for this field, will write the total
109  // size of this field here later
111 
112  //Advance cursor of distance = sizeof(int)
113  msh_cursor += sizeof(int);
114 
115  //Now just copy "get" functions here
116  {
117  G4int anElement;
118  anElement = param->GetZ();
119  memcpy(msh_cursor, &anElement, sizeof(G4int));
120  }
121  //Now advance the cursor
122  msh_cursor += msh_currentSize;
123  //Now set the size of this field
124  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
125  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
126  memcpy(msh_field_begin, &tmp, sizeof(int));
127 
128  //Now set msh_size
131 }
132 
133 void unmarshal1() {
134  //declare currentSize to be the size of this field
135  int msh_currentSize = 0;
136  //copy the size of the current field into currentSize
137  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
138  msh_cursor += sizeof(int);
139  //Now copy the setspec here
140  {
141  G4int anElement;
142  memcpy(&anElement, msh_cursor, sizeof(G4int));
143  param->SetCellID(anElement, param->GetPhi());
144 
145  }
146  msh_cursor += msh_currentSize;
147 }
148 
149 void marshal2() {
150  //declare field_size to be the size of this field
151  int msh_currentSize = 0;
152  if (isUnmarshaling())
153  throw "Tried to marshal in obj marked isUnmarshaling == true";
154 
155  //Copy the sizespec into msh_currentSize here:
156  {
157  msh_currentSize = sizeof(G4int);
158 
159  }
160 
161  //Increase the size of buffer if needed
162  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
163  // 4 bytes for the total size of field, 4 bytes for the number of
164  // elements in the array (in the case of array marshaling)
165  //Mark the beginning position for this field, will write the total
166  //size of this field here later
168 
169  //Advance cursor of distance = sizeof(int)
170  msh_cursor += sizeof(int);
171 
172  //Now just copy "get" functions here
173  {
174  G4int anElement;
175  anElement = param->GetPhi();
176  memcpy(msh_cursor, &anElement, sizeof(G4int));
177  }
178  //Now advance the cursor
179  msh_cursor += msh_currentSize;
180  //Now set the size of this field
181  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
182  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
183  memcpy(msh_field_begin, &tmp, sizeof(int));
184 
185  //Now set msh_size
188 }
189 
190 void unmarshal2() {
191  //declare currentSize to be the size of this field
192  int msh_currentSize = 0;
193  //copy the size of the current field into currentSize
194  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
195  msh_cursor += sizeof(int);
196  //Now copy the setspec here
197  {
198  G4int anElement;
199  memcpy(&anElement, msh_cursor, sizeof(G4int));
200  param->SetCellID(param->GetZ(), anElement);
201 
202  }
203  msh_cursor += msh_currentSize;
204 }
205 
206 void marshal3() {
207  //declare field_size to be the size of this field
208  int msh_currentSize = 0;
209  if (isUnmarshaling())
210  throw "Tried to marshal in obj marked isUnmarshaling == true";
211 
212  //Copy the sizespec into msh_currentSize here:
213  {
214  msh_currentSize = sizeof(G4double);
215 
216  }
217 
218  //Increase the size of buffer if needed
219  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
220  // 4 bytes for the total size of field, 4 bytes for the number of
221  // elements in the array (in the case of array marshaling)
222  //Mark the beginning position for this field, will write the total size
223  // of this field here later
225 
226  //Advance cursor of distance = sizeof(int)
227  msh_cursor += sizeof(int);
228 
229  //Now just copy "get" functions here
230  {
231  G4double anElement;
232  anElement = param->GetEdep();
233  memcpy(msh_cursor, &anElement, sizeof(G4double));
234  }
235  //Now advance the cursor
236  msh_cursor += msh_currentSize;
237  //Now set the size of this field
238  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
239  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
240  memcpy(msh_field_begin, &tmp, sizeof(int));
241 
242  //Now set msh_size
245 }
246 
247 void unmarshal3() {
248  //declare currentSize to be the size of this field
249  int msh_currentSize = 0;
250  //copy the size of the current field into currentSize
251  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
252  msh_cursor += sizeof(int);
253  //Now copy the setspec here
254  {
255  G4double anElement;
256  memcpy(&anElement, msh_cursor, sizeof(G4double));
257  param->SetEdep(anElement);
258 
259  }
260  msh_cursor += msh_currentSize;
261 }
262 
263 void marshal4() {
264  //declare field_size to be the size of this field
265  int msh_currentSize = 0;
266  if (isUnmarshaling())
267  throw "Tried to marshal in obj marked isUnmarshaling == true";
268 
269  //Copy the sizespec into msh_currentSize here:
270  {
271  msh_currentSize = sizeof(G4ThreeVector);
272 
273  }
274 
275  //Increase the size of buffer if needed
276  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
277  // 4 bytes for the total size of field, 4 bytes for the number of
278  // elements in the array (in the case of array marshaling)
279  //Mark the beginning position for this field, will write the total size
280  //of this field here later
282 
283  //Advance cursor of distance = sizeof(int)
284  msh_cursor += sizeof(int);
285 
286  //Now just copy "get" functions here
287  {
288  G4ThreeVector anElement;
289  anElement = param->GetPos();
290  memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector));
291  }
292  //Now advance the cursor
293  msh_cursor += msh_currentSize;
294  //Now set the size of this field
295  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
296  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
297  memcpy(msh_field_begin, &tmp, sizeof(int));
298 
299  //Now set msh_size
302 }
303 
304 void unmarshal4() {
305  //declare currentSize to be the size of this field
306  int msh_currentSize = 0;
307  //copy the size of the current field into currentSize
308  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
309  msh_cursor += sizeof(int);
310  //Now copy the setspec here
311  {
312  G4ThreeVector anElement;
313  memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector));
314  param->SetPos(anElement);
315 
316  }
317  msh_cursor += msh_currentSize;
318 }
319 
320 };
321 #endif
322 
Float_t tmp
Definition: plot.C:37
MarshaledExN04CalorimeterHit(ExN04CalorimeterHit *objptr)
CLHEP::Hep3Vector G4ThreeVector
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
bool msh_isUnmarshalDone
Definition: MarshaledObj.h:119
void SetPos(G4ThreeVector xyz)
int G4int
Definition: G4Types.hh:78
#define MSH_SET_TYPECHOICE(X)
Definition: MarshaledObj.h:21
bool isUnmarshaling()
Definition: MarshaledObj.h:92
size_t msh_size
Definition: MarshaledObj.h:110
void SetEdep(G4double de)
void EXTEND_BUFFER(int size)
Definition: MarshaledObj.h:122
void unmarshalTo(ExN04CalorimeterHit *obj)
ShadowedMarshaledExN04CalorimeterHit * Shadowed_param
MarshaledExN04CalorimeterHit(void *buf, char chIsUnmarshaling= 'u')
char * msh_field_begin
Definition: MarshaledObj.h:107
void SetCellID(G4int z, G4int phi)
char * msh_cursor
Definition: MarshaledObj.h:113
double G4double
Definition: G4Types.hh:76
#define MSH_HEADER_SIZE
Definition: MarshaledObj.h:15
#define MSH_SET_TOTALSIZE(X)
Definition: MarshaledObj.h:22
char * msh_buffer
Definition: MarshaledObj.h:104