LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
MarshaledG4THitsCollection< T > Class Template Reference

#include "MarshaledG4THitsCollection.h"

Inheritance diagram for MarshaledG4THitsCollection< T >:

Public Member Functions

 MarshaledG4THitsCollection (G4THitsCollection< T > *objptr)
 
 MarshaledG4THitsCollection (void *buf, char isUnmarshaling= 'u')
 
 ~MarshaledG4THitsCollection ()
 
G4THitsCollection< T > * unmarshal ()
 
void unmarshalTo (G4THitsCollection< T > *obj)
 
void marshal1 ()
 
void unmarshal1 ()
 
 MarshaledG4THitsCollection (G4THitsCollection< T > *objptr)
 
 MarshaledG4THitsCollection (void *buf, char isUnmarshaling= 'u')
 
 ~MarshaledG4THitsCollection ()
 
G4THitsCollection< T > * unmarshal ()
 
void unmarshalTo (G4THitsCollection< T > *obj)
 
void marshal1 ()
 
void unmarshal1 ()
 

Public Attributes

G4THitsCollection< T > * param
 
ShadowedMarshaledG4THitsCollection< T > * Shadowed_param
 

Detailed Description

template<class T>
class MarshaledG4THitsCollection< T >

Definition at line 24 of file MarshaledG4THitsCollection.h.

Constructor & Destructor Documentation

template<class T>
MarshaledG4THitsCollection< T >::MarshaledG4THitsCollection ( G4THitsCollection< T > *  objptr)
inline

Definition at line 173 of file MarshaledG4THitsCollection.h.

173  : MarshaledObj() {
174  msh_isUnmarshalDone = false;
175  this->param = objptr;
177  if (objptr == NULL)
178  return;
179 
180  marshal1();
181 }
ShadowedMarshaledG4THitsCollection< T > * Shadowed_param
template<class T>
MarshaledG4THitsCollection< T >::MarshaledG4THitsCollection ( void *  buf,
char  isUnmarshaling = 'u' 
)
inline

Definition at line 183 of file MarshaledG4THitsCollection.h.

184 : MarshaledObj(buf, isUnmarshaling) {
185  msh_isUnmarshalDone = false;
186 }
template<class T>
MarshaledG4THitsCollection< T >::~MarshaledG4THitsCollection ( )
inline

Definition at line 188 of file MarshaledG4THitsCollection.h.

188  {
189  //if(msh_isUnmarshalDone && this->param != NULL) {
190  //delete this->param;
191  //}
192 }
template<class T>
MarshaledG4THitsCollection< T >::MarshaledG4THitsCollection ( G4THitsCollection< T > *  objptr)
inline

Definition at line 276 of file MarshaledG4THitsCollection.h.

276  : MarshaledObj() {
277  msh_isUnmarshalDone = false;
278  this->param = objptr;
280  if (objptr == NULL)
281  return;
282 
283  marshal1();
284 }
ShadowedMarshaledG4THitsCollection< T > * Shadowed_param
template<class T>
MarshaledG4THitsCollection< T >::MarshaledG4THitsCollection ( void *  buf,
char  isUnmarshaling = 'u' 
)
inline

Definition at line 286 of file MarshaledG4THitsCollection.h.

287 : MarshaledObj(buf, isUnmarshaling) {
288  msh_isUnmarshalDone = false;
289 }
template<class T>
MarshaledG4THitsCollection< T >::~MarshaledG4THitsCollection ( )
inline

Definition at line 291 of file MarshaledG4THitsCollection.h.

291  {
292  //if(msh_isUnmarshalDone && this->param != NULL) {
293  //delete this->param;
294  //}
295 }

Member Function Documentation

template<class T>
void MarshaledG4THitsCollection< T >::marshal1 ( )
inline

Definition at line 225 of file MarshaledG4THitsCollection.h.

References tmp.

225  {
226  //declare field_size to be the size of this field
227  int msh_currentSize = 0;
228  if (isUnmarshaling())
229  throw "Tried to marshal in obj marked isUnmarshaling == true";
230 
231  //Copy the sizespec into msh_currentSize here:
232  {
233  //code for size, just dummy code because the size will be set correctly at the end of marshaling code
234 
235  }
236 
237  //Increase the size of buffer if needed
238  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)
239  //Mark the beginning position for this field, will write the total size of this field here later
240  msh_field_begin = msh_cursor;
241 
242  //Advance cursor of distance = sizeof(int)
243  msh_cursor += sizeof(int);
244 
245  //Now just copy "get" functions here
246  {
247  MarshaledG4HitsCollection marParent(param);
248  EXTEND_BUFFER(marParent.getBufferSize());
249  memcpy(msh_cursor,marParent.getBuffer(), marParent.getBufferSize());
250  msh_currentSize = marParent.getBufferSize();
251 
252  }
253  //Now advance the cursor
254  msh_cursor += msh_currentSize;
255  //Now set the size of this field
256  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
257  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
258  memcpy(msh_field_begin, &tmp, sizeof(int));
259 
260  //Now set msh_size
261  msh_size = msh_cursor - msh_buffer;
262  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
263 }
Float_t tmp
Definition: plot.C:37
template<class T>
void MarshaledG4THitsCollection< T >::marshal1 ( )
inline

Definition at line 328 of file MarshaledG4THitsCollection.h.

References tmp.

328  {
329  //declare field_size to be the size of this field
330  int msh_currentSize = 0;
331  if (isUnmarshaling())
332  throw "Tried to marshal in obj marked isUnmarshaling == true";
333 
334  //Copy the sizespec into msh_currentSize here:
335  {
336  //code for size, just dummy code because the size will be set correctly at the end of marshaling code
337 
338  }
339 
340  //Increase the size of buffer if needed
341  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)
342  //Mark the beginning position for this field, will write the total size of this field here later
343  msh_field_begin = msh_cursor;
344 
345  //Advance cursor of distance = sizeof(int)
346  msh_cursor += sizeof(int);
347 
348  //Now just copy "get" functions here
349  {
350  MarshaledG4HitsCollection marParent(param);
351  EXTEND_BUFFER(marParent.getBufferSize());
352  memcpy(msh_cursor,marParent.getBuffer(), marParent.getBufferSize());
353  msh_currentSize = marParent.getBufferSize();
354 
355  }
356  //Now advance the cursor
357  msh_cursor += msh_currentSize;
358  //Now set the size of this field
359  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
360  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
361  memcpy(msh_field_begin, &tmp, sizeof(int));
362 
363  //Now set msh_size
364  msh_size = msh_cursor - msh_buffer;
365  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
366 }
Float_t tmp
Definition: plot.C:37
template<class T>
G4THitsCollection<T>* MarshaledG4THitsCollection< T >::unmarshal ( )
inline

Definition at line 194 of file MarshaledG4THitsCollection.h.

194  {
195  //We don't want to unmarshal the buffer is empty.
196  if(msh_size <= MSH_HEADER_SIZE) {
197  //This is buggy, we can't always assume that
198  //obj == NULL <==> List is empty.
199  return NULL;
200  } else {
201  {
202  param = new G4THitsCollection<T>();
203  }
205  this->msh_isUnmarshalDone = true;
206  unmarshal1();
207  return this->param;
208  }
209 }
ShadowedMarshaledG4THitsCollection< T > * Shadowed_param
template<class T>
G4THitsCollection<T>* MarshaledG4THitsCollection< T >::unmarshal ( )
inline

Definition at line 297 of file MarshaledG4THitsCollection.h.

297  {
298  //We don't want to unmarshal the buffer is empty.
299  if(msh_size <= MSH_HEADER_SIZE) {
300  //This is buggy, we can't always assume that
301  //obj == NULL <==> List is empty.
302  return NULL;
303  } else {
304  {
305  param = new G4THitsCollection<T>();
306  }
308  this->msh_isUnmarshalDone = true;
309  unmarshal1();
310  return this->param;
311  }
312 }
ShadowedMarshaledG4THitsCollection< T > * Shadowed_param
template<class T>
void MarshaledG4THitsCollection< T >::unmarshal1 ( )
inline

Definition at line 265 of file MarshaledG4THitsCollection.h.

References MarshaledG4HitsCollection::unmarshalTo().

265  {
266  //declare currentSize to be the size of this field
267  int msh_currentSize = 0;
268  //copy the size of the current field into currentSize
269  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
270  msh_cursor += sizeof(int);
271  //Now copy the setspec here
272  {
273  MarshaledG4HitsCollection marObj(msh_cursor);
274  marObj.unmarshalTo(param);
275 
276  }
277  msh_cursor += msh_currentSize;
278 }
template<class T>
void MarshaledG4THitsCollection< T >::unmarshal1 ( )
inline

Definition at line 368 of file MarshaledG4THitsCollection.h.

References MarshaledG4HitsCollection::unmarshalTo().

368  {
369  //declare currentSize to be the size of this field
370  int msh_currentSize = 0;
371  //copy the size of the current field into currentSize
372  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
373  msh_cursor += sizeof(int);
374  //Now copy the setspec here
375  {
376  MarshaledG4HitsCollection marObj(msh_cursor);
377  marObj.unmarshalTo(param);
378 
379  }
380  msh_cursor += msh_currentSize;
381 }
template<class T>
void MarshaledG4THitsCollection< T >::unmarshalTo ( G4THitsCollection< T > *  obj)
inline

Definition at line 211 of file MarshaledG4THitsCollection.h.

Referenced by MarshaledG4VHitsCollection::unmarshal3().

211  {
212  //We don't want to unmarshal the buffer is empty.
213  if(msh_size <= MSH_HEADER_SIZE) {
214  //This is buggy, we can't always assume that
215  //obj == NULL <==> List is empty.
216  return;
217  } else {
218  this->param = obj;
220  this->msh_isUnmarshalDone = true;
221  unmarshal1();
222  }
223 }
ShadowedMarshaledG4THitsCollection< T > * Shadowed_param
template<class T>
void MarshaledG4THitsCollection< T >::unmarshalTo ( G4THitsCollection< T > *  obj)
inline

Definition at line 314 of file MarshaledG4THitsCollection.h.

314  {
315  //We don't want to unmarshal the buffer is empty.
316  if(msh_size <= MSH_HEADER_SIZE) {
317  //This is buggy, we can't always assume that
318  //obj == NULL <==> List is empty.
319  return;
320  } else {
321  this->param = obj;
323  this->msh_isUnmarshalDone = true;
324  unmarshal1();
325  }
326 }
ShadowedMarshaledG4THitsCollection< T > * Shadowed_param

Member Data Documentation

template<class T>
G4THitsCollection< T > * MarshaledG4THitsCollection< T >::param

Definition at line 166 of file MarshaledG4THitsCollection.h.

template<class T>
ShadowedMarshaledG4THitsCollection< T > * MarshaledG4THitsCollection< T >::Shadowed_param

Definition at line 167 of file MarshaledG4THitsCollection.h.


The documentation for this class was generated from the following file: