Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MarshaledG4VHitsCollection.h
Go to the documentation of this file.
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 
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 in the MARSHAL field
105 
106  }
107 
108  //Increase the size of buffer if needed
109  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)
110  //Mark the beginning position for this field, will write the total size of this field here later
112 
113  //Advance cursor of distance = sizeof(int)
114  msh_cursor += sizeof(int);
115 
116  //Now just copy "get" functions here
117  {
118  G4String anElement;
119  anElement = param->GetName();
120  MarshaledG4String var(&anElement);
122  msh_currentSize = var.getBufferSize();
123  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
124  }
125  //Now advance the cursor
126  msh_cursor += msh_currentSize;
127  //Now set the size of this field
128  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
129  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
130  memcpy(msh_field_begin, &tmp, sizeof(int));
131 
132  //Now set msh_size
135 }
136 
137 void unmarshal1() {
138  //declare currentSize to be the size of this field
139  int msh_currentSize = 0;
140  //copy the size of the current field into currentSize
141  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
142  msh_cursor += sizeof(int);
143  //Now copy the setspec here
144  {
146  G4String anElement;
147  var.unmarshalTo(&anElement);
148  Shadowed_param->collectionName=anElement;
149 
150  }
151  msh_cursor += msh_currentSize;
152 }
153 
154 void marshal2() {
155  //declare field_size to be the size of this field
156  int msh_currentSize = 0;
157  if (isUnmarshaling())
158  throw "Tried to marshal in obj marked isUnmarshaling == true";
159 
160  //Copy the sizespec into msh_currentSize here:
161  {
162  // no need to declare size since msh_currentSize is already assigned in the MARSHAL field
163 
164  }
165 
166  //Increase the size of buffer if needed
167  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)
168  //Mark the beginning position for this field, will write the total size of this field here later
170 
171  //Advance cursor of distance = sizeof(int)
172  msh_cursor += sizeof(int);
173 
174  //Now just copy "get" functions here
175  {
176  G4String anElement;
177  anElement = param->GetSDname();
178  MarshaledG4String var(&anElement);
180  msh_currentSize = var.getBufferSize();
181  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
182  }
183  //Now advance the cursor
184  msh_cursor += msh_currentSize;
185  //Now set the size of this field
186  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
187  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
188  memcpy(msh_field_begin, &tmp, sizeof(int));
189 
190  //Now set msh_size
193 }
194 
195 void unmarshal2() {
196  //declare currentSize to be the size of this field
197  int msh_currentSize = 0;
198  //copy the size of the current field into currentSize
199  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
200  msh_cursor += sizeof(int);
201  //Now copy the setspec here
202  {
204  G4String anElement;
205  var.unmarshalTo(&anElement);
206  Shadowed_param->SDname=anElement;
207 
208  }
209  msh_cursor += msh_currentSize;
210 }
211 
212 void marshal3() {
213  //declare field_size to be the size of this field
214  int msh_currentSize = 0;
215  if (isUnmarshaling())
216  throw "Tried to marshal in obj marked isUnmarshaling == true";
217 
218  //Copy the sizespec into msh_currentSize here:
219  {
220  //code for size, just dummy code because the size will be set correctly at the end of marshaling code
221 
222  }
223 
224  //Increase the size of buffer if needed
225  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)
226  //Mark the beginning position for this field, will write the total size of this field here later
228 
229  //Advance cursor of distance = sizeof(int)
230  msh_cursor += sizeof(int);
231 
232  //Now just copy "get" functions here
233  {
234  if(0){}
235  else if((param->GetName() == "calCollection") ){
238  EXTEND_BUFFER(marChild.getBufferSize());
239  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
240  msh_currentSize = marChild.getBufferSize();
241  msh_typechoice = 0;
242  }
243  else if( (param->GetName() == "muonCollection") ){
246  EXTEND_BUFFER(marChild.getBufferSize());
247  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
248  msh_currentSize = marChild.getBufferSize();
249  msh_typechoice = 1;
250  }
251  else if( true ){
254  EXTEND_BUFFER(marChild.getBufferSize());
255  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
256  msh_currentSize = marChild.getBufferSize();
257  msh_typechoice = 2;
258  }
259 
260  }
261  //Now advance the cursor
262  msh_cursor += msh_currentSize;
263  //Now set the size of this field
264  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
265  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
266  memcpy(msh_field_begin, &tmp, sizeof(int));
267 
268  //Now set msh_size
271 }
272 
273 void unmarshal3() {
274  //declare currentSize to be the size of this field
275  int msh_currentSize = 0;
276  //copy the size of the current field into currentSize
277  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
278  msh_cursor += sizeof(int);
279  //Now copy the setspec here
280  {
281  if(0){}
282  else if(msh_typechoice == 0){
285  }
286  else if(msh_typechoice == 1){
289  }
290  else if(msh_typechoice == 2){
293  }
294 
295  }
296  msh_cursor += msh_currentSize;
297 }
298 
299 };
300 #endif
301