Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Data Fields
MarshaledExN02TrackerHit Class Reference

#include <MarshaledExN02TrackerHit.h>

Inheritance diagram for MarshaledExN02TrackerHit:
MarshaledObj

Public Member Functions

 MarshaledExN02TrackerHit (ExN02TrackerHit *objptr)
 
 MarshaledExN02TrackerHit (void *buf, char chIsUnmarshaling= 'u')
 
 ~MarshaledExN02TrackerHit ()
 
ExN02TrackerHitunmarshal ()
 
void unmarshalTo (ExN02TrackerHit *obj)
 
void marshal1 ()
 
void unmarshal1 ()
 
void marshal2 ()
 
void unmarshal2 ()
 
void marshal3 ()
 
void unmarshal3 ()
 
void marshal4 ()
 
void unmarshal4 ()
 
- Public Member Functions inherited from MarshaledObj
 MarshaledObj ()
 
 MarshaledObj (void *buf, char chIsUnmarshaling)
 
 ~MarshaledObj ()
 
bool isUnmarshaling ()
 
void EXTEND_BUFFER (int size)
 
void resizeBuffer (size_t new_size)
 
int getBufferSize ()
 
char * getBuffer ()
 
void marshalPrimitive (void *p, int size)
 
void unmarshalPrimitive (void *p, int size)
 
 MarshaledObj ()
 
 MarshaledObj (void *buf, char chIsUnmarshaling)
 
 ~MarshaledObj ()
 
bool isUnmarshaling ()
 
void EXTEND_BUFFER (int size)
 
void resizeBuffer (size_t new_size)
 
int getBufferSize ()
 
char * getBuffer ()
 
void marshalPrimitive (void *p, int size)
 
void unmarshalPrimitive (void *p, int size)
 

Data Fields

ExN02TrackerHitparam
 
ShadowedMarshaledExN02TrackerHitShadowed_param
 

Additional Inherited Members

- Static Public Member Functions inherited from MarshaledObj
static int ROUND_UP (int x)
 
static int ROUND_UP (int x)
 
- Protected Attributes inherited from MarshaledObj
int msh_typechoice
 
char * msh_buffer
 
char * msh_field_begin
 
size_t msh_size
 
char * msh_cursor
 
size_t msh_extent
 
bool msh_isUnmarshalDone
 

Detailed Description

Definition at line 22 of file MarshaledExN02TrackerHit.h.

Constructor & Destructor Documentation

MarshaledExN02TrackerHit::MarshaledExN02TrackerHit ( ExN02TrackerHit objptr)
inline
MarshaledExN02TrackerHit::MarshaledExN02TrackerHit ( void buf,
char  chIsUnmarshaling = 'u' 
)
inline

Definition at line 44 of file MarshaledExN02TrackerHit.h.

References MarshaledObj::msh_isUnmarshalDone.

45 : MarshaledObj(buf, chIsUnmarshaling) {
46  msh_isUnmarshalDone = false;
47 }
MarshaledExN02TrackerHit::~MarshaledExN02TrackerHit ( )
inline

Definition at line 49 of file MarshaledExN02TrackerHit.h.

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

Member Function Documentation

void MarshaledExN02TrackerHit::marshal1 ( )
inline

Definition at line 92 of file MarshaledExN02TrackerHit.h.

References MarshaledObj::EXTEND_BUFFER(), ExN02TrackerHit::GetPos(), int(), MarshaledObj::isUnmarshaling(), MarshaledObj::msh_buffer, MarshaledObj::msh_cursor, MarshaledObj::msh_field_begin, MSH_SET_TOTALSIZE, MSH_SET_TYPECHOICE, MarshaledObj::msh_size, MarshaledObj::msh_typechoice, and param.

Referenced by MarshaledExN02TrackerHit().

92  {
93  //declare field_size to be the size of this field
94  int msh_currentSize = 0;
95  if (isUnmarshaling())
96  throw "Tried to marshal in obj marked isUnmarshaling == true";
97 
98  //Copy the sizespec into msh_currentSize here:
99  {
100  msh_currentSize = sizeof(G4ThreeVector);
101 
102  }
103 
104  //Increase the size of buffer if needed
105  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
106  // 4 bytes for the total size of field, 4 bytes for the number
107  // of elements in the array (in the case of array marshaling)
108  //Mark the beginning position for this field, will write the total
109  // size of this field here later
111 
112  //Advance cursor of distance = sizeof(int)
113  msh_cursor += sizeof(int);
114 
115  //Now just copy "get" functions here
116  {
117  G4ThreeVector anElement;
118  anElement = param->GetPos();
119  memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector));
120  }
121  //Now advance the cursor
122  msh_cursor += msh_currentSize;
123  //Now set the size of this field
124  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
125  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
126  memcpy(msh_field_begin, &tmp, sizeof(int));
127 
128  //Now set msh_size
131 }
CLHEP::Hep3Vector G4ThreeVector
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
#define MSH_SET_TYPECHOICE(X)
void EXTEND_BUFFER(int size)
G4ThreeVector GetPos() const
#define MSH_SET_TOTALSIZE(X)
void MarshaledExN02TrackerHit::marshal2 ( )
inline

Definition at line 149 of file MarshaledExN02TrackerHit.h.

References MarshaledObj::EXTEND_BUFFER(), ExN02TrackerHit::GetEdep(), int(), MarshaledObj::isUnmarshaling(), MarshaledObj::msh_buffer, MarshaledObj::msh_cursor, MarshaledObj::msh_field_begin, MSH_SET_TOTALSIZE, MSH_SET_TYPECHOICE, MarshaledObj::msh_size, MarshaledObj::msh_typechoice, and param.

Referenced by MarshaledExN02TrackerHit().

149  {
150  //declare field_size to be the size of this field
151  int msh_currentSize = 0;
152  if (isUnmarshaling())
153  throw "Tried to marshal in obj marked isUnmarshaling == true";
154 
155  //Copy the sizespec into msh_currentSize here:
156  {
157  msh_currentSize = sizeof(G4double);
158 
159  }
160 
161  //Increase the size of buffer if needed
162  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
163  // 4 bytes for the total size of field, 4 bytes for the number of
164  // elements in the array (in the case of array marshaling)
165  //Mark the beginning position for this field, will write the total size
166  //of this field here later
168 
169  //Advance cursor of distance = sizeof(int)
170  msh_cursor += sizeof(int);
171 
172  //Now just copy "get" functions here
173  {
174  G4double anElement;
175  anElement = param->GetEdep();
176  memcpy(msh_cursor, &anElement, sizeof(G4double));
177  }
178  //Now advance the cursor
179  msh_cursor += msh_currentSize;
180  //Now set the size of this field
181  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
182  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
183  memcpy(msh_field_begin, &tmp, sizeof(int));
184 
185  //Now set msh_size
188 }
G4double GetEdep() const
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
#define MSH_SET_TYPECHOICE(X)
void EXTEND_BUFFER(int size)
double G4double
Definition: G4Types.hh:76
#define MSH_SET_TOTALSIZE(X)
void MarshaledExN02TrackerHit::marshal3 ( )
inline

Definition at line 206 of file MarshaledExN02TrackerHit.h.

References MarshaledObj::EXTEND_BUFFER(), ExN02TrackerHit::GetTrackID(), int(), MarshaledObj::isUnmarshaling(), MarshaledObj::msh_buffer, MarshaledObj::msh_cursor, MarshaledObj::msh_field_begin, MSH_SET_TOTALSIZE, MSH_SET_TYPECHOICE, MarshaledObj::msh_size, MarshaledObj::msh_typechoice, and param.

Referenced by MarshaledExN02TrackerHit().

206  {
207  //declare field_size to be the size of this field
208  int msh_currentSize = 0;
209  if (isUnmarshaling())
210  throw "Tried to marshal in obj marked isUnmarshaling == true";
211 
212  //Copy the sizespec into msh_currentSize here:
213  {
214  msh_currentSize = sizeof(G4int );
215 
216  }
217 
218  //Increase the size of buffer if needed
219  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
220  // 4 bytes for the total size of field, 4 bytes for the number
221  // of elements in the array (in the case of array marshaling)
222  //Mark the beginning position for this field, will write the total
223  //size of this field here later
225 
226  //Advance cursor of distance = sizeof(int)
227  msh_cursor += sizeof(int);
228 
229  //Now just copy "get" functions here
230  {
231  G4int anElement;
232  anElement = param->GetTrackID();
233  memcpy(msh_cursor, &anElement, sizeof(G4int ));
234  }
235  //Now advance the cursor
236  msh_cursor += msh_currentSize;
237  //Now set the size of this field
238  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
239  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
240  memcpy(msh_field_begin, &tmp, sizeof(int));
241 
242  //Now set msh_size
245 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78
#define MSH_SET_TYPECHOICE(X)
G4int GetTrackID() const
void EXTEND_BUFFER(int size)
#define MSH_SET_TOTALSIZE(X)
void MarshaledExN02TrackerHit::marshal4 ( )
inline

Definition at line 263 of file MarshaledExN02TrackerHit.h.

References MarshaledObj::EXTEND_BUFFER(), ExN02TrackerHit::GetChamberNb(), int(), MarshaledObj::isUnmarshaling(), MarshaledObj::msh_buffer, MarshaledObj::msh_cursor, MarshaledObj::msh_field_begin, MSH_SET_TOTALSIZE, MSH_SET_TYPECHOICE, MarshaledObj::msh_size, MarshaledObj::msh_typechoice, and param.

Referenced by MarshaledExN02TrackerHit().

263  {
264  //declare field_size to be the size of this field
265  int msh_currentSize = 0;
266  if (isUnmarshaling())
267  throw "Tried to marshal in obj marked isUnmarshaling == true";
268 
269  //Copy the sizespec into msh_currentSize here:
270  {
271  msh_currentSize = sizeof(G4int );
272 
273  }
274 
275  //Increase the size of buffer if needed
276  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
277  // 4 bytes for the total size of field, 4 bytes for the number
278  // of elements in the array (in the case of array marshaling)
279  //Mark the beginning position for this field, will write the total
280  //size of this field here later
282 
283  //Advance cursor of distance = sizeof(int)
284  msh_cursor += sizeof(int);
285 
286  //Now just copy "get" functions here
287  {
288  G4int anElement;
289  anElement = param->GetChamberNb();
290  memcpy(msh_cursor, &anElement, sizeof(G4int ));
291  }
292  //Now advance the cursor
293  msh_cursor += msh_currentSize;
294  //Now set the size of this field
295  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
296  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
297  memcpy(msh_field_begin, &tmp, sizeof(int));
298 
299  //Now set msh_size
302 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78
#define MSH_SET_TYPECHOICE(X)
void EXTEND_BUFFER(int size)
#define MSH_SET_TOTALSIZE(X)
G4int GetChamberNb() const
ExN02TrackerHit* MarshaledExN02TrackerHit::unmarshal ( )
inline

Definition at line 55 of file MarshaledExN02TrackerHit.h.

References MSH_HEADER_SIZE, MarshaledObj::msh_isUnmarshalDone, MarshaledObj::msh_size, param, Shadowed_param, unmarshal1(), unmarshal2(), unmarshal3(), and unmarshal4().

Referenced by MarshaledG4HitsCollection::unmarshal1().

55  {
56  //We don't want to unmarshal the buffer is empty.
57  if(msh_size <= MSH_HEADER_SIZE) {
58  //This is buggy, we can't always assume that
59  //obj == NULL <==> List is empty.
60  return NULL;
61  } else {
62  {
63  param = new ExN02TrackerHit();
64  }
66  this->msh_isUnmarshalDone = true;
67  unmarshal1();
68  unmarshal2();
69  unmarshal3();
70  unmarshal4();
71  return this->param;
72  }
73 }
ShadowedMarshaledExN02TrackerHit * Shadowed_param
#define MSH_HEADER_SIZE
void MarshaledExN02TrackerHit::unmarshal1 ( )
inline

Definition at line 133 of file MarshaledExN02TrackerHit.h.

References int(), MarshaledObj::msh_cursor, param, and ExN02TrackerHit::SetPos().

Referenced by unmarshal(), and unmarshalTo().

133  {
134  //declare currentSize to be the size of this field
135  int msh_currentSize = 0;
136  //copy the size of the current field into currentSize
137  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
138  msh_cursor += sizeof(int);
139  //Now copy the setspec here
140  {
141  G4ThreeVector anElement;
142  memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector));
143  param->SetPos(anElement);
144 
145  }
146  msh_cursor += msh_currentSize;
147 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
void SetPos(G4ThreeVector xyz)
void MarshaledExN02TrackerHit::unmarshal2 ( )
inline

Definition at line 190 of file MarshaledExN02TrackerHit.h.

References int(), MarshaledObj::msh_cursor, param, and ExN02TrackerHit::SetEdep().

Referenced by unmarshal(), and unmarshalTo().

190  {
191  //declare currentSize to be the size of this field
192  int msh_currentSize = 0;
193  //copy the size of the current field into currentSize
194  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
195  msh_cursor += sizeof(int);
196  //Now copy the setspec here
197  {
198  G4double anElement;
199  memcpy(&anElement, msh_cursor, sizeof(G4double));
200  param->SetEdep(anElement);
201 
202  }
203  msh_cursor += msh_currentSize;
204 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
void SetEdep(G4double de)
double G4double
Definition: G4Types.hh:76
void MarshaledExN02TrackerHit::unmarshal3 ( )
inline

Definition at line 247 of file MarshaledExN02TrackerHit.h.

References int(), MarshaledObj::msh_cursor, param, and ExN02TrackerHit::SetTrackID().

Referenced by unmarshal(), and unmarshalTo().

247  {
248  //declare currentSize to be the size of this field
249  int msh_currentSize = 0;
250  //copy the size of the current field into currentSize
251  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
252  msh_cursor += sizeof(int);
253  //Now copy the setspec here
254  {
255  G4int anElement;
256  memcpy(&anElement, msh_cursor, sizeof(G4int ));
257  param->SetTrackID(anElement);
258 
259  }
260  msh_cursor += msh_currentSize;
261 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78
void SetTrackID(G4int track)
void MarshaledExN02TrackerHit::unmarshal4 ( )
inline

Definition at line 304 of file MarshaledExN02TrackerHit.h.

References int(), MarshaledObj::msh_cursor, param, and ExN02TrackerHit::SetChamberNb().

Referenced by unmarshal(), and unmarshalTo().

304  {
305  //declare currentSize to be the size of this field
306  int msh_currentSize = 0;
307  //copy the size of the current field into currentSize
308  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
309  msh_cursor += sizeof(int);
310  //Now copy the setspec here
311  {
312  G4int anElement;
313  memcpy(&anElement, msh_cursor, sizeof(G4int ));
314  param->SetChamberNb(anElement);
315 
316  }
317  msh_cursor += msh_currentSize;
318 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78
void SetChamberNb(G4int chamb)
void MarshaledExN02TrackerHit::unmarshalTo ( ExN02TrackerHit obj)
inline

Definition at line 75 of file MarshaledExN02TrackerHit.h.

References MSH_HEADER_SIZE, MarshaledObj::msh_isUnmarshalDone, MarshaledObj::msh_size, param, Shadowed_param, unmarshal1(), unmarshal2(), unmarshal3(), and unmarshal4().

75  {
76  //We don't want to unmarshal the buffer is empty.
77  if(msh_size <= MSH_HEADER_SIZE) {
78  //This is buggy, we can't always assume that
79  //obj == NULL <==> List is empty.
80  return;
81  } else {
82  this->param = obj;
84  this->msh_isUnmarshalDone = true;
85  unmarshal1();
86  unmarshal2();
87  unmarshal3();
88  unmarshal4();
89  }
90 }
ShadowedMarshaledExN02TrackerHit * Shadowed_param
#define MSH_HEADER_SIZE

Field Documentation

ExN02TrackerHit* MarshaledExN02TrackerHit::param
ShadowedMarshaledExN02TrackerHit* MarshaledExN02TrackerHit::Shadowed_param

Definition at line 25 of file MarshaledExN02TrackerHit.h.

Referenced by MarshaledExN02TrackerHit(), unmarshal(), and unmarshalTo().


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