MarshaledExN02TrackerHit.h
Go to the documentation of this file.
1 // This file was generated automatically by marshalgen.
2 
3 #ifndef MarshaledExN02TrackerHit_H
4 #define MarshaledExN02TrackerHit_H
5 
6 
7 #include <ExN02TrackerHit.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 
18  class ShadowedMarshaledExN02TrackerHit : public ExN02TrackerHit{
20 };
21 
23 public:
24  ExN02TrackerHit* param;
26 public:
27 
28 
29 // Function implementations
30 
31 MarshaledExN02TrackerHit(ExN02TrackerHit* objptr) : MarshaledObj() {
32  msh_isUnmarshalDone = false;
33  this->param = objptr;
34  this->Shadowed_param = (ShadowedMarshaledExN02TrackerHit*)this->param;
35  if (objptr == NULL)
36  return;
37 
38  marshal1();
39  marshal2();
40  marshal3();
41  marshal4();
42 }
43 
44 MarshaledExN02TrackerHit(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 
55 ExN02TrackerHit* unmarshal() {
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 ExN02TrackerHit();
64  }
65  this->Shadowed_param = (ShadowedMarshaledExN02TrackerHit*)this->param;
66  this->msh_isUnmarshalDone = true;
67  unmarshal1();
68  unmarshal2();
69  unmarshal3();
70  unmarshal4();
71  return this->param;
72  }
73 }
74 
75 void unmarshalTo(ExN02TrackerHit* obj) {
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;
83  this->Shadowed_param = (ShadowedMarshaledExN02TrackerHit*)this->param;
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(G4ThreeVector);
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
110  msh_field_begin = msh_cursor;
111 
112  //Advance cursor of distance = sizeof(int)
113  msh_cursor += sizeof(int);
114 
115  //Now just copy "get" functions here
116  {
117  G4ThreeVector anElement;
118  anElement = param->GetPos();
119  memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector));
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
129  msh_size = msh_cursor - msh_buffer;
130  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
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  G4ThreeVector anElement;
142  memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector));
143  param->SetPos(anElement);
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(G4double);
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 size
166  //of this field here later
167  msh_field_begin = msh_cursor;
168 
169  //Advance cursor of distance = sizeof(int)
170  msh_cursor += sizeof(int);
171 
172  //Now just copy "get" functions here
173  {
174  G4double anElement;
175  anElement = param->GetEdep();
176  memcpy(msh_cursor, &anElement, sizeof(G4double));
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
186  msh_size = msh_cursor - msh_buffer;
187  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
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  G4double anElement;
199  memcpy(&anElement, msh_cursor, sizeof(G4double));
200  param->SetEdep(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(G4int );
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
221  // of elements in the array (in the case of array marshaling)
222  //Mark the beginning position for this field, will write the total
223  //size of this field here later
224  msh_field_begin = msh_cursor;
225 
226  //Advance cursor of distance = sizeof(int)
227  msh_cursor += sizeof(int);
228 
229  //Now just copy "get" functions here
230  {
231  G4int anElement;
232  anElement = param->GetTrackID();
233  memcpy(msh_cursor, &anElement, sizeof(G4int ));
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
243  msh_size = msh_cursor - msh_buffer;
244  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
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  G4int anElement;
256  memcpy(&anElement, msh_cursor, sizeof(G4int ));
257  param->SetTrackID(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(G4int );
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
278  // of elements in the array (in the case of array marshaling)
279  //Mark the beginning position for this field, will write the total
280  //size of this field here later
281  msh_field_begin = msh_cursor;
282 
283  //Advance cursor of distance = sizeof(int)
284  msh_cursor += sizeof(int);
285 
286  //Now just copy "get" functions here
287  {
288  G4int anElement;
289  anElement = param->GetChamberNb();
290  memcpy(msh_cursor, &anElement, sizeof(G4int ));
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
300  msh_size = msh_cursor - msh_buffer;
301  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
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  G4int anElement;
313  memcpy(&anElement, msh_cursor, sizeof(G4int ));
314  param->SetChamberNb(anElement);
315 
316  }
317  msh_cursor += msh_currentSize;
318 }
319 
320 };
321 #endif
322 
ShadowedMarshaledExN02TrackerHit * Shadowed_param
Float_t tmp
Definition: plot.C:36
#define MSH_SET_TOTALSIZE(X)
Definition: MarshaledObj.h:22
#define MSH_SET_TYPECHOICE(X)
Definition: MarshaledObj.h:21
MarshaledExN02TrackerHit(void *buf, char chIsUnmarshaling= 'u')
void unmarshalTo(ExN02TrackerHit *obj)
#define MSH_HEADER_SIZE
Definition: MarshaledObj.h:15
MarshaledExN02TrackerHit(ExN02TrackerHit *objptr)