LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MarshaledG4THitsCollection.h
Go to the documentation of this file.
1 // This file was generated automatically by marshalgen.
2 //
5 
6 #ifndef MarshaledG4HitsCollection_H
7 #define MarshaledG4HitsCollection_H
8 
9 
10 #include <G4THitsCollection.hh>
11 
12 
13 #include <stdio.h>
14 #include <string.h>
15 #include "MarshaledObj.h"
16 
18 
21 };
22 
23 
24 template <class T> class MarshaledG4THitsCollection;
25 
26 template <class T> class ShadowedMarshaledG4THitsCollection : public G4THitsCollection<T>{
27  friend class MarshaledG4THitsCollection<T>;
28 };
29 
30  class MarshaledG4HitsCollection : public MarshaledObj {
31 public:
34 public:
35 
36 
37 // Function implementations
38 
39 MarshaledG4HitsCollection(G4HitsCollection* objptr) : MarshaledObj() {
40  msh_isUnmarshalDone = false;
41  this->param = objptr;
42  this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
43  if (objptr == NULL)
44  return;
45 
46  marshal1();
47 }
48 
49 MarshaledG4HitsCollection(void *buf, char isUnmarshaling = 'u')
50 : MarshaledObj(buf, isUnmarshaling) {
51  msh_isUnmarshalDone = false;
52 }
53 
55  //if(msh_isUnmarshalDone && this->param != NULL) {
56  //delete this->param;
57  //}
58 }
59 
61  //We don't want to unmarshal the buffer is empty.
62  if(msh_size <= MSH_HEADER_SIZE) {
63  //This is buggy, we can't always assume that
64  //obj == NULL <==> List is empty.
65  return NULL;
66  } else {
67  {
68  param = new G4HitsCollection();
69  }
70  this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
71  this->msh_isUnmarshalDone = true;
72  unmarshal1();
73  return this->param;
74  }
75 }
76 
78  //We don't want to unmarshal the buffer is empty.
79  if(msh_size <= MSH_HEADER_SIZE) {
80  //This is buggy, we can't always assume that
81  //obj == NULL <==> List is empty.
82  return;
83  } else {
84  this->param = obj;
85  this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
86  this->msh_isUnmarshalDone = true;
87  unmarshal1();
88  }
89 }
90 
91 void marshal1() {
92  //declare field_size to be the size of this field
93  int msh_currentSize = 0;
94  if (isUnmarshaling())
95  throw "Tried to marshal in obj marked isUnmarshaling == true";
96 
97  //Copy the sizespec into msh_currentSize here:
98  {
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
105  msh_field_begin = msh_cursor;
106 
107  //Advance cursor of distance = sizeof(int)
108  msh_cursor += sizeof(int);
109 
110  //Now just copy "get" functions here
111  {
112  int copy_off = 0;
113  int elementNum;
114  elementNum = ((G4THitsCollection<ExN02TrackerHit>*)param)->entries();
115  memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
116  copy_off += sizeof(int);
117  for(int index=0;index<elementNum;index++){
118  ExN02TrackerHit* anElement;
119  anElement = (*((G4THitsCollection<ExN02TrackerHit>*)param))[index];
120  MarshaledExN02TrackerHit marEle(anElement);
121  EXTEND_BUFFER(marEle.getBufferSize());
122  memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
123  copy_off += marEle.getBufferSize();
124  }
125  msh_currentSize = copy_off;
126 
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
136  msh_size = msh_cursor - msh_buffer;
137  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
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  int copy_off = 0;
149  int elementNum;
150  memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
151  copy_off += sizeof(int);
152  for(int index=0;index<elementNum;index++){
153  MarshaledExN02TrackerHit marEle(msh_cursor+copy_off);
154  ExN02TrackerHit* anElement = (ExN02TrackerHit* )marEle.unmarshal();
155  copy_off += marEle.getBufferSize();
156  ((G4THitsCollection<ExN02TrackerHit>*)param)->insert((ExN02TrackerHit*)anElement);
157  }
158 
159  }
160  msh_cursor += msh_currentSize;
161 }
162 
163 };
164 template <class T> class MarshaledG4THitsCollection : public MarshaledObj {
165 public:
168 public:
169 
170 
171 // Function implementations
172 
174  msh_isUnmarshalDone = false;
175  this->param = objptr;
176  this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
177  if (objptr == NULL)
178  return;
179 
180  marshal1();
181 }
182 
183 MarshaledG4THitsCollection(void *buf, char isUnmarshaling = 'u')
184 : MarshaledObj(buf, isUnmarshaling) {
185  msh_isUnmarshalDone = false;
186 }
187 
189  //if(msh_isUnmarshalDone && this->param != NULL) {
190  //delete this->param;
191  //}
192 }
193 
195  //We don't want to unmarshal the buffer is empty.
196  if(msh_size <= MSH_HEADER_SIZE) {
197  //This is buggy, we can't always assume that
198  //obj == NULL <==> List is empty.
199  return NULL;
200  } else {
201  {
202  param = new G4THitsCollection<T>();
203  }
204  this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
205  this->msh_isUnmarshalDone = true;
206  unmarshal1();
207  return this->param;
208  }
209 }
210 
212  //We don't want to unmarshal the buffer is empty.
213  if(msh_size <= MSH_HEADER_SIZE) {
214  //This is buggy, we can't always assume that
215  //obj == NULL <==> List is empty.
216  return;
217  } else {
218  this->param = obj;
219  this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
220  this->msh_isUnmarshalDone = true;
221  unmarshal1();
222  }
223 }
224 
225 void marshal1() {
226  //declare field_size to be the size of this field
227  int msh_currentSize = 0;
228  if (isUnmarshaling())
229  throw "Tried to marshal in obj marked isUnmarshaling == true";
230 
231  //Copy the sizespec into msh_currentSize here:
232  {
233  //code for size, just dummy code because the size will be set correctly at the end of marshaling code
234 
235  }
236 
237  //Increase the size of buffer if needed
238  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)
239  //Mark the beginning position for this field, will write the total size of this field here later
240  msh_field_begin = msh_cursor;
241 
242  //Advance cursor of distance = sizeof(int)
243  msh_cursor += sizeof(int);
244 
245  //Now just copy "get" functions here
246  {
247  MarshaledG4HitsCollection marParent(param);
248  EXTEND_BUFFER(marParent.getBufferSize());
249  memcpy(msh_cursor,marParent.getBuffer(), marParent.getBufferSize());
250  msh_currentSize = marParent.getBufferSize();
251 
252  }
253  //Now advance the cursor
254  msh_cursor += msh_currentSize;
255  //Now set the size of this field
256  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
257  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
258  memcpy(msh_field_begin, &tmp, sizeof(int));
259 
260  //Now set msh_size
261  msh_size = msh_cursor - msh_buffer;
262  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
263 }
264 
265 void unmarshal1() {
266  //declare currentSize to be the size of this field
267  int msh_currentSize = 0;
268  //copy the size of the current field into currentSize
269  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
270  msh_cursor += sizeof(int);
271  //Now copy the setspec here
272  {
273  MarshaledG4HitsCollection marObj(msh_cursor);
274  marObj.unmarshalTo(param);
275 
276  }
277  msh_cursor += msh_currentSize;
278 }
279 
280 };
281 #endif
282 
MarshaledG4HitsCollection(G4HitsCollection *objptr)
MarshaledG4HitsCollection(void *buf, char isUnmarshaling= 'u')
ShadowedMarshaledG4HitsCollection * Shadowed_param
Float_t tmp
Definition: plot.C:35
void unmarshalTo(G4THitsCollection< T > *obj)
ShadowedMarshaledG4THitsCollection< T > * Shadowed_param
G4THitsCollection< T > * unmarshal()
void unmarshalTo(G4HitsCollection *obj)
MarshaledG4THitsCollection(G4THitsCollection< T > *objptr)
MarshaledG4THitsCollection(void *buf, char isUnmarshaling= 'u')