LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
MarshaledG4String Class Reference

#include "MarshaledG4String.h"

Inheritance diagram for MarshaledG4String:

Public Member Functions

 MarshaledG4String (G4String *objptr)
 
 MarshaledG4String (void *buf, char isUnmarshaling= 'u')
 
 ~MarshaledG4String ()
 
G4Stringunmarshal ()
 
void unmarshalTo (G4String *obj)
 
void marshal1 ()
 
void unmarshal1 ()
 
 MarshaledG4String (G4String *objptr)
 
 MarshaledG4String (void *buf, char isUnmarshaling= 'u')
 
 ~MarshaledG4String ()
 
G4Stringunmarshal ()
 
void unmarshalTo (G4String *obj)
 
void marshal1 ()
 
void unmarshal1 ()
 

Public Attributes

G4Stringparam
 
ShadowedMarshaledG4StringShadowed_param
 

Detailed Description

Definition at line 23 of file MarshaledG4String.h.

Constructor & Destructor Documentation

MarshaledG4String::MarshaledG4String ( G4String objptr)
inline

Definition at line 32 of file MarshaledG4String.h.

32  : MarshaledObj() {
33  msh_isUnmarshalDone = false;
34  this->param = objptr;
36  if (objptr == NULL)
37  return;
38 
39  marshal1();
40 }
ShadowedMarshaledG4String * Shadowed_param
MarshaledG4String::MarshaledG4String ( void *  buf,
char  isUnmarshaling = 'u' 
)
inline

Definition at line 42 of file MarshaledG4String.h.

43 : MarshaledObj(buf, isUnmarshaling) {
44  msh_isUnmarshalDone = false;
45 }
MarshaledG4String::~MarshaledG4String ( )
inline

Definition at line 47 of file MarshaledG4String.h.

47  {
48  //if(msh_isUnmarshalDone && this->param != NULL) {
49  //delete this->param;
50  //}
51 }
MarshaledG4String::MarshaledG4String ( G4String objptr)
inline

Definition at line 32 of file MarshaledG4String.h.

32  : MarshaledObj() {
33  msh_isUnmarshalDone = false;
34  this->param = objptr;
36  if (objptr == NULL)
37  return;
38 
39  marshal1();
40 }
ShadowedMarshaledG4String * Shadowed_param
MarshaledG4String::MarshaledG4String ( void *  buf,
char  isUnmarshaling = 'u' 
)
inline

Definition at line 42 of file MarshaledG4String.h.

43 : MarshaledObj(buf, isUnmarshaling) {
44  msh_isUnmarshalDone = false;
45 }
MarshaledG4String::~MarshaledG4String ( )
inline

Definition at line 47 of file MarshaledG4String.h.

47  {
48  //if(msh_isUnmarshalDone && this->param != NULL) {
49  //delete this->param;
50  //}
51 }

Member Function Documentation

void MarshaledG4String::marshal1 ( )
inline

Definition at line 84 of file MarshaledG4String.h.

References tmp.

84  {
85  //declare field_size to be the size of this field
86  int msh_currentSize = 0;
87  if (isUnmarshaling())
88  throw "Tried to marshal in obj marked isUnmarshaling == true";
89 
90  //Copy the sizespec into msh_currentSize here:
91  {
92  int size = param->size()+1;
93  while(size%8) size++;
94  msh_currentSize = size;
95  }
96 
97  //Increase the size of buffer if needed
98  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)
99  //Mark the beginning position for this field, will write the total size of this field here later
100  msh_field_begin = msh_cursor;
101 
102  //Advance cursor of distance = sizeof(int)
103  msh_cursor += sizeof(int);
104 
105  //Now just copy "get" functions here
106  {
107  memcpy(msh_cursor, param->c_str(), param->size());
108  *(msh_cursor+param->size()) = '\0';
109 
110  }
111  //Now advance the cursor
112  msh_cursor += msh_currentSize;
113  //Now set the size of this field
114  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
115  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
116  memcpy(msh_field_begin, &tmp, sizeof(int));
117 
118  //Now set msh_size
119  msh_size = msh_cursor - msh_buffer;
120  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
121 }
Float_t tmp
Definition: plot.C:37
void MarshaledG4String::marshal1 ( )
inline

Definition at line 84 of file MarshaledG4String.h.

References tmp.

84  {
85  //declare field_size to be the size of this field
86  int msh_currentSize = 0;
87  if (isUnmarshaling())
88  throw "Tried to marshal in obj marked isUnmarshaling == true";
89 
90  //Copy the sizespec into msh_currentSize here:
91  {
92  int size = param->size()+1;
93  while(size%8) size++;
94  msh_currentSize = size;
95  }
96 
97  //Increase the size of buffer if needed
98  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)
99  //Mark the beginning position for this field, will write the total size of this field here later
100  msh_field_begin = msh_cursor;
101 
102  //Advance cursor of distance = sizeof(int)
103  msh_cursor += sizeof(int);
104 
105  //Now just copy "get" functions here
106  {
107  memcpy(msh_cursor, param->c_str(), param->size());
108  *(msh_cursor+param->size()) = '\0';
109 
110  }
111  //Now advance the cursor
112  msh_cursor += msh_currentSize;
113  //Now set the size of this field
114  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
115  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
116  memcpy(msh_field_begin, &tmp, sizeof(int));
117 
118  //Now set msh_size
119  msh_size = msh_cursor - msh_buffer;
120  MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
121 }
Float_t tmp
Definition: plot.C:37
G4String* MarshaledG4String::unmarshal ( )
inline

Definition at line 53 of file MarshaledG4String.h.

53  {
54  //We don't want to unmarshal the buffer is empty.
55  if(msh_size <= MSH_HEADER_SIZE) {
56  //This is buggy, we can't always assume that
57  //obj == NULL <==> List is empty.
58  return NULL;
59  } else {
60  {
61  param = new G4String();
62  }
64  this->msh_isUnmarshalDone = true;
65  unmarshal1();
66  return this->param;
67  }
68 }
ShadowedMarshaledG4String * Shadowed_param
G4String* MarshaledG4String::unmarshal ( )
inline

Definition at line 53 of file MarshaledG4String.h.

53  {
54  //We don't want to unmarshal the buffer is empty.
55  if(msh_size <= MSH_HEADER_SIZE) {
56  //This is buggy, we can't always assume that
57  //obj == NULL <==> List is empty.
58  return NULL;
59  } else {
60  {
61  param = new G4String();
62  }
64  this->msh_isUnmarshalDone = true;
65  unmarshal1();
66  return this->param;
67  }
68 }
ShadowedMarshaledG4String * Shadowed_param
void MarshaledG4String::unmarshal1 ( )
inline

Definition at line 123 of file MarshaledG4String.h.

References s.

123  {
124  //declare currentSize to be the size of this field
125  int msh_currentSize = 0;
126  //copy the size of the current field into currentSize
127  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
128  msh_cursor += sizeof(int);
129  //Now copy the setspec here
130  {
131  G4String* s = new G4String(msh_cursor);
132  memcpy(param, s, sizeof(G4String));
133 
134  }
135  msh_cursor += msh_currentSize;
136 }
Float_t s
Definition: plot.C:23
void MarshaledG4String::unmarshal1 ( )
inline

Definition at line 123 of file MarshaledG4String.h.

References s.

123  {
124  //declare currentSize to be the size of this field
125  int msh_currentSize = 0;
126  //copy the size of the current field into currentSize
127  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
128  msh_cursor += sizeof(int);
129  //Now copy the setspec here
130  {
131  G4String* s = new G4String(msh_cursor);
132  memcpy(param, s, sizeof(G4String));
133 
134  }
135  msh_cursor += msh_currentSize;
136 }
Float_t s
Definition: plot.C:23
void MarshaledG4String::unmarshalTo ( G4String obj)
inline

Definition at line 70 of file MarshaledG4String.h.

70  {
71  //We don't want to unmarshal the buffer is empty.
72  if(msh_size <= MSH_HEADER_SIZE) {
73  //This is buggy, we can't always assume that
74  //obj == NULL <==> List is empty.
75  return;
76  } else {
77  this->param = obj;
79  this->msh_isUnmarshalDone = true;
80  unmarshal1();
81  }
82 }
ShadowedMarshaledG4String * Shadowed_param
void MarshaledG4String::unmarshalTo ( G4String obj)
inline

Definition at line 70 of file MarshaledG4String.h.

Referenced by MarshaledG4VHitsCollection::unmarshal1(), and MarshaledG4VHitsCollection::unmarshal2().

70  {
71  //We don't want to unmarshal the buffer is empty.
72  if(msh_size <= MSH_HEADER_SIZE) {
73  //This is buggy, we can't always assume that
74  //obj == NULL <==> List is empty.
75  return;
76  } else {
77  this->param = obj;
79  this->msh_isUnmarshalDone = true;
80  unmarshal1();
81  }
82 }
ShadowedMarshaledG4String * Shadowed_param

Member Data Documentation

G4String * MarshaledG4String::param

Definition at line 25 of file MarshaledG4String.h.

ShadowedMarshaledG4String * MarshaledG4String::Shadowed_param

Definition at line 26 of file MarshaledG4String.h.


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