| 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"
|
|---|
| 12 | #include "MarshaledExN04CalorimeterHit.h"
|
|---|
| 13 | #include "MarshaledExN04MuonHit.h"
|
|---|
| 14 | #include "MarshaledExN04TrackerHit.h"
|
|---|
| 15 | //MSH_include_end
|
|---|
| 16 |
|
|---|
| 17 | #include <stdio.h>
|
|---|
| 18 | #include <string.h>
|
|---|
| 19 | #include "MarshaledObj.h"
|
|---|
| 20 |
|
|---|
| 21 | class MarshaledG4HitsCollection;
|
|---|
| 22 |
|
|---|
| 23 | class ShadowedMarshaledG4HitsCollection : public G4HitsCollection{
|
|---|
| 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 |
|
|---|
| 34 | class MarshaledG4HitsCollection : public MarshaledObj {
|
|---|
| 35 | public:
|
|---|
| 36 | G4HitsCollection* param;
|
|---|
| 37 | ShadowedMarshaledG4HitsCollection* Shadowed_param;
|
|---|
| 38 | public:
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | // Function implementations
|
|---|
| 42 |
|
|---|
| 43 | MarshaledG4HitsCollection(G4HitsCollection* objptr) : MarshaledObj() {
|
|---|
| 44 | msh_isUnmarshalDone = false;
|
|---|
| 45 | this->param = objptr;
|
|---|
| 46 | this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
|
|---|
| 47 | if (objptr == NULL)
|
|---|
| 48 | return;
|
|---|
| 49 |
|
|---|
| 50 | marshal1();
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | MarshaledG4HitsCollection(void *buf, char isUnmarshaling = 'u')
|
|---|
| 54 | : MarshaledObj(buf, isUnmarshaling) {
|
|---|
| 55 | msh_isUnmarshalDone = false;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | ~MarshaledG4HitsCollection() {
|
|---|
| 59 | //if(msh_isUnmarshalDone && this->param != NULL) {
|
|---|
| 60 | //delete this->param;
|
|---|
| 61 | //}
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | G4HitsCollection* unmarshal() {
|
|---|
| 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 | }
|
|---|
| 74 | this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
|
|---|
| 75 | this->msh_isUnmarshalDone = true;
|
|---|
| 76 | unmarshal1();
|
|---|
| 77 | return this->param;
|
|---|
| 78 | }
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | void unmarshalTo(G4HitsCollection* obj) {
|
|---|
| 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;
|
|---|
| 89 | this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
|
|---|
| 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)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
|
|---|
| 108 | //Mark the beginning position for this field, will write the total size of this field here later
|
|---|
| 109 | msh_field_begin = msh_cursor;
|
|---|
| 110 |
|
|---|
| 111 | //Advance cursor of distance = sizeof(int)
|
|---|
| 112 | msh_cursor += sizeof(int);
|
|---|
| 113 |
|
|---|
| 114 | //Now just copy "get" functions here
|
|---|
| 115 | {
|
|---|
| 116 | int copy_off = 0;
|
|---|
| 117 | int elementNum;
|
|---|
| 118 |
|
|---|
| 119 | if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
|---|
| 120 | elementNum = ((G4THitsCollection<ExN04CalorimeterHit>*)param)->entries();
|
|---|
| 121 | else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
|---|
| 122 | elementNum = ((G4THitsCollection<ExN04MuonHit>*)param)->entries();
|
|---|
| 123 | else
|
|---|
| 124 | elementNum = ((G4THitsCollection<ExN04TrackerHit>*)param)->entries();
|
|---|
| 125 |
|
|---|
| 126 | memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
|
|---|
| 127 | copy_off += sizeof(int);
|
|---|
| 128 | for(int index=0;index<elementNum;index++){
|
|---|
| 129 | if(0){}
|
|---|
| 130 | else if((dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL) ){
|
|---|
| 131 | void* anElement;
|
|---|
| 132 |
|
|---|
| 133 | if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
|---|
| 134 | anElement = (*((G4THitsCollection<ExN04CalorimeterHit>*)param))[index];
|
|---|
| 135 | else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
|---|
| 136 | anElement = (*((G4THitsCollection<ExN04MuonHit>*)param))[index];
|
|---|
| 137 | else
|
|---|
| 138 | anElement = (*((G4THitsCollection<ExN04TrackerHit>*)param))[index];
|
|---|
| 139 |
|
|---|
| 140 | MarshaledExN04CalorimeterHit marEle((ExN04CalorimeterHit* )anElement);
|
|---|
| 141 | EXTEND_BUFFER(marEle.getBufferSize());
|
|---|
| 142 | memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
|
|---|
| 143 | copy_off += marEle.getBufferSize();
|
|---|
| 144 | }
|
|---|
| 145 | else if( (dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL) ){
|
|---|
| 146 | void* anElement;
|
|---|
| 147 |
|
|---|
| 148 | if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
|---|
| 149 | anElement = (*((G4THitsCollection<ExN04CalorimeterHit>*)param))[index];
|
|---|
| 150 | else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
|---|
| 151 | anElement = (*((G4THitsCollection<ExN04MuonHit>*)param))[index];
|
|---|
| 152 | else
|
|---|
| 153 | anElement = (*((G4THitsCollection<ExN04TrackerHit>*)param))[index];
|
|---|
| 154 |
|
|---|
| 155 | MarshaledExN04MuonHit marEle((ExN04MuonHit* )anElement);
|
|---|
| 156 | EXTEND_BUFFER(marEle.getBufferSize());
|
|---|
| 157 | memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
|
|---|
| 158 | copy_off += marEle.getBufferSize();
|
|---|
| 159 | }
|
|---|
| 160 | else if( true ){
|
|---|
| 161 | void* anElement;
|
|---|
| 162 |
|
|---|
| 163 | if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
|---|
| 164 | anElement = (*((G4THitsCollection<ExN04CalorimeterHit>*)param))[index];
|
|---|
| 165 | else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
|---|
| 166 | anElement = (*((G4THitsCollection<ExN04MuonHit>*)param))[index];
|
|---|
| 167 | else
|
|---|
| 168 | anElement = (*((G4THitsCollection<ExN04TrackerHit>*)param))[index];
|
|---|
| 169 |
|
|---|
| 170 | MarshaledExN04TrackerHit marEle((ExN04TrackerHit*)anElement);
|
|---|
| 171 | EXTEND_BUFFER(marEle.getBufferSize());
|
|---|
| 172 | memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
|
|---|
| 173 | copy_off += marEle.getBufferSize();
|
|---|
| 174 | }
|
|---|
| 175 | }
|
|---|
| 176 | msh_currentSize = copy_off;
|
|---|
| 177 |
|
|---|
| 178 | }
|
|---|
| 179 | //Now advance the cursor
|
|---|
| 180 | msh_cursor += msh_currentSize;
|
|---|
| 181 | //Now set the size of this field
|
|---|
| 182 | int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
|---|
| 183 | tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
|---|
| 184 | memcpy(msh_field_begin, &tmp, sizeof(int));
|
|---|
| 185 |
|
|---|
| 186 | //Now set msh_size
|
|---|
| 187 | msh_size = msh_cursor - msh_buffer;
|
|---|
| 188 | MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|
| 191 | void unmarshal1() {
|
|---|
| 192 | //declare currentSize to be the size of this field
|
|---|
| 193 | int msh_currentSize = 0;
|
|---|
| 194 | //copy the size of the current field into currentSize
|
|---|
| 195 | memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
|---|
| 196 | msh_cursor += sizeof(int);
|
|---|
| 197 | //Now copy the setspec here
|
|---|
| 198 | {
|
|---|
| 199 | if(0){}
|
|---|
| 200 | else if((dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL) ){
|
|---|
| 201 | int copy_off = 0;
|
|---|
| 202 | int elementNum;
|
|---|
| 203 | memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
|
|---|
| 204 | copy_off += sizeof(int);
|
|---|
| 205 | for(int index=0;index<elementNum;index++){
|
|---|
| 206 | MarshaledExN04CalorimeterHit marEle(msh_cursor+copy_off);
|
|---|
| 207 | ExN04CalorimeterHit* anElement = (ExN04CalorimeterHit* )marEle.unmarshal();
|
|---|
| 208 | copy_off += marEle.getBufferSize();
|
|---|
| 209 |
|
|---|
| 210 | if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
|---|
| 211 | ((G4THitsCollection<ExN04CalorimeterHit>*)param)->insert((ExN04CalorimeterHit*)anElement);
|
|---|
| 212 | else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
|---|
| 213 | ((G4THitsCollection<ExN04MuonHit>*)param)->insert((ExN04MuonHit*)anElement);
|
|---|
| 214 | else
|
|---|
| 215 | ((G4THitsCollection<ExN04TrackerHit>*)param)->insert((ExN04TrackerHit*)anElement);
|
|---|
| 216 |
|
|---|
| 217 | }
|
|---|
| 218 | }
|
|---|
| 219 | else if( (dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL) ){
|
|---|
| 220 | int copy_off = 0;
|
|---|
| 221 | int elementNum;
|
|---|
| 222 | memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
|
|---|
| 223 | copy_off += sizeof(int);
|
|---|
| 224 | for(int index=0;index<elementNum;index++){
|
|---|
| 225 | MarshaledExN04MuonHit marEle(msh_cursor+copy_off);
|
|---|
| 226 | ExN04MuonHit* anElement = (ExN04MuonHit* )marEle.unmarshal();
|
|---|
| 227 | copy_off += marEle.getBufferSize();
|
|---|
| 228 |
|
|---|
| 229 | if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
|---|
| 230 | ((G4THitsCollection<ExN04CalorimeterHit>*)param)->insert((ExN04CalorimeterHit*)anElement);
|
|---|
| 231 | else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
|---|
| 232 | ((G4THitsCollection<ExN04MuonHit>*)param)->insert((ExN04MuonHit*)anElement);
|
|---|
| 233 | else
|
|---|
| 234 | ((G4THitsCollection<ExN04TrackerHit>*)param)->insert((ExN04TrackerHit*)anElement);
|
|---|
| 235 |
|
|---|
| 236 | }
|
|---|
| 237 | }
|
|---|
| 238 | else if( true ){
|
|---|
| 239 | int copy_off = 0;
|
|---|
| 240 | int elementNum;
|
|---|
| 241 | memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
|
|---|
| 242 | copy_off += sizeof(int);
|
|---|
| 243 | for(int index=0;index<elementNum;index++){
|
|---|
| 244 | MarshaledExN04TrackerHit marEle(msh_cursor+copy_off);
|
|---|
| 245 | ExN04TrackerHit* anElement = (ExN04TrackerHit*)marEle.unmarshal();
|
|---|
| 246 | copy_off += marEle.getBufferSize();
|
|---|
| 247 |
|
|---|
| 248 | if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
|---|
| 249 | ((G4THitsCollection<ExN04CalorimeterHit>*)param)->insert((ExN04CalorimeterHit*)anElement);
|
|---|
| 250 | else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
|---|
| 251 | ((G4THitsCollection<ExN04MuonHit>*)param)->insert((ExN04MuonHit*)anElement);
|
|---|
| 252 | else
|
|---|
| 253 | ((G4THitsCollection<ExN04TrackerHit>*)param)->insert((ExN04TrackerHit*)anElement);
|
|---|
| 254 |
|
|---|
| 255 | }
|
|---|
| 256 | }
|
|---|
| 257 |
|
|---|
| 258 | }
|
|---|
| 259 | msh_cursor += msh_currentSize;
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| 262 | };
|
|---|
| 263 | template <class T> class MarshaledG4THitsCollection : public MarshaledObj {
|
|---|
| 264 | public:
|
|---|
| 265 | G4THitsCollection<T>* param;
|
|---|
| 266 | ShadowedMarshaledG4THitsCollection<T>* Shadowed_param;
|
|---|
| 267 | public:
|
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 | // Function implementations
|
|---|
| 271 |
|
|---|
| 272 | MarshaledG4THitsCollection(G4THitsCollection<T>* objptr) : MarshaledObj() {
|
|---|
| 273 | msh_isUnmarshalDone = false;
|
|---|
| 274 | this->param = objptr;
|
|---|
| 275 | this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
|
|---|
| 276 | if (objptr == NULL)
|
|---|
| 277 | return;
|
|---|
| 278 |
|
|---|
| 279 | marshal1();
|
|---|
| 280 | }
|
|---|
| 281 |
|
|---|
| 282 | MarshaledG4THitsCollection(void *buf, char isUnmarshaling = 'u')
|
|---|
| 283 | : MarshaledObj(buf, isUnmarshaling) {
|
|---|
| 284 | msh_isUnmarshalDone = false;
|
|---|
| 285 | }
|
|---|
| 286 |
|
|---|
| 287 | ~MarshaledG4THitsCollection() {
|
|---|
| 288 | //if(msh_isUnmarshalDone && this->param != NULL) {
|
|---|
| 289 | //delete this->param;
|
|---|
| 290 | //}
|
|---|
| 291 | }
|
|---|
| 292 |
|
|---|
| 293 | G4THitsCollection<T>* unmarshal() {
|
|---|
| 294 | //We don't want to unmarshal the buffer is empty.
|
|---|
| 295 | if(msh_size <= MSH_HEADER_SIZE) {
|
|---|
| 296 | //This is buggy, we can't always assume that
|
|---|
| 297 | //obj == NULL <==> List is empty.
|
|---|
| 298 | return NULL;
|
|---|
| 299 | } else {
|
|---|
| 300 | {
|
|---|
| 301 | param = new G4THitsCollection<T>();
|
|---|
| 302 | }
|
|---|
| 303 | this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
|
|---|
| 304 | this->msh_isUnmarshalDone = true;
|
|---|
| 305 | unmarshal1();
|
|---|
| 306 | return this->param;
|
|---|
| 307 | }
|
|---|
| 308 | }
|
|---|
| 309 |
|
|---|
| 310 | void unmarshalTo(G4THitsCollection<T>* obj) {
|
|---|
| 311 | //We don't want to unmarshal the buffer is empty.
|
|---|
| 312 | if(msh_size <= MSH_HEADER_SIZE) {
|
|---|
| 313 | //This is buggy, we can't always assume that
|
|---|
| 314 | //obj == NULL <==> List is empty.
|
|---|
| 315 | return;
|
|---|
| 316 | } else {
|
|---|
| 317 | this->param = obj;
|
|---|
| 318 | this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
|
|---|
| 319 | this->msh_isUnmarshalDone = true;
|
|---|
| 320 | unmarshal1();
|
|---|
| 321 | }
|
|---|
| 322 | }
|
|---|
| 323 |
|
|---|
| 324 | void marshal1() {
|
|---|
| 325 | //declare field_size to be the size of this field
|
|---|
| 326 | int msh_currentSize = 0;
|
|---|
| 327 | if (isUnmarshaling())
|
|---|
| 328 | throw "Tried to marshal in obj marked isUnmarshaling == true";
|
|---|
| 329 |
|
|---|
| 330 | //Copy the sizespec into msh_currentSize here:
|
|---|
| 331 | {
|
|---|
| 332 | //code for size, just dummy code because the size will be set correctly at the end of marshaling code
|
|---|
| 333 |
|
|---|
| 334 | }
|
|---|
| 335 |
|
|---|
| 336 | //Increase the size of buffer if needed
|
|---|
| 337 | 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)
|
|---|
| 338 | //Mark the beginning position for this field, will write the total size of this field here later
|
|---|
| 339 | msh_field_begin = msh_cursor;
|
|---|
| 340 |
|
|---|
| 341 | //Advance cursor of distance = sizeof(int)
|
|---|
| 342 | msh_cursor += sizeof(int);
|
|---|
| 343 |
|
|---|
| 344 | //Now just copy "get" functions here
|
|---|
| 345 | {
|
|---|
| 346 | MarshaledG4HitsCollection marParent(param);
|
|---|
| 347 | EXTEND_BUFFER(marParent.getBufferSize());
|
|---|
| 348 | memcpy(msh_cursor,marParent.getBuffer(), marParent.getBufferSize());
|
|---|
| 349 | msh_currentSize = marParent.getBufferSize();
|
|---|
| 350 |
|
|---|
| 351 | }
|
|---|
| 352 | //Now advance the cursor
|
|---|
| 353 | msh_cursor += msh_currentSize;
|
|---|
| 354 | //Now set the size of this field
|
|---|
| 355 | int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
|---|
| 356 | tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
|---|
| 357 | memcpy(msh_field_begin, &tmp, sizeof(int));
|
|---|
| 358 |
|
|---|
| 359 | //Now set msh_size
|
|---|
| 360 | msh_size = msh_cursor - msh_buffer;
|
|---|
| 361 | MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
|---|
| 362 | }
|
|---|
| 363 |
|
|---|
| 364 | void unmarshal1() {
|
|---|
| 365 | //declare currentSize to be the size of this field
|
|---|
| 366 | int msh_currentSize = 0;
|
|---|
| 367 | //copy the size of the current field into currentSize
|
|---|
| 368 | memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
|---|
| 369 | msh_cursor += sizeof(int);
|
|---|
| 370 | //Now copy the setspec here
|
|---|
| 371 | {
|
|---|
| 372 | MarshaledG4HitsCollection marObj(msh_cursor);
|
|---|
| 373 | marObj.unmarshalTo(param);
|
|---|
| 374 |
|
|---|
| 375 | }
|
|---|
| 376 | msh_cursor += msh_currentSize;
|
|---|
| 377 | }
|
|---|
| 378 |
|
|---|
| 379 | };
|
|---|
| 380 | #endif
|
|---|
| 381 |
|
|---|