LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MarshaledG4VHitsCollection.h
Go to the documentation of this file.
1 //
4 // This file was generated automatically by marshalgen.
5 
6 #ifndef MarshaledG4VHitsCollection_H
7 #define MarshaledG4VHitsCollection_H
8 
9 
10 #include <G4VHitsCollection.hh>
11 
12 
13 #include <stdio.h>
14 #include <string.h>
15 #include "MarshaledObj.h"
16 
18 
20  friend class MarshaledG4VHitsCollection;
21 };
22 
23  class MarshaledG4VHitsCollection : public MarshaledObj {
24 public:
25  G4VHitsCollection* param;
26  ShadowedMarshaledG4VHitsCollection* Shadowed_param;
27 public:
28 
29 
30 // Function implementations
31 
32 MarshaledG4VHitsCollection(G4VHitsCollection* objptr) : MarshaledObj() {
33  msh_isUnmarshalDone = false;
34  this->param = objptr;
35  this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
36  if (objptr == NULL)
37  return;
38 
39  marshal1();
40  marshal2();
41  marshal3();
42 }
43 
44 MarshaledG4VHitsCollection(void *buf, char isUnmarshaling = 'u')
45 : MarshaledObj(buf, isUnmarshaling) {
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  if(0){}
64  else if(msh_typechoice == 0){
65  param = new G4THitsCollection<ExN04CalorimeterHit>("","");
66  }
67  else if(msh_typechoice == 1){
68  param = new G4THitsCollection<ExN04MuonHit>("","");
69  }
70  else if(msh_typechoice == 2){
71  param = new G4THitsCollection<ExN04TrackerHit>("","");
72  }
73  }
74  this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
75  this->msh_isUnmarshalDone = true;
76  unmarshal1();
77  unmarshal2();
78  unmarshal3();
79  return this->param;
80  }
81 }
82 
84  //We don't want to unmarshal the buffer is empty.
85  if(msh_size <= MSH_HEADER_SIZE) {
86  //This is buggy, we can't always assume that
87  //obj == NULL <==> List is empty.
88  return;
89  } else {
90  this->param = obj;
91  this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
92  this->msh_isUnmarshalDone = true;
93  unmarshal1();
94  unmarshal2();
95  unmarshal3();
96  }
97 }
98 
99 void marshal1() {
100  //declare field_size to be the size of this field
101  int msh_currentSize = 0;
102  if (isUnmarshaling())
103  throw "Tried to marshal in obj marked isUnmarshaling == true";
104 
105  //Copy the sizespec into msh_currentSize here:
106  {
107  // no need to declare size since msh_currentSize is already assigned in the MARSHAL field
108 
109  }
110 
111  //Increase the size of buffer if needed
112  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
113  //Mark the beginning position for this field, will write the total size of this field here later
114  msh_field_begin = msh_cursor;
115 
116  //Advance cursor of distance = sizeof(int)
117  msh_cursor += sizeof(int);
118 
119  //Now just copy "get" functions here
120  {
121  G4String anElement;
122  anElement = param->GetName();
123  MarshaledG4String var(&anElement);
124  EXTEND_BUFFER(var.getBufferSize());
125  msh_currentSize = var.getBufferSize();
126  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
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  MarshaledG4String var(msh_cursor, 'u');
149  G4String anElement;
150  var.unmarshalTo(&anElement);
151  Shadowed_param->collectionName=anElement;
152 
153  }
154  msh_cursor += msh_currentSize;
155 }
156 
157 void marshal2() {
158  //declare field_size to be the size of this field
159  int msh_currentSize = 0;
160  if (isUnmarshaling())
161  throw "Tried to marshal in obj marked isUnmarshaling == true";
162 
163  //Copy the sizespec into msh_currentSize here:
164  {
165  // no need to declare size since msh_currentSize is already assigned in the MARSHAL field
166 
167  }
168 
169  //Increase the size of buffer if needed
170  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
171  //Mark the beginning position for this field, will write the total size of this field here later
172  msh_field_begin = msh_cursor;
173 
174  //Advance cursor of distance = sizeof(int)
175  msh_cursor += sizeof(int);
176 
177  //Now just copy "get" functions here
178  {
179  G4String anElement;
180  anElement = param->GetSDname();
181  MarshaledG4String var(&anElement);
182  EXTEND_BUFFER(var.getBufferSize());
183  msh_currentSize = var.getBufferSize();
184  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
185  }
186  //Now advance the cursor
187  msh_cursor += msh_currentSize;
188  //Now set the size of this field
189  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
190  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
191  memcpy(msh_field_begin, &tmp, sizeof(int));
192 
193  //Now set msh_size
194  msh_size = msh_cursor - msh_buffer;
195  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
196 }
197 
198 void unmarshal2() {
199  //declare currentSize to be the size of this field
200  int msh_currentSize = 0;
201  //copy the size of the current field into currentSize
202  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
203  msh_cursor += sizeof(int);
204  //Now copy the setspec here
205  {
206  MarshaledG4String var(msh_cursor, 'u');
207  G4String anElement;
208  var.unmarshalTo(&anElement);
209  Shadowed_param->SDname=anElement;
210 
211  }
212  msh_cursor += msh_currentSize;
213 }
214 
215 void marshal3() {
216  //declare field_size to be the size of this field
217  int msh_currentSize = 0;
218  if (isUnmarshaling())
219  throw "Tried to marshal in obj marked isUnmarshaling == true";
220 
221  //Copy the sizespec into msh_currentSize here:
222  {
223  //code for size, just dummy code because the size will be set correctly at the end of marshaling code
224 
225  }
226 
227  //Increase the size of buffer if needed
228  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
229  //Mark the beginning position for this field, will write the total size of this field here later
230  msh_field_begin = msh_cursor;
231 
232  //Advance cursor of distance = sizeof(int)
233  msh_cursor += sizeof(int);
234 
235  //Now just copy "get" functions here
236  {
237  if(0){}
238  else if((param->GetName() == "calCollection") ){
241  EXTEND_BUFFER(marChild.getBufferSize());
242  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
243  msh_currentSize = marChild.getBufferSize();
244  msh_typechoice = 0;
245  }
246  else if( (param->GetName() == "muonCollection") ){
249  EXTEND_BUFFER(marChild.getBufferSize());
250  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
251  msh_currentSize = marChild.getBufferSize();
252  msh_typechoice = 1;
253  }
254  else if( true ){
257  EXTEND_BUFFER(marChild.getBufferSize());
258  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
259  msh_currentSize = marChild.getBufferSize();
260  msh_typechoice = 2;
261  }
262 
263  }
264  //Now advance the cursor
265  msh_cursor += msh_currentSize;
266  //Now set the size of this field
267  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
268  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
269  memcpy(msh_field_begin, &tmp, sizeof(int));
270 
271  //Now set msh_size
272  msh_size = msh_cursor - msh_buffer;
273  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
274 }
275 
276 void unmarshal3() {
277  //declare currentSize to be the size of this field
278  int msh_currentSize = 0;
279  //copy the size of the current field into currentSize
280  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
281  msh_cursor += sizeof(int);
282  //Now copy the setspec here
283  {
284  if(0){}
285  else if(msh_typechoice == 0){
288  }
289  else if(msh_typechoice == 1){
290  MarshaledG4THitsCollection<ExN04MuonHit> marObj(msh_cursor);
292  }
293  else if(msh_typechoice == 2){
296  }
297 
298  }
299  msh_cursor += msh_currentSize;
300 }
301 
302 };
303 #endif
304 
MarshaledG4VHitsCollection(void *buf, char isUnmarshaling= 'u')
Float_t tmp
Definition: plot.C:35
void unmarshalTo(G4THitsCollection< T > *obj)
void unmarshalTo(G4VHitsCollection *obj)
void unmarshalTo(G4String *obj)
MarshaledG4VHitsCollection(G4VHitsCollection *objptr)