1 | // This file was generated automatically by marshalgen. |
---|
2 | |
---|
3 | #ifndef MarshaledExN04MuonHit_H |
---|
4 | #define MarshaledExN04MuonHit_H |
---|
5 | |
---|
6 | |
---|
7 | #include <ExN04MuonHit.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 MarshaledExN04MuonHit; |
---|
17 | |
---|
18 | class ShadowedMarshaledExN04MuonHit : public ExN04MuonHit{ |
---|
19 | friend class MarshaledExN04MuonHit; |
---|
20 | }; |
---|
21 | |
---|
22 | class MarshaledExN04MuonHit : public MarshaledObj { |
---|
23 | public: |
---|
24 | ExN04MuonHit* param; |
---|
25 | ShadowedMarshaledExN04MuonHit* Shadowed_param; |
---|
26 | public: |
---|
27 | |
---|
28 | |
---|
29 | // Function implementations |
---|
30 | |
---|
31 | MarshaledExN04MuonHit(ExN04MuonHit* objptr) : MarshaledObj() { |
---|
32 | msh_isUnmarshalDone = false; |
---|
33 | this->param = objptr; |
---|
34 | this->Shadowed_param = (ShadowedMarshaledExN04MuonHit*)this->param; |
---|
35 | if (objptr == NULL) |
---|
36 | return; |
---|
37 | |
---|
38 | marshal1(); |
---|
39 | marshal2(); |
---|
40 | } |
---|
41 | |
---|
42 | MarshaledExN04MuonHit(void *buf, char isUnmarshaling = 'u') |
---|
43 | : MarshaledObj(buf, isUnmarshaling) { |
---|
44 | msh_isUnmarshalDone = false; |
---|
45 | } |
---|
46 | |
---|
47 | ~MarshaledExN04MuonHit() { |
---|
48 | //if(msh_isUnmarshalDone && this->param != NULL) { |
---|
49 | //delete this->param; |
---|
50 | //} |
---|
51 | } |
---|
52 | |
---|
53 | ExN04MuonHit* unmarshal() { |
---|
54 | //We don't want to unmarshal the buffer is empty. |
---|
55 | if(msh_size <= MSH_HEADER_SIZE) { |
---|
56 | //This is buggy, we can't always assume that |
---|
57 | //obj == NULL <==> List is empty. |
---|
58 | return NULL; |
---|
59 | } else { |
---|
60 | { |
---|
61 | param = new ExN04MuonHit(); |
---|
62 | } |
---|
63 | this->Shadowed_param = (ShadowedMarshaledExN04MuonHit*)this->param; |
---|
64 | this->msh_isUnmarshalDone = true; |
---|
65 | unmarshal1(); |
---|
66 | unmarshal2(); |
---|
67 | return this->param; |
---|
68 | } |
---|
69 | } |
---|
70 | |
---|
71 | void unmarshalTo(ExN04MuonHit* obj) { |
---|
72 | //We don't want to unmarshal the buffer is empty. |
---|
73 | if(msh_size <= MSH_HEADER_SIZE) { |
---|
74 | //This is buggy, we can't always assume that |
---|
75 | //obj == NULL <==> List is empty. |
---|
76 | return; |
---|
77 | } else { |
---|
78 | this->param = obj; |
---|
79 | this->Shadowed_param = (ShadowedMarshaledExN04MuonHit*)this->param; |
---|
80 | this->msh_isUnmarshalDone = true; |
---|
81 | unmarshal1(); |
---|
82 | unmarshal2(); |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | void marshal1() { |
---|
87 | //declare field_size to be the size of this field |
---|
88 | int msh_currentSize = 0; |
---|
89 | if (isUnmarshaling()) |
---|
90 | throw "Tried to marshal in obj marked isUnmarshaling == true"; |
---|
91 | |
---|
92 | //Copy the sizespec into msh_currentSize here: |
---|
93 | { |
---|
94 | msh_currentSize = sizeof(G4double); |
---|
95 | |
---|
96 | } |
---|
97 | |
---|
98 | //Increase the size of buffer if needed |
---|
99 | 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) |
---|
100 | //Mark the beginning position for this field, will write the total size of this field here later |
---|
101 | msh_field_begin = msh_cursor; |
---|
102 | |
---|
103 | //Advance cursor of distance = sizeof(int) |
---|
104 | msh_cursor += sizeof(int); |
---|
105 | |
---|
106 | //Now just copy "get" functions here |
---|
107 | { |
---|
108 | G4double anElement; |
---|
109 | anElement = param->GetEdep(); |
---|
110 | memcpy(msh_cursor, &anElement, sizeof(G4double)); |
---|
111 | } |
---|
112 | //Now advance the cursor |
---|
113 | msh_cursor += msh_currentSize; |
---|
114 | //Now set the size of this field |
---|
115 | int tmp; //use memcpy instead of *(int*)... =... to prevent bus error |
---|
116 | tmp = (msh_cursor-msh_field_begin) - sizeof(int); |
---|
117 | memcpy(msh_field_begin, &tmp, sizeof(int)); |
---|
118 | |
---|
119 | //Now set msh_size |
---|
120 | msh_size = msh_cursor - msh_buffer; |
---|
121 | MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice); |
---|
122 | } |
---|
123 | |
---|
124 | void unmarshal1() { |
---|
125 | //declare currentSize to be the size of this field |
---|
126 | int msh_currentSize = 0; |
---|
127 | //copy the size of the current field into currentSize |
---|
128 | memcpy(&msh_currentSize, msh_cursor, sizeof(int)); |
---|
129 | msh_cursor += sizeof(int); |
---|
130 | //Now copy the setspec here |
---|
131 | { |
---|
132 | G4double anElement; |
---|
133 | memcpy(&anElement, msh_cursor, sizeof(G4double)); |
---|
134 | param->SetEdep(anElement); |
---|
135 | |
---|
136 | } |
---|
137 | msh_cursor += msh_currentSize; |
---|
138 | } |
---|
139 | |
---|
140 | void marshal2() { |
---|
141 | //declare field_size to be the size of this field |
---|
142 | int msh_currentSize = 0; |
---|
143 | if (isUnmarshaling()) |
---|
144 | throw "Tried to marshal in obj marked isUnmarshaling == true"; |
---|
145 | |
---|
146 | //Copy the sizespec into msh_currentSize here: |
---|
147 | { |
---|
148 | msh_currentSize = sizeof(G4ThreeVector); |
---|
149 | |
---|
150 | } |
---|
151 | |
---|
152 | //Increase the size of buffer if needed |
---|
153 | 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) |
---|
154 | //Mark the beginning position for this field, will write the total size of this field here later |
---|
155 | msh_field_begin = msh_cursor; |
---|
156 | |
---|
157 | //Advance cursor of distance = sizeof(int) |
---|
158 | msh_cursor += sizeof(int); |
---|
159 | |
---|
160 | //Now just copy "get" functions here |
---|
161 | { |
---|
162 | G4ThreeVector anElement; |
---|
163 | anElement = param->GetPos(); |
---|
164 | memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector)); |
---|
165 | } |
---|
166 | //Now advance the cursor |
---|
167 | msh_cursor += msh_currentSize; |
---|
168 | //Now set the size of this field |
---|
169 | int tmp; //use memcpy instead of *(int*)... =... to prevent bus error |
---|
170 | tmp = (msh_cursor-msh_field_begin) - sizeof(int); |
---|
171 | memcpy(msh_field_begin, &tmp, sizeof(int)); |
---|
172 | |
---|
173 | //Now set msh_size |
---|
174 | msh_size = msh_cursor - msh_buffer; |
---|
175 | MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice); |
---|
176 | } |
---|
177 | |
---|
178 | void unmarshal2() { |
---|
179 | //declare currentSize to be the size of this field |
---|
180 | int msh_currentSize = 0; |
---|
181 | //copy the size of the current field into currentSize |
---|
182 | memcpy(&msh_currentSize, msh_cursor, sizeof(int)); |
---|
183 | msh_cursor += sizeof(int); |
---|
184 | //Now copy the setspec here |
---|
185 | { |
---|
186 | G4ThreeVector anElement; |
---|
187 | memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector)); |
---|
188 | param->SetPos(anElement); |
---|
189 | |
---|
190 | } |
---|
191 | msh_cursor += msh_currentSize; |
---|
192 | } |
---|
193 | |
---|
194 | }; |
---|
195 | #endif |
---|
196 | |
---|