7 #ifndef MarshaledG4HitsCollection_H 8 #define MarshaledG4HitsCollection_H 13 #include "ExN04CalorimeterHit.hh" 14 #include "ExN04MuonHit.hh" 15 #include "ExN04TrackerHit.hh" 16 #include "MarshaledExN04CalorimeterHit.h" 17 #include "MarshaledExN04MuonHit.h" 18 #include "MarshaledExN04TrackerHit.h" 23 #include "MarshaledObj.h" 48 msh_isUnmarshalDone =
false;
58 : MarshaledObj(buf, isUnmarshaling) {
59 msh_isUnmarshalDone =
false;
70 if(msh_size <= MSH_HEADER_SIZE) {
79 this->msh_isUnmarshalDone =
true;
87 if(msh_size <= MSH_HEADER_SIZE) {
94 this->msh_isUnmarshalDone =
true;
101 int msh_currentSize = 0;
102 if (isUnmarshaling())
103 throw "Tried to marshal in obj marked isUnmarshaling == true";
111 EXTEND_BUFFER(msh_currentSize +
sizeof(
int) +
sizeof(
int));
113 msh_field_begin = msh_cursor;
116 msh_cursor +=
sizeof(int);
130 memcpy( msh_cursor+copy_off, &elementNum,
sizeof(
int));
131 copy_off +=
sizeof(int);
132 for(
int index=0;index<elementNum;index++){
144 MarshaledExN04CalorimeterHit marEle((ExN04CalorimeterHit* )anElement);
145 EXTEND_BUFFER(marEle.getBufferSize());
146 memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
147 copy_off += marEle.getBufferSize();
159 MarshaledExN04MuonHit marEle((ExN04MuonHit* )anElement);
160 EXTEND_BUFFER(marEle.getBufferSize());
161 memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
162 copy_off += marEle.getBufferSize();
174 MarshaledExN04TrackerHit marEle((ExN04TrackerHit*)anElement);
175 EXTEND_BUFFER(marEle.getBufferSize());
176 memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
177 copy_off += marEle.getBufferSize();
180 msh_currentSize = copy_off;
184 msh_cursor += msh_currentSize;
187 tmp = (msh_cursor-msh_field_begin) -
sizeof(
int);
188 memcpy(msh_field_begin, &tmp,
sizeof(
int));
191 msh_size = msh_cursor - msh_buffer;
192 MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
197 int msh_currentSize = 0;
199 memcpy(&msh_currentSize, msh_cursor,
sizeof(
int));
200 msh_cursor +=
sizeof(int);
207 memcpy(&elementNum, msh_cursor+copy_off,
sizeof(
int));
208 copy_off +=
sizeof(int);
209 for(
int index=0;index<elementNum;index++){
210 MarshaledExN04CalorimeterHit marEle(msh_cursor+copy_off);
211 ExN04CalorimeterHit* anElement = (ExN04CalorimeterHit* )marEle.unmarshal();
212 copy_off += marEle.getBufferSize();
226 memcpy(&elementNum, msh_cursor+copy_off,
sizeof(
int));
227 copy_off +=
sizeof(int);
228 for(
int index=0;index<elementNum;index++){
229 MarshaledExN04MuonHit marEle(msh_cursor+copy_off);
230 ExN04MuonHit* anElement = (ExN04MuonHit* )marEle.unmarshal();
231 copy_off += marEle.getBufferSize();
245 memcpy(&elementNum, msh_cursor+copy_off,
sizeof(
int));
246 copy_off +=
sizeof(int);
247 for(
int index=0;index<elementNum;index++){
248 MarshaledExN04TrackerHit marEle(msh_cursor+copy_off);
249 ExN04TrackerHit* anElement = (ExN04TrackerHit*)marEle.unmarshal();
250 copy_off += marEle.getBufferSize();
263 msh_cursor += msh_currentSize;
277 msh_isUnmarshalDone =
false;
278 this->param = objptr;
287 : MarshaledObj(buf, isUnmarshaling) {
288 msh_isUnmarshalDone =
false;
299 if(msh_size <= MSH_HEADER_SIZE) {
308 this->msh_isUnmarshalDone =
true;
316 if(msh_size <= MSH_HEADER_SIZE) {
323 this->msh_isUnmarshalDone =
true;
330 int msh_currentSize = 0;
331 if (isUnmarshaling())
332 throw "Tried to marshal in obj marked isUnmarshaling == true";
341 EXTEND_BUFFER(msh_currentSize +
sizeof(
int) +
sizeof(
int));
343 msh_field_begin = msh_cursor;
346 msh_cursor +=
sizeof(int);
351 EXTEND_BUFFER(marParent.getBufferSize());
352 memcpy(msh_cursor,marParent.getBuffer(), marParent.getBufferSize());
353 msh_currentSize = marParent.getBufferSize();
357 msh_cursor += msh_currentSize;
360 tmp = (msh_cursor-msh_field_begin) -
sizeof(
int);
361 memcpy(msh_field_begin, &tmp,
sizeof(
int));
364 msh_size = msh_cursor - msh_buffer;
365 MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
370 int msh_currentSize = 0;
372 memcpy(&msh_currentSize, msh_cursor,
sizeof(
int));
373 msh_cursor +=
sizeof(int);
380 msh_cursor += msh_currentSize;
G4HitsCollection * unmarshal()
MarshaledG4HitsCollection(G4HitsCollection *objptr)
MarshaledG4HitsCollection(void *buf, char isUnmarshaling= 'u')
void unmarshalTo(G4THitsCollection< T > *obj)
G4THitsCollection< T > * unmarshal()
void unmarshalTo(G4HitsCollection *obj)
MarshaledG4THitsCollection(G4THitsCollection< T > *objptr)
~MarshaledG4HitsCollection()
~MarshaledG4THitsCollection()
MarshaledG4THitsCollection(void *buf, char isUnmarshaling= 'u')