| [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 | param = new G4THitsCollection<ExN02TrackerHit>("","");
|
|---|
| 61 | }
|
|---|
| 62 | this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
|
|---|
| 63 | this->msh_isUnmarshalDone = true;
|
|---|
| 64 | unmarshal1();
|
|---|
| 65 | unmarshal2();
|
|---|
| 66 | unmarshal3();
|
|---|
| 67 | return this->param;
|
|---|
| 68 | }
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | void unmarshalTo(G4VHitsCollection* 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 = (ShadowedMarshaledG4VHitsCollection*)this->param;
|
|---|
| 80 | this->msh_isUnmarshalDone = true;
|
|---|
| 81 | unmarshal1();
|
|---|
| 82 | unmarshal2();
|
|---|
| 83 | unmarshal3();
|
|---|
| 84 | }
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | void marshal1() {
|
|---|
| 88 | //declare field_size to be the size of this field
|
|---|
| 89 | int msh_currentSize = 0;
|
|---|
| 90 | if (isUnmarshaling())
|
|---|
| 91 | throw "Tried to marshal in obj marked isUnmarshaling == true";
|
|---|
| 92 |
|
|---|
| 93 | //Copy the sizespec into msh_currentSize here:
|
|---|
| 94 | {
|
|---|
| 95 | // no need to declare size since msh_currentSize is already assigned in the MARSHAL field
|
|---|
| 96 |
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | //Increase the size of buffer if needed
|
|---|
| 100 | 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)
|
|---|
| 101 | //Mark the beginning position for this field, will write the total size of this field here later
|
|---|
| 102 | msh_field_begin = msh_cursor;
|
|---|
| 103 |
|
|---|
| 104 | //Advance cursor of distance = sizeof(int)
|
|---|
| 105 | msh_cursor += sizeof(int);
|
|---|
| 106 |
|
|---|
| 107 | //Now just copy "get" functions here
|
|---|
| 108 | {
|
|---|
| 109 | G4String anElement;
|
|---|
| 110 | anElement = param->GetName();
|
|---|
| 111 | MarshaledG4String var(&anElement);
|
|---|
| 112 | EXTEND_BUFFER(var.getBufferSize());
|
|---|
| 113 | msh_currentSize = var.getBufferSize();
|
|---|
| 114 | memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
|
|---|
| 115 | }
|
|---|
| 116 | //Now advance the cursor
|
|---|
| 117 | msh_cursor += msh_currentSize;
|
|---|
| 118 | //Now set the size of this field
|
|---|
| 119 | int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
|---|
| 120 | tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
|---|
| 121 | memcpy(msh_field_begin, &tmp, sizeof(int));
|
|---|
| 122 |
|
|---|
| 123 | //Now set msh_size
|
|---|
| 124 | msh_size = msh_cursor - msh_buffer;
|
|---|
| 125 | MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 128 | void unmarshal1() {
|
|---|
| 129 | //declare currentSize to be the size of this field
|
|---|
| 130 | int msh_currentSize = 0;
|
|---|
| 131 | //copy the size of the current field into currentSize
|
|---|
| 132 | memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
|---|
| 133 | msh_cursor += sizeof(int);
|
|---|
| 134 | //Now copy the setspec here
|
|---|
| 135 | {
|
|---|
| 136 | MarshaledG4String var(msh_cursor, 'u');
|
|---|
| 137 | G4String anElement;
|
|---|
| 138 | var.unmarshalTo(&anElement);
|
|---|
| 139 | Shadowed_param->collectionName=anElement;
|
|---|
| 140 |
|
|---|
| 141 | }
|
|---|
| 142 | msh_cursor += msh_currentSize;
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | void marshal2() {
|
|---|
| 146 | //declare field_size to be the size of this field
|
|---|
| 147 | int msh_currentSize = 0;
|
|---|
| 148 | if (isUnmarshaling())
|
|---|
| 149 | throw "Tried to marshal in obj marked isUnmarshaling == true";
|
|---|
| 150 |
|
|---|
| 151 | //Copy the sizespec into msh_currentSize here:
|
|---|
| 152 | {
|
|---|
| 153 | // no need to declare size since msh_currentSize is already assigned in the MARSHAL field
|
|---|
| 154 |
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | //Increase the size of buffer if needed
|
|---|
| 158 | 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)
|
|---|
| 159 | //Mark the beginning position for this field, will write the total size of this field here later
|
|---|
| 160 | msh_field_begin = msh_cursor;
|
|---|
| 161 |
|
|---|
| 162 | //Advance cursor of distance = sizeof(int)
|
|---|
| 163 | msh_cursor += sizeof(int);
|
|---|
| 164 |
|
|---|
| 165 | //Now just copy "get" functions here
|
|---|
| 166 | {
|
|---|
| 167 | G4String anElement;
|
|---|
| 168 | anElement = param->GetSDname();
|
|---|
| 169 | MarshaledG4String var(&anElement);
|
|---|
| 170 | EXTEND_BUFFER(var.getBufferSize());
|
|---|
| 171 | msh_currentSize = var.getBufferSize();
|
|---|
| 172 | memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
|
|---|
| 173 | }
|
|---|
| 174 | //Now advance the cursor
|
|---|
| 175 | msh_cursor += msh_currentSize;
|
|---|
| 176 | //Now set the size of this field
|
|---|
| 177 | int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
|---|
| 178 | tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
|---|
| 179 | memcpy(msh_field_begin, &tmp, sizeof(int));
|
|---|
| 180 |
|
|---|
| 181 | //Now set msh_size
|
|---|
| 182 | msh_size = msh_cursor - msh_buffer;
|
|---|
| 183 | MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| 186 | void unmarshal2() {
|
|---|
| 187 | //declare currentSize to be the size of this field
|
|---|
| 188 | int msh_currentSize = 0;
|
|---|
| 189 | //copy the size of the current field into currentSize
|
|---|
| 190 | memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
|---|
| 191 | msh_cursor += sizeof(int);
|
|---|
| 192 | //Now copy the setspec here
|
|---|
| 193 | {
|
|---|
| 194 | MarshaledG4String var(msh_cursor, 'u');
|
|---|
| 195 | G4String anElement;
|
|---|
| 196 | var.unmarshalTo(&anElement);
|
|---|
| 197 | Shadowed_param->SDname=anElement;
|
|---|
| 198 |
|
|---|
| 199 | }
|
|---|
| 200 | msh_cursor += msh_currentSize;
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 | void marshal3() {
|
|---|
| 204 | //declare field_size to be the size of this field
|
|---|
| 205 | int msh_currentSize = 0;
|
|---|
| 206 | if (isUnmarshaling())
|
|---|
| 207 | throw "Tried to marshal in obj marked isUnmarshaling == true";
|
|---|
| 208 |
|
|---|
| 209 | //Copy the sizespec into msh_currentSize here:
|
|---|
| 210 | {
|
|---|
| 211 | //code for size, just dummy code because the size will be set correctly at the end of marshaling code
|
|---|
| 212 |
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | //Increase the size of buffer if needed
|
|---|
| 216 | 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)
|
|---|
| 217 | //Mark the beginning position for this field, will write the total size of this field here later
|
|---|
| 218 | msh_field_begin = msh_cursor;
|
|---|
| 219 |
|
|---|
| 220 | //Advance cursor of distance = sizeof(int)
|
|---|
| 221 | msh_cursor += sizeof(int);
|
|---|
| 222 |
|
|---|
| 223 | //Now just copy "get" functions here
|
|---|
| 224 | {
|
|---|
| 225 | G4THitsCollection<ExN02TrackerHit> *aObj293 = (G4THitsCollection<ExN02TrackerHit>*)param;
|
|---|
| 226 | MarshaledG4THitsCollection<ExN02TrackerHit> marChild(aObj293);
|
|---|
| 227 | EXTEND_BUFFER(marChild.getBufferSize());
|
|---|
| 228 | memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
|
|---|
| 229 | msh_currentSize = marChild.getBufferSize();
|
|---|
| 230 | msh_typechoice = 0;
|
|---|
| 231 |
|
|---|
| 232 | }
|
|---|
| 233 | //Now advance the cursor
|
|---|
| 234 | msh_cursor += msh_currentSize;
|
|---|
| 235 | //Now set the size of this field
|
|---|
| 236 | int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
|---|
| 237 | tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
|---|
| 238 | memcpy(msh_field_begin, &tmp, sizeof(int));
|
|---|
| 239 |
|
|---|
| 240 | //Now set msh_size
|
|---|
| 241 | msh_size = msh_cursor - msh_buffer;
|
|---|
| 242 | MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
|---|
| 243 | }
|
|---|
| 244 |
|
|---|
| 245 | void unmarshal3() {
|
|---|
| 246 | //declare currentSize to be the size of this field
|
|---|
| 247 | int msh_currentSize = 0;
|
|---|
| 248 | //copy the size of the current field into currentSize
|
|---|
| 249 | memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
|---|
| 250 | msh_cursor += sizeof(int);
|
|---|
| 251 | //Now copy the setspec here
|
|---|
| 252 | {
|
|---|
| 253 | MarshaledG4THitsCollection<ExN02TrackerHit> marObj(msh_cursor);
|
|---|
| 254 | marObj.unmarshalTo((G4THitsCollection<ExN02TrackerHit>*)param);
|
|---|
| 255 |
|
|---|
| 256 | }
|
|---|
| 257 | msh_cursor += msh_currentSize;
|
|---|
| 258 | }
|
|---|
| 259 |
|
|---|
| 260 | };
|
|---|
| 261 | #endif
|
|---|
| 262 |
|
|---|