Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
ParN04/include/MarshaledG4THitsCollection.h
이 파일의 문서화 페이지로 가기
1 // This file was generated automatically by marshalgen.
2 
3 #ifndef MarshaledG4HitsCollection_H
4 #define MarshaledG4HitsCollection_H
5 
6 
7 #include <G4THitsCollection.hh>
8 //MSH_include_begin
9 #include "ExN04CalorimeterHit.hh"
10 #include "ExN04MuonHit.hh"
11 #include "ExN04TrackerHit.hh"
13 #include "MarshaledExN04MuonHit.h"
15 //MSH_include_end
16 
17 #include <stdio.h>
18 #include <string.h>
19 #include "MarshaledObj.h"
20 
22 
24  friend class MarshaledG4HitsCollection;
25 };
26 
27 
28 template <class T> class MarshaledG4THitsCollection;
29 
30 template <class T> class ShadowedMarshaledG4THitsCollection : public G4THitsCollection<T>{
31  friend class MarshaledG4THitsCollection<T>;
32 };
33 
35 public:
38 public:
39 
40 
41 // Function implementations
42 
44  msh_isUnmarshalDone = false;
45  this->param = objptr;
47  if (objptr == NULL)
48  return;
49 
50  marshal1();
51 }
52 
53 MarshaledG4HitsCollection(void *buf, char chIsUnmarshaling = 'u')
54 : MarshaledObj(buf, chIsUnmarshaling) {
55  msh_isUnmarshalDone = false;
56 }
57 
59  //if(msh_isUnmarshalDone && this->param != NULL) {
60  //delete this->param;
61  //}
62 }
63 
65  //We don't want to unmarshal the buffer is empty.
66  if(msh_size <= MSH_HEADER_SIZE) {
67  //This is buggy, we can't always assume that
68  //obj == NULL <==> List is empty.
69  return NULL;
70  } else {
71  {
72  param = new G4HitsCollection();
73  }
75  this->msh_isUnmarshalDone = true;
76  unmarshal1();
77  return this->param;
78  }
79 }
80 
82  //We don't want to unmarshal the buffer is empty.
83  if(msh_size <= MSH_HEADER_SIZE) {
84  //This is buggy, we can't always assume that
85  //obj == NULL <==> List is empty.
86  return;
87  } else {
88  this->param = obj;
90  this->msh_isUnmarshalDone = true;
91  unmarshal1();
92  }
93 }
94 
95 void marshal1() {
96  //declare field_size to be the size of this field
97  int msh_currentSize = 0;
98  if (isUnmarshaling())
99  throw "Tried to marshal in obj marked isUnmarshaling == true";
100 
101  //Copy the sizespec into msh_currentSize here:
102  {
103 
104  }
105 
106  //Increase the size of buffer if needed
107  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
108  // 4 bytes for the total size of field, 4 bytes for the number of
109  // elements in the array (in the case of array marshaling)
110  //Mark the beginning position for this field, will write the total size
111  //of this field here later
113 
114  //Advance cursor of distance = sizeof(int)
115  msh_cursor += sizeof(int);
116 
117  //Now just copy "get" functions here
118  {
119  int copy_off = 0;
120  int elementNum;
121 
122  if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
123  elementNum = ((G4THitsCollection<ExN04CalorimeterHit>*)param)->entries();
124  else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
125  elementNum = ((G4THitsCollection<ExN04MuonHit>*)param)->entries();
126  else
127  elementNum = ((G4THitsCollection<ExN04TrackerHit>*)param)->entries();
128 
129  memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
130  copy_off += sizeof(int);
131  for(int index=0;index<elementNum;index++){
132  if(0){}
133  else if((dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL) ){
134  void* anElement;
135 
136  if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
137  anElement = (*((G4THitsCollection<ExN04CalorimeterHit>*)param))[index];
138  else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
139  anElement = (*((G4THitsCollection<ExN04MuonHit>*)param))[index];
140  else
141  anElement = (*((G4THitsCollection<ExN04TrackerHit>*)param))[index];
142 
144  EXTEND_BUFFER(marEle.getBufferSize());
145  memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
146  copy_off += marEle.getBufferSize();
147  }
148  else if( (dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL) ){
149  void* anElement;
150 
151  if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
152  anElement = (*((G4THitsCollection<ExN04CalorimeterHit>*)param))[index];
153  else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
154  anElement = (*((G4THitsCollection<ExN04MuonHit>*)param))[index];
155  else
156  anElement = (*((G4THitsCollection<ExN04TrackerHit>*)param))[index];
157 
158  MarshaledExN04MuonHit marEle((ExN04MuonHit* )anElement);
159  EXTEND_BUFFER(marEle.getBufferSize());
160  memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
161  copy_off += marEle.getBufferSize();
162  }
163  else if( true ){
164  void* anElement;
165 
166  if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
167  anElement = (*((G4THitsCollection<ExN04CalorimeterHit>*)param))[index];
168  else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
169  anElement = (*((G4THitsCollection<ExN04MuonHit>*)param))[index];
170  else
171  anElement = (*((G4THitsCollection<ExN04TrackerHit>*)param))[index];
172 
173  MarshaledExN04TrackerHit marEle((ExN04TrackerHit*)anElement);
174  EXTEND_BUFFER(marEle.getBufferSize());
175  memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
176  copy_off += marEle.getBufferSize();
177  }
178  }
179  msh_currentSize = copy_off;
180 
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 unmarshal1() {
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  {
202  if(0){}
203  else if((dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL) ){
204  int copy_off = 0;
205  int elementNum;
206  memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
207  copy_off += sizeof(int);
208  for(int index=0;index<elementNum;index++){
209  MarshaledExN04CalorimeterHit marEle(msh_cursor+copy_off);
210  ExN04CalorimeterHit* anElement = (ExN04CalorimeterHit* )marEle.unmarshal();
211  copy_off += marEle.getBufferSize();
212 
213  if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
215  else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
216  ((G4THitsCollection<ExN04MuonHit>*)param)->insert((ExN04MuonHit*)anElement);
217  else
218  ((G4THitsCollection<ExN04TrackerHit>*)param)->insert((ExN04TrackerHit*)anElement);
219 
220  }
221  }
222  else if( (dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL) ){
223  int copy_off = 0;
224  int elementNum;
225  memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
226  copy_off += sizeof(int);
227  for(int index=0;index<elementNum;index++){
228  MarshaledExN04MuonHit marEle(msh_cursor+copy_off);
229  ExN04MuonHit* anElement = (ExN04MuonHit* )marEle.unmarshal();
230  copy_off += marEle.getBufferSize();
231 
232  if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
234  else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
235  ((G4THitsCollection<ExN04MuonHit>*)param)->insert((ExN04MuonHit*)anElement);
236  else
237  ((G4THitsCollection<ExN04TrackerHit>*)param)->insert((ExN04TrackerHit*)anElement);
238 
239  }
240  }
241  else if( true ){
242  int copy_off = 0;
243  int elementNum;
244  memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
245  copy_off += sizeof(int);
246  for(int index=0;index<elementNum;index++){
247  MarshaledExN04TrackerHit marEle(msh_cursor+copy_off);
248  ExN04TrackerHit* anElement = (ExN04TrackerHit*)marEle.unmarshal();
249  copy_off += marEle.getBufferSize();
250 
251  if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
253  else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
254  ((G4THitsCollection<ExN04MuonHit>*)param)->insert((ExN04MuonHit*)anElement);
255  else
256  ((G4THitsCollection<ExN04TrackerHit>*)param)->insert((ExN04TrackerHit*)anElement);
257 
258  }
259  }
260 
261  }
262  msh_cursor += msh_currentSize;
263 }
264 
265 };
266 template <class T> class MarshaledG4THitsCollection : public MarshaledObj {
267 public:
270 public:
271 
272 
273 // Function implementations
274 
276  msh_isUnmarshalDone = false;
277  this->param = objptr;
279  if (objptr == NULL)
280  return;
281 
282  marshal1();
283 }
284 
285 MarshaledG4THitsCollection(void *buf, char chIsUnmarshaling = 'u')
286 : MarshaledObj(buf, chIsUnmarshaling) {
287  msh_isUnmarshalDone = false;
288 }
289 
291  //if(msh_isUnmarshalDone && this->param != NULL) {
292  //delete this->param;
293  //}
294 }
295 
297  //We don't want to unmarshal the buffer is empty.
298  if(msh_size <= MSH_HEADER_SIZE) {
299  //This is buggy, we can't always assume that
300  //obj == NULL <==> List is empty.
301  return NULL;
302  } else {
303  {
304  param = new G4THitsCollection<T>();
305  }
307  this->msh_isUnmarshalDone = true;
308  unmarshal1();
309  return this->param;
310  }
311 }
312 
314  //We don't want to unmarshal the buffer is empty.
315  if(msh_size <= MSH_HEADER_SIZE) {
316  //This is buggy, we can't always assume that
317  //obj == NULL <==> List is empty.
318  return;
319  } else {
320  this->param = obj;
322  this->msh_isUnmarshalDone = true;
323  unmarshal1();
324  }
325 }
326 
327 void marshal1() {
328  //declare field_size to be the size of this field
329  int msh_currentSize = 0;
330  if (isUnmarshaling())
331  throw "Tried to marshal in obj marked isUnmarshaling == true";
332 
333  //Copy the sizespec into msh_currentSize here:
334  {
335  //code for size, just dummy code because the size will be set correctly
336  // at the end of marshaling code
337 
338  }
339 
340  //Increase the size of buffer if needed
341  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
342  // 4 bytes for the total size of field, 4 bytes for the number of
343  // elements in the array (in the case of array marshaling)
344  //Mark the beginning position for this field, will write the total size
345  //of this field here later
347 
348  //Advance cursor of distance = sizeof(int)
349  msh_cursor += sizeof(int);
350 
351  //Now just copy "get" functions here
352  {
353  MarshaledG4HitsCollection marParent(param);
354  EXTEND_BUFFER(marParent.getBufferSize());
355  memcpy(msh_cursor,marParent.getBuffer(), marParent.getBufferSize());
356  msh_currentSize = marParent.getBufferSize();
357 
358  }
359  //Now advance the cursor
360  msh_cursor += msh_currentSize;
361  //Now set the size of this field
362  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
363  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
364  memcpy(msh_field_begin, &tmp, sizeof(int));
365 
366  //Now set msh_size
369 }
370 
371 void unmarshal1() {
372  //declare currentSize to be the size of this field
373  int msh_currentSize = 0;
374  //copy the size of the current field into currentSize
375  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
376  msh_cursor += sizeof(int);
377  //Now copy the setspec here
378  {
380  marObj.unmarshalTo(param);
381 
382  }
383  msh_cursor += msh_currentSize;
384 }
385 
386 };
387 #endif
388 
MarshaledG4THitsCollection(void *buf, char chIsUnmarshaling= 'u')
Float_t tmp
ShadowedMarshaledG4THitsCollection< T > * Shadowed_param
#define MSH_SET_TOTALSIZE(X)
MarshaledG4HitsCollection(void *buf, char chIsUnmarshaling= 'u')
#define MSH_SET_TYPECHOICE(X)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
MarshaledG4THitsCollection(G4THitsCollection< T > *objptr)
#define MSH_HEADER_SIZE
void EXTEND_BUFFER(int size)