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