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