ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MarshaledG4VHitsCollection.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MarshaledG4VHitsCollection.h
1 // This file was generated automatically by marshalgen.
2 
3 #ifndef MarshaledG4VHitsCollection_H
4 #define MarshaledG4VHitsCollection_H
5 
6 
7 #include <G4VHitsCollection.hh>
8 
9 
10 #include <stdio.h>
11 #include <string.h>
12 #include "MarshaledObj.h"
13 
15 
17  friend class MarshaledG4VHitsCollection;
18 };
19 
21 public:
24 public:
25 
26 
27 // Function implementations
28 
30  msh_isUnmarshalDone = false;
31  this->param = objptr;
33  if (objptr == NULL)
34  return;
35 
36  marshal1();
37  marshal2();
38  marshal3();
39 }
40 
41 MarshaledG4VHitsCollection(void *buf, char chIsUnmarshaling = 'u')
42 : MarshaledObj(buf, chIsUnmarshaling) {
43  msh_isUnmarshalDone = false;
44 }
45 
47  //if(msh_isUnmarshalDone && this->param != NULL) {
48  //delete this->param;
49  //}
50 }
51 
53  //We don't want to unmarshal the buffer is empty.
54  if(msh_size <= MSH_HEADER_SIZE) {
55  //This is buggy, we can't always assume that
56  //obj == NULL <==> List is empty.
57  return NULL;
58  } else {
59  {
60  if(0){}
61  else if(msh_typechoice == 0){
63  }
64  else if(msh_typechoice == 1){
66  }
67  else if(msh_typechoice == 2){
69  }
70  }
72  this->msh_isUnmarshalDone = true;
73  unmarshal1();
74  unmarshal2();
75  unmarshal3();
76  return this->param;
77  }
78 }
79 
81  //We don't want to unmarshal the buffer is empty.
82  if(msh_size <= MSH_HEADER_SIZE) {
83  //This is buggy, we can't always assume that
84  //obj == NULL <==> List is empty.
85  return;
86  } else {
87  this->param = obj;
89  this->msh_isUnmarshalDone = true;
90  unmarshal1();
91  unmarshal2();
92  unmarshal3();
93  }
94 }
95 
96 void marshal1() {
97  //declare field_size to be the size of this field
98  int msh_currentSize = 0;
99  if (isUnmarshaling())
100  throw "Tried to marshal in obj marked isUnmarshaling == true";
101 
102  //Copy the sizespec into msh_currentSize here:
103  {
104  // no need to declare size since msh_currentSize is already assigned
105  //in the MARSHAL field
106 
107  }
108 
109  //Increase the size of buffer if needed
110  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
111  // 4 bytes for the total size of field, 4 bytes for the number of
112  // elements in the array (in the case of array marshaling)
113  //Mark the beginning position for this field, will write the total size
114  //of this field here later
116 
117  //Advance cursor of distance = sizeof(int)
118  msh_cursor += sizeof(int);
119 
120  //Now just copy "get" functions here
121  {
122  G4String anElement;
123  anElement = param->GetName();
124  MarshaledG4String var(&anElement);
126  msh_currentSize = var.getBufferSize();
127  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
128  }
129  //Now advance the cursor
130  msh_cursor += msh_currentSize;
131  //Now set the size of this field
132  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
133  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
134  memcpy(msh_field_begin, &tmp, sizeof(int));
135 
136  //Now set msh_size
139 }
140 
141 void unmarshal1() {
142  //declare currentSize to be the size of this field
143  int msh_currentSize = 0;
144  //copy the size of the current field into currentSize
145  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
146  msh_cursor += sizeof(int);
147  //Now copy the setspec here
148  {
149  MarshaledG4String var(msh_cursor, 'u');
150  G4String anElement;
151  var.unmarshalTo(&anElement);
152  Shadowed_param->collectionName=anElement;
153 
154  }
155  msh_cursor += msh_currentSize;
156 }
157 
158 void marshal2() {
159  //declare field_size to be the size of this field
160  int msh_currentSize = 0;
161  if (isUnmarshaling())
162  throw "Tried to marshal in obj marked isUnmarshaling == true";
163 
164  //Copy the sizespec into msh_currentSize here:
165  {
166  // no need to declare size since msh_currentSize is already assigned
167  // in the MARSHAL field
168 
169  }
170 
171  //Increase the size of buffer if needed
172  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
173  // 4 bytes for the total size of field, 4 bytes for the number of
174  // elements in the array (in the case of array marshaling)
175  //Mark the beginning position for this field, will write the total size
176  //of this field here later
178 
179  //Advance cursor of distance = sizeof(int)
180  msh_cursor += sizeof(int);
181 
182  //Now just copy "get" functions here
183  {
184  G4String anElement;
185  anElement = param->GetSDname();
186  MarshaledG4String var(&anElement);
188  msh_currentSize = var.getBufferSize();
189  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
190  }
191  //Now advance the cursor
192  msh_cursor += msh_currentSize;
193  //Now set the size of this field
194  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
195  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
196  memcpy(msh_field_begin, &tmp, sizeof(int));
197 
198  //Now set msh_size
201 }
202 
203 void unmarshal2() {
204  //declare currentSize to be the size of this field
205  int msh_currentSize = 0;
206  //copy the size of the current field into currentSize
207  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
208  msh_cursor += sizeof(int);
209  //Now copy the setspec here
210  {
211  MarshaledG4String var(msh_cursor, 'u');
212  G4String anElement;
213  var.unmarshalTo(&anElement);
214  Shadowed_param->SDname=anElement;
215 
216  }
217  msh_cursor += msh_currentSize;
218 }
219 
220 void marshal3() {
221  //declare field_size to be the size of this field
222  int msh_currentSize = 0;
223  if (isUnmarshaling())
224  throw "Tried to marshal in obj marked isUnmarshaling == true";
225 
226  //Copy the sizespec into msh_currentSize here:
227  {
228  //code for size, just dummy code because the size will be set correctly
229  //at the end of marshaling code
230 
231  }
232 
233  //Increase the size of buffer if needed
234  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
235  // 4 bytes for the total size of field, 4 bytes for the number of
236  // elements in the array (in the case of array marshaling)
237  //Mark the beginning position for this field, will write the total size
238  //of this field here later
240 
241  //Advance cursor of distance = sizeof(int)
242  msh_cursor += sizeof(int);
243 
244  //Now just copy "get" functions here
245  {
246  if(0){}
247  else if((param->GetName() == "calCollection") ){
251  EXTEND_BUFFER(marChild.getBufferSize());
252  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
253  msh_currentSize = marChild.getBufferSize();
254  msh_typechoice = 0;
255  }
256  else if( (param->GetName() == "muonCollection") ){
260  EXTEND_BUFFER(marChild.getBufferSize());
261  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
262  msh_currentSize = marChild.getBufferSize();
263  msh_typechoice = 1;
264  }
265  else if( true ){
269  EXTEND_BUFFER(marChild.getBufferSize());
270  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
271  msh_currentSize = marChild.getBufferSize();
272  msh_typechoice = 2;
273  }
274 
275  }
276  //Now advance the cursor
277  msh_cursor += msh_currentSize;
278  //Now set the size of this field
279  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
280  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
281  memcpy(msh_field_begin, &tmp, sizeof(int));
282 
283  //Now set msh_size
286 }
287 
288 void unmarshal3() {
289  //declare currentSize to be the size of this field
290  int msh_currentSize = 0;
291  //copy the size of the current field into currentSize
292  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
293  msh_cursor += sizeof(int);
294  //Now copy the setspec here
295  {
296  if(0){}
297  else if(msh_typechoice == 0){
300  }
301  else if(msh_typechoice == 1){
304  }
305  else if(msh_typechoice == 2){
308  }
309 
310  }
311  msh_cursor += msh_currentSize;
312 }
313 
314 };
315 #endif
316