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  {
61  }
63  this->msh_isUnmarshalDone = true;
64  unmarshal1();
65  unmarshal2();
66  unmarshal3();
67  return this->param;
68  }
69 }
70 
72  //We don't want to unmarshal the buffer is empty.
73  if(msh_size <= MSH_HEADER_SIZE) {
74  //This is buggy, we can't always assume that
75  //obj == NULL <==> List is empty.
76  return;
77  } else {
78  this->param = obj;
80  this->msh_isUnmarshalDone = true;
81  unmarshal1();
82  unmarshal2();
83  unmarshal3();
84  }
85 }
86 
87 void marshal1() {
88  //declare field_size to be the size of this field
89  int msh_currentSize = 0;
90  if (isUnmarshaling())
91  throw "Tried to marshal in obj marked isUnmarshaling == true";
92 
93  //Copy the sizespec into msh_currentSize here:
94  {
95  // no need to declare size since msh_currentSize is already assigned in the MARSHAL field
96 
97  }
98 
99  //Increase the size of buffer if needed
100  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)
101  //Mark the beginning position for this field, will write the total size of this field here later
103 
104  //Advance cursor of distance = sizeof(int)
105  msh_cursor += sizeof(int);
106 
107  //Now just copy "get" functions here
108  {
109  G4String anElement;
110  anElement = param->GetName();
111  MarshaledG4String var(&anElement);
113  msh_currentSize = var.getBufferSize();
114  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
115  }
116  //Now advance the cursor
117  msh_cursor += msh_currentSize;
118  //Now set the size of this field
119  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
120  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
121  memcpy(msh_field_begin, &tmp, sizeof(int));
122 
123  //Now set msh_size
126 }
127 
128 void unmarshal1() {
129  //declare currentSize to be the size of this field
130  int msh_currentSize = 0;
131  //copy the size of the current field into currentSize
132  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
133  msh_cursor += sizeof(int);
134  //Now copy the setspec here
135  {
137  G4String anElement;
138  var.unmarshalTo(&anElement);
139  Shadowed_param->collectionName=anElement;
140 
141  }
142  msh_cursor += msh_currentSize;
143 }
144 
145 void marshal2() {
146  //declare field_size to be the size of this field
147  int msh_currentSize = 0;
148  if (isUnmarshaling())
149  throw "Tried to marshal in obj marked isUnmarshaling == true";
150 
151  //Copy the sizespec into msh_currentSize here:
152  {
153  // no need to declare size since msh_currentSize is already assigned in the MARSHAL field
154 
155  }
156 
157  //Increase the size of buffer if needed
158  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)
159  //Mark the beginning position for this field, will write the total size of this field here later
161 
162  //Advance cursor of distance = sizeof(int)
163  msh_cursor += sizeof(int);
164 
165  //Now just copy "get" functions here
166  {
167  G4String anElement;
168  anElement = param->GetSDname();
169  MarshaledG4String var(&anElement);
171  msh_currentSize = var.getBufferSize();
172  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
173  }
174  //Now advance the cursor
175  msh_cursor += msh_currentSize;
176  //Now set the size of this field
177  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
178  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
179  memcpy(msh_field_begin, &tmp, sizeof(int));
180 
181  //Now set msh_size
184 }
185 
186 void unmarshal2() {
187  //declare currentSize to be the size of this field
188  int msh_currentSize = 0;
189  //copy the size of the current field into currentSize
190  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
191  msh_cursor += sizeof(int);
192  //Now copy the setspec here
193  {
195  G4String anElement;
196  var.unmarshalTo(&anElement);
197  Shadowed_param->SDname=anElement;
198 
199  }
200  msh_cursor += msh_currentSize;
201 }
202 
203 void marshal3() {
204  //declare field_size to be the size of this field
205  int msh_currentSize = 0;
206  if (isUnmarshaling())
207  throw "Tried to marshal in obj marked isUnmarshaling == true";
208 
209  //Copy the sizespec into msh_currentSize here:
210  {
211  //code for size, just dummy code because the size will be set correctly at the end of marshaling code
212 
213  }
214 
215  //Increase the size of buffer if needed
216  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)
217  //Mark the beginning position for this field, will write the total size of this field here later
219 
220  //Advance cursor of distance = sizeof(int)
221  msh_cursor += sizeof(int);
222 
223  //Now just copy "get" functions here
224  {
227  EXTEND_BUFFER(marChild.getBufferSize());
228  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
229  msh_currentSize = marChild.getBufferSize();
230  msh_typechoice = 0;
231 
232  }
233  //Now advance the cursor
234  msh_cursor += msh_currentSize;
235  //Now set the size of this field
236  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
237  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
238  memcpy(msh_field_begin, &tmp, sizeof(int));
239 
240  //Now set msh_size
243 }
244 
245 void unmarshal3() {
246  //declare currentSize to be the size of this field
247  int msh_currentSize = 0;
248  //copy the size of the current field into currentSize
249  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
250  msh_cursor += sizeof(int);
251  //Now copy the setspec here
252  {
255 
256  }
257  msh_cursor += msh_currentSize;
258 }
259 
260 };
261 #endif
262