1 | // This file was generated automatically by marshalgen. |
---|
2 | |
---|
3 | #ifndef MarshaledExN02TrackerHit_H |
---|
4 | #define MarshaledExN02TrackerHit_H |
---|
5 | |
---|
6 | |
---|
7 | #include <ExN02TrackerHit.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 MarshaledExN02TrackerHit; |
---|
17 | |
---|
18 | class ShadowedMarshaledExN02TrackerHit : public ExN02TrackerHit{ |
---|
19 | friend class MarshaledExN02TrackerHit; |
---|
20 | }; |
---|
21 | |
---|
22 | class MarshaledExN02TrackerHit : public MarshaledObj { |
---|
23 | public: |
---|
24 | ExN02TrackerHit* param; |
---|
25 | ShadowedMarshaledExN02TrackerHit* Shadowed_param; |
---|
26 | public: |
---|
27 | |
---|
28 | |
---|
29 | // Function implementations |
---|
30 | |
---|
31 | MarshaledExN02TrackerHit(ExN02TrackerHit* objptr) : MarshaledObj() { |
---|
32 | msh_isUnmarshalDone = false; |
---|
33 | this->param = objptr; |
---|
34 | this->Shadowed_param = (ShadowedMarshaledExN02TrackerHit*)this->param; |
---|
35 | if (objptr == NULL) |
---|
36 | return; |
---|
37 | |
---|
38 | marshal1(); |
---|
39 | marshal2(); |
---|
40 | marshal3(); |
---|
41 | marshal4(); |
---|
42 | } |
---|
43 | |
---|
44 | MarshaledExN02TrackerHit(void *buf, char isUnmarshaling = 'u') |
---|
45 | : MarshaledObj(buf, isUnmarshaling) { |
---|
46 | msh_isUnmarshalDone = false; |
---|
47 | } |
---|
48 | |
---|
49 | ~MarshaledExN02TrackerHit() { |
---|
50 | //if(msh_isUnmarshalDone && this->param != NULL) { |
---|
51 | //delete this->param; |
---|
52 | //} |
---|
53 | } |
---|
54 | |
---|
55 | ExN02TrackerHit* 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 ExN02TrackerHit(); |
---|
64 | } |
---|
65 | this->Shadowed_param = (ShadowedMarshaledExN02TrackerHit*)this->param; |
---|
66 | this->msh_isUnmarshalDone = true; |
---|
67 | unmarshal1(); |
---|
68 | unmarshal2(); |
---|
69 | unmarshal3(); |
---|
70 | unmarshal4(); |
---|
71 | return this->param; |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | void unmarshalTo(ExN02TrackerHit* 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 = (ShadowedMarshaledExN02TrackerHit*)this->param; |
---|
84 | this->msh_isUnmarshalDone = true; |
---|
85 | unmarshal1(); |
---|
86 | unmarshal2(); |
---|
87 | unmarshal3(); |
---|
88 | unmarshal4(); |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | void 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(G4ThreeVector); |
---|
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 | G4ThreeVector anElement; |
---|
115 | anElement = param->GetPos(); |
---|
116 | memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector)); |
---|
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 | |
---|
130 | void 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 | G4ThreeVector anElement; |
---|
139 | memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector)); |
---|
140 | param->SetPos(anElement); |
---|
141 | |
---|
142 | } |
---|
143 | msh_cursor += msh_currentSize; |
---|
144 | } |
---|
145 | |
---|
146 | void 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(G4double); |
---|
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 | G4double anElement; |
---|
169 | anElement = param->GetEdep(); |
---|
170 | memcpy(msh_cursor, &anElement, sizeof(G4double)); |
---|
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 | |
---|
184 | void 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 | G4double anElement; |
---|
193 | memcpy(&anElement, msh_cursor, sizeof(G4double)); |
---|
194 | param->SetEdep(anElement); |
---|
195 | |
---|
196 | } |
---|
197 | msh_cursor += msh_currentSize; |
---|
198 | } |
---|
199 | |
---|
200 | void 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(G4int ); |
---|
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 | G4int anElement; |
---|
223 | anElement = param->GetTrackID(); |
---|
224 | memcpy(msh_cursor, &anElement, sizeof(G4int )); |
---|
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 | |
---|
238 | void 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 | G4int anElement; |
---|
247 | memcpy(&anElement, msh_cursor, sizeof(G4int )); |
---|
248 | param->SetTrackID(anElement); |
---|
249 | |
---|
250 | } |
---|
251 | msh_cursor += msh_currentSize; |
---|
252 | } |
---|
253 | |
---|
254 | void 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(G4int ); |
---|
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 | G4int anElement; |
---|
277 | anElement = param->GetChamberNb(); |
---|
278 | memcpy(msh_cursor, &anElement, sizeof(G4int )); |
---|
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 | |
---|
292 | void 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 | G4int anElement; |
---|
301 | memcpy(&anElement, msh_cursor, sizeof(G4int )); |
---|
302 | param->SetChamberNb(anElement); |
---|
303 | |
---|
304 | } |
---|
305 | msh_cursor += msh_currentSize; |
---|
306 | } |
---|
307 | |
---|
308 | }; |
---|
309 | #endif |
---|
310 | |
---|