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 
2 
3 //
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 
24 public:
27 public:
28 
29 
30 // Function implementations
31 
33  msh_isUnmarshalDone = false;
34  this->param = objptr;
36  if (objptr == NULL)
37  return;
38 
39  marshal1();
40  marshal2();
41  marshal3();
42 }
43 
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){
66  }
67  else if(msh_typechoice == 1){
69  }
70  else if(msh_typechoice == 2){
72  }
73  }
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;
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
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);
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
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
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);
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
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
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
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){
292  }
293  else if(msh_typechoice == 2){
296  }
297 
298  }
299  msh_cursor += msh_currentSize;
300 }
301 
302 };
303 #endif
304