Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParN02/include/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 
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  {
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
96  //in the MARSHAL field
97 
98  }
99 
100  //Increase the size of buffer if needed
101  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
102  // 4 bytes for the total size of field, 4 bytes for the number
103  // of elements in the array (in the case of array marshaling)
104  //Mark the beginning position for this field, will write the total
105  //size of this field here later
107 
108  //Advance cursor of distance = sizeof(int)
109  msh_cursor += sizeof(int);
110 
111  //Now just copy "get" functions here
112  {
113  G4String anElement;
114  anElement = param->GetName();
115  MarshaledG4String var(&anElement);
117  msh_currentSize = var.getBufferSize();
118  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
119  }
120  //Now advance the cursor
121  msh_cursor += msh_currentSize;
122  //Now set the size of this field
123  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
124  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
125  memcpy(msh_field_begin, &tmp, sizeof(int));
126 
127  //Now set msh_size
130 }
131 
132 void unmarshal1() {
133  //declare currentSize to be the size of this field
134  int msh_currentSize = 0;
135  //copy the size of the current field into currentSize
136  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
137  msh_cursor += sizeof(int);
138  //Now copy the setspec here
139  {
141  G4String anElement;
142  var.unmarshalTo(&anElement);
143  Shadowed_param->collectionName=anElement;
144 
145  }
146  msh_cursor += msh_currentSize;
147 }
148 
149 void marshal2() {
150  //declare field_size to be the size of this field
151  int msh_currentSize = 0;
152  if (isUnmarshaling())
153  throw "Tried to marshal in obj marked isUnmarshaling == true";
154 
155  //Copy the sizespec into msh_currentSize here:
156  {
157  // no need to declare size since msh_currentSize is already assigned
158  // in the MARSHAL field
159 
160  }
161 
162  //Increase the size of buffer if needed
163  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
164  // 4 bytes for the total size of field, 4 bytes for the number
165  // of elements in the array (in the case of array marshaling)
166  //Mark the beginning position for this field, will write the total
167  // size of this field here later
169 
170  //Advance cursor of distance = sizeof(int)
171  msh_cursor += sizeof(int);
172 
173  //Now just copy "get" functions here
174  {
175  G4String anElement;
176  anElement = param->GetSDname();
177  MarshaledG4String var(&anElement);
179  msh_currentSize = var.getBufferSize();
180  memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
181  }
182  //Now advance the cursor
183  msh_cursor += msh_currentSize;
184  //Now set the size of this field
185  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
186  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
187  memcpy(msh_field_begin, &tmp, sizeof(int));
188 
189  //Now set msh_size
192 }
193 
194 void unmarshal2() {
195  //declare currentSize to be the size of this field
196  int msh_currentSize = 0;
197  //copy the size of the current field into currentSize
198  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
199  msh_cursor += sizeof(int);
200  //Now copy the setspec here
201  {
203  G4String anElement;
204  var.unmarshalTo(&anElement);
205  Shadowed_param->SDname=anElement;
206 
207  }
208  msh_cursor += msh_currentSize;
209 }
210 
211 void marshal3() {
212  //declare field_size to be the size of this field
213  int msh_currentSize = 0;
214  if (isUnmarshaling())
215  throw "Tried to marshal in obj marked isUnmarshaling == true";
216 
217  //Copy the sizespec into msh_currentSize here:
218  {
219  //code for size, just dummy code because the size will be
220  //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));
226  // 4 bytes for the total size of field, 4 bytes for the number of
227  // elements in the array (in the case of array marshaling)
228  //Mark the beginning position for this field, will write the total
229  //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  {
239  EXTEND_BUFFER(marChild.getBufferSize());
240  memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
241  msh_currentSize = marChild.getBufferSize();
242  msh_typechoice = 0;
243 
244  }
245  //Now advance the cursor
246  msh_cursor += msh_currentSize;
247  //Now set the size of this field
248  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
249  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
250  memcpy(msh_field_begin, &tmp, sizeof(int));
251 
252  //Now set msh_size
255 }
256 
257 void unmarshal3() {
258  //declare currentSize to be the size of this field
259  int msh_currentSize = 0;
260  //copy the size of the current field into currentSize
261  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
262  msh_cursor += sizeof(int);
263  //Now copy the setspec here
264  {
267 
268  }
269  msh_cursor += msh_currentSize;
270 }
271 
272 };
273 #endif
274 
real *8 function var(A, B, C, D)
Definition: dpm25nuc1.f:4649
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
#define MSH_SET_TYPECHOICE(X)
void EXTEND_BUFFER(int size)
#define MSH_HEADER_SIZE
#define MSH_SET_TOTALSIZE(X)
MarshaledG4VHitsCollection(void *buf, char chIsUnmarshaling= 'u')