source: trunk/examples/extended/parallel/ParN04/include/MarshaledExN04CalorimeterHit.h @ 1337

Last change on this file since 1337 was 807, checked in by garnier, 16 years ago

update

File size: 9.2 KB
Line 
1// This file was generated automatically by marshalgen.
2
3#ifndef MarshaledExN04CalorimeterHit_H
4#define MarshaledExN04CalorimeterHit_H
5
6
7#include <ExN04CalorimeterHit.hh>
8//MSH_include_begin
9#include "MarshaledG4String.h"
10//MSH_include_end
11
12#include <stdio.h>
13#include <string.h>
14#include "MarshaledObj.h"
15
16  class MarshaledExN04CalorimeterHit;
17
18  class ShadowedMarshaledExN04CalorimeterHit : public ExN04CalorimeterHit{
19    friend class MarshaledExN04CalorimeterHit;
20};
21
22  class MarshaledExN04CalorimeterHit : public MarshaledObj {
23public:
24    ExN04CalorimeterHit* param;
25    ShadowedMarshaledExN04CalorimeterHit* Shadowed_param;
26public:
27
28
29// Function implementations
30
31MarshaledExN04CalorimeterHit(ExN04CalorimeterHit* objptr) : MarshaledObj() {
32    msh_isUnmarshalDone = false;
33    this->param = objptr;
34    this->Shadowed_param = (ShadowedMarshaledExN04CalorimeterHit*)this->param;
35    if (objptr == NULL)
36        return;
37
38    marshal1();
39    marshal2();
40    marshal3();
41    marshal4();
42}
43
44MarshaledExN04CalorimeterHit(void *buf, char isUnmarshaling = 'u')
45: MarshaledObj(buf, isUnmarshaling) {
46    msh_isUnmarshalDone = false;
47}
48
49~MarshaledExN04CalorimeterHit() {
50    //if(msh_isUnmarshalDone && this->param != NULL) {
51        //delete this->param;
52    //}
53}
54
55ExN04CalorimeterHit* unmarshal() {
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        {
63        param = new ExN04CalorimeterHit();
64        }
65        this->Shadowed_param = (ShadowedMarshaledExN04CalorimeterHit*)this->param;
66        this->msh_isUnmarshalDone = true;
67        unmarshal1();
68        unmarshal2();
69        unmarshal3();
70        unmarshal4();
71        return this->param;
72    }
73}
74
75void unmarshalTo(ExN04CalorimeterHit* obj) {
76    //We don't want to unmarshal the buffer is empty.
77    if(msh_size <= MSH_HEADER_SIZE) {
78        //This is buggy, we can't always assume that
79        //obj == NULL <==> List is empty.
80        return;
81    } else {
82        this->param = obj;
83        this->Shadowed_param = (ShadowedMarshaledExN04CalorimeterHit*)this->param;
84        this->msh_isUnmarshalDone = true;
85        unmarshal1();
86        unmarshal2();
87        unmarshal3();
88        unmarshal4();
89    }
90}
91
92void marshal1() {
93    //declare field_size to be the size of this field
94    int msh_currentSize = 0;
95    if (isUnmarshaling())
96        throw "Tried to marshal in obj marked isUnmarshaling == true";
97
98    //Copy the sizespec into msh_currentSize here:
99    {
100        msh_currentSize = sizeof(G4int);
101
102    }
103
104    //Increase the size of buffer if needed
105    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)
106    //Mark the beginning position for this field, will write the total size of this field here later
107    msh_field_begin = msh_cursor;
108
109    //Advance cursor of distance = sizeof(int)
110    msh_cursor += sizeof(int);
111
112    //Now just copy "get" functions here
113    {
114        G4int anElement;
115         anElement = param->GetZ(); 
116        memcpy(msh_cursor, &anElement, sizeof(G4int));
117    }
118    //Now advance the cursor
119    msh_cursor += msh_currentSize;
120    //Now set the size of this field
121    int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
122    tmp = (msh_cursor-msh_field_begin) - sizeof(int);
123    memcpy(msh_field_begin, &tmp, sizeof(int));
124
125    //Now set msh_size
126    msh_size = msh_cursor - msh_buffer;
127    MSH_SET_TOTALSIZE(msh_size);    MSH_SET_TYPECHOICE(msh_typechoice);
128}
129
130void unmarshal1() {
131    //declare currentSize to be the size of this field
132    int msh_currentSize = 0;
133    //copy the size of the current field into currentSize
134    memcpy(&msh_currentSize, msh_cursor, sizeof(int));
135    msh_cursor += sizeof(int);
136    //Now copy the setspec here
137    {
138        G4int anElement;
139        memcpy(&anElement, msh_cursor, sizeof(G4int));
140         param->SetCellID(anElement, param->GetPhi()); 
141
142    }
143    msh_cursor += msh_currentSize;
144}
145
146void marshal2() {
147    //declare field_size to be the size of this field
148    int msh_currentSize = 0;
149    if (isUnmarshaling())
150        throw "Tried to marshal in obj marked isUnmarshaling == true";
151
152    //Copy the sizespec into msh_currentSize here:
153    {
154        msh_currentSize = sizeof(G4int);
155
156    }
157
158    //Increase the size of buffer if needed
159    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)
160    //Mark the beginning position for this field, will write the total size of this field here later
161    msh_field_begin = msh_cursor;
162
163    //Advance cursor of distance = sizeof(int)
164    msh_cursor += sizeof(int);
165
166    //Now just copy "get" functions here
167    {
168        G4int anElement;
169         anElement = param->GetPhi(); 
170        memcpy(msh_cursor, &anElement, sizeof(G4int));
171    }
172    //Now advance the cursor
173    msh_cursor += msh_currentSize;
174    //Now set the size of this field
175    int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
176    tmp = (msh_cursor-msh_field_begin) - sizeof(int);
177    memcpy(msh_field_begin, &tmp, sizeof(int));
178
179    //Now set msh_size
180    msh_size = msh_cursor - msh_buffer;
181    MSH_SET_TOTALSIZE(msh_size);    MSH_SET_TYPECHOICE(msh_typechoice);
182}
183
184void unmarshal2() {
185    //declare currentSize to be the size of this field
186    int msh_currentSize = 0;
187    //copy the size of the current field into currentSize
188    memcpy(&msh_currentSize, msh_cursor, sizeof(int));
189    msh_cursor += sizeof(int);
190    //Now copy the setspec here
191    {
192        G4int anElement;
193        memcpy(&anElement, msh_cursor, sizeof(G4int));
194         param->SetCellID(param->GetZ(), anElement); 
195
196    }
197    msh_cursor += msh_currentSize;
198}
199
200void marshal3() {
201    //declare field_size to be the size of this field
202    int msh_currentSize = 0;
203    if (isUnmarshaling())
204        throw "Tried to marshal in obj marked isUnmarshaling == true";
205
206    //Copy the sizespec into msh_currentSize here:
207    {
208        msh_currentSize = sizeof(G4double);
209
210    }
211
212    //Increase the size of buffer if needed
213    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)
214    //Mark the beginning position for this field, will write the total size of this field here later
215    msh_field_begin = msh_cursor;
216
217    //Advance cursor of distance = sizeof(int)
218    msh_cursor += sizeof(int);
219
220    //Now just copy "get" functions here
221    {
222        G4double anElement;
223         anElement = param->GetEdep(); 
224        memcpy(msh_cursor, &anElement, sizeof(G4double));
225    }
226    //Now advance the cursor
227    msh_cursor += msh_currentSize;
228    //Now set the size of this field
229    int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
230    tmp = (msh_cursor-msh_field_begin) - sizeof(int);
231    memcpy(msh_field_begin, &tmp, sizeof(int));
232
233    //Now set msh_size
234    msh_size = msh_cursor - msh_buffer;
235    MSH_SET_TOTALSIZE(msh_size);    MSH_SET_TYPECHOICE(msh_typechoice);
236}
237
238void unmarshal3() {
239    //declare currentSize to be the size of this field
240    int msh_currentSize = 0;
241    //copy the size of the current field into currentSize
242    memcpy(&msh_currentSize, msh_cursor, sizeof(int));
243    msh_cursor += sizeof(int);
244    //Now copy the setspec here
245    {
246        G4double anElement;
247        memcpy(&anElement, msh_cursor, sizeof(G4double));
248         param->SetEdep(anElement); 
249
250    }
251    msh_cursor += msh_currentSize;
252}
253
254void marshal4() {
255    //declare field_size to be the size of this field
256    int msh_currentSize = 0;
257    if (isUnmarshaling())
258        throw "Tried to marshal in obj marked isUnmarshaling == true";
259
260    //Copy the sizespec into msh_currentSize here:
261    {
262        msh_currentSize = sizeof(G4ThreeVector);
263
264    }
265
266    //Increase the size of buffer if needed
267    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)
268    //Mark the beginning position for this field, will write the total size of this field here later
269    msh_field_begin = msh_cursor;
270
271    //Advance cursor of distance = sizeof(int)
272    msh_cursor += sizeof(int);
273
274    //Now just copy "get" functions here
275    {
276        G4ThreeVector anElement;
277         anElement = param->GetPos(); 
278        memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector));
279    }
280    //Now advance the cursor
281    msh_cursor += msh_currentSize;
282    //Now set the size of this field
283    int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
284    tmp = (msh_cursor-msh_field_begin) - sizeof(int);
285    memcpy(msh_field_begin, &tmp, sizeof(int));
286
287    //Now set msh_size
288    msh_size = msh_cursor - msh_buffer;
289    MSH_SET_TOTALSIZE(msh_size);    MSH_SET_TYPECHOICE(msh_typechoice);
290}
291
292void unmarshal4() {
293    //declare currentSize to be the size of this field
294    int msh_currentSize = 0;
295    //copy the size of the current field into currentSize
296    memcpy(&msh_currentSize, msh_cursor, sizeof(int));
297    msh_cursor += sizeof(int);
298    //Now copy the setspec here
299    {
300        G4ThreeVector anElement;
301        memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector));
302         param->SetPos(anElement); 
303
304    }
305    msh_cursor += msh_currentSize;
306}
307
308};
309#endif
310
Note: See TracBrowser for help on using the repository browser.