Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MarshaledExN04MuonHit Class Reference

#include <MarshaledExN04MuonHit.h>

Inheritance diagram for MarshaledExN04MuonHit:
Collaboration diagram for MarshaledExN04MuonHit:

Public Member Functions

 MarshaledExN04MuonHit (ExN04MuonHit *objptr)
 
 MarshaledExN04MuonHit (void *buf, char chIsUnmarshaling= 'u')
 
 ~MarshaledExN04MuonHit ()
 
ExN04MuonHitunmarshal ()
 
void unmarshalTo (ExN04MuonHit *obj)
 
void marshal1 ()
 
void unmarshal1 ()
 
void marshal2 ()
 
void unmarshal2 ()
 
- 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)
 

Public Attributes

ExN04MuonHitparam
 
ShadowedMarshaledExN04MuonHitShadowed_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 MarshaledExN04MuonHit.h.

Constructor & Destructor Documentation

MarshaledExN04MuonHit::MarshaledExN04MuonHit ( ExN04MuonHit objptr)
inline

Definition at line 31 of file MarshaledExN04MuonHit.h.

31  : MarshaledObj() {
32  msh_isUnmarshalDone = false;
33  this->param = objptr;
35  if (objptr == NULL)
36  return;
37 
38  marshal1();
39  marshal2();
40 }
bool msh_isUnmarshalDone
Definition: MarshaledObj.h:119
ShadowedMarshaledExN04MuonHit * Shadowed_param

Here is the call graph for this function:

MarshaledExN04MuonHit::MarshaledExN04MuonHit ( void buf,
char  chIsUnmarshaling = 'u' 
)
inline

Definition at line 42 of file MarshaledExN04MuonHit.h.

43 : MarshaledObj(buf, chIsUnmarshaling) {
44  msh_isUnmarshalDone = false;
45 }
bool msh_isUnmarshalDone
Definition: MarshaledObj.h:119
MarshaledExN04MuonHit::~MarshaledExN04MuonHit ( )
inline

Definition at line 47 of file MarshaledExN04MuonHit.h.

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

Member Function Documentation

void MarshaledExN04MuonHit::marshal1 ( )
inline

Definition at line 86 of file MarshaledExN04MuonHit.h.

86  {
87  //declare field_size to be the size of this field
88  int msh_currentSize = 0;
89  if (isUnmarshaling())
90  throw "Tried to marshal in obj marked isUnmarshaling == true";
91 
92  //Copy the sizespec into msh_currentSize here:
93  {
94  msh_currentSize = sizeof(G4double);
95 
96  }
97 
98  //Increase the size of buffer if needed
99  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
100  // 4 bytes for the total size of field, 4 bytes for the number of
101  // elements in the array (in the case of array marshaling)
102  //Mark the beginning position for this field, will write the total size
103  //of this field here later
105 
106  //Advance cursor of distance = sizeof(int)
107  msh_cursor += sizeof(int);
108 
109  //Now just copy "get" functions here
110  {
111  G4double anElement;
112  anElement = param->GetEdep();
113  memcpy(msh_cursor, &anElement, sizeof(G4double));
114  }
115  //Now advance the cursor
116  msh_cursor += msh_currentSize;
117  //Now set the size of this field
118  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
119  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
120  memcpy(msh_field_begin, &tmp, sizeof(int));
121 
122  //Now set msh_size
125 }
#define MSH_SET_TYPECHOICE(X)
Definition: MarshaledObj.h:21
bool isUnmarshaling()
Definition: MarshaledObj.h:92
size_t msh_size
Definition: MarshaledObj.h:110
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
void EXTEND_BUFFER(int size)
Definition: MarshaledObj.h:122
G4double GetEdep()
Definition: ExN04MuonHit.hh:56
char * msh_field_begin
Definition: MarshaledObj.h:107
char * msh_cursor
Definition: MarshaledObj.h:113
double G4double
Definition: G4Types.hh:76
#define MSH_SET_TOTALSIZE(X)
Definition: MarshaledObj.h:22
char * msh_buffer
Definition: MarshaledObj.h:104

Here is the call graph for this function:

Here is the caller graph for this function:

void MarshaledExN04MuonHit::marshal2 ( )
inline

Definition at line 143 of file MarshaledExN04MuonHit.h.

143  {
144  //declare field_size to be the size of this field
145  int msh_currentSize = 0;
146  if (isUnmarshaling())
147  throw "Tried to marshal in obj marked isUnmarshaling == true";
148 
149  //Copy the sizespec into msh_currentSize here:
150  {
151  msh_currentSize = sizeof(G4ThreeVector);
152 
153  }
154 
155  //Increase the size of buffer if needed
156  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
157  // 4 bytes for the total size of field, 4 bytes for the number of
158  // elements in the array (in the case of array marshaling)
159  //Mark the beginning position for this field, will write the total size
160  //of this field here later
162 
163  //Advance cursor of distance = sizeof(int)
164  msh_cursor += sizeof(int);
165 
166  //Now just copy "get" functions here
167  {
168  G4ThreeVector anElement;
169  anElement = param->GetPos();
170  memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector));
171  }
172  //Now advance the cursor
173  msh_cursor += msh_currentSize;
174  //Now set the size of this field
175  int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
176  tmp = (msh_cursor-msh_field_begin) - sizeof(int);
177  memcpy(msh_field_begin, &tmp, sizeof(int));
178 
179  //Now set msh_size
182 }
G4ThreeVector GetPos()
Definition: ExN04MuonHit.hh:58
CLHEP::Hep3Vector G4ThreeVector
#define MSH_SET_TYPECHOICE(X)
Definition: MarshaledObj.h:21
bool isUnmarshaling()
Definition: MarshaledObj.h:92
size_t msh_size
Definition: MarshaledObj.h:110
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
void EXTEND_BUFFER(int size)
Definition: MarshaledObj.h:122
char * msh_field_begin
Definition: MarshaledObj.h:107
char * msh_cursor
Definition: MarshaledObj.h:113
#define MSH_SET_TOTALSIZE(X)
Definition: MarshaledObj.h:22
char * msh_buffer
Definition: MarshaledObj.h:104

Here is the call graph for this function:

Here is the caller graph for this function:

ExN04MuonHit* MarshaledExN04MuonHit::unmarshal ( )
inline

Definition at line 53 of file MarshaledExN04MuonHit.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 ExN04MuonHit();
62  }
64  this->msh_isUnmarshalDone = true;
65  unmarshal1();
66  unmarshal2();
67  return this->param;
68  }
69 }
bool msh_isUnmarshalDone
Definition: MarshaledObj.h:119
ShadowedMarshaledExN04MuonHit * Shadowed_param
size_t msh_size
Definition: MarshaledObj.h:110
#define MSH_HEADER_SIZE
Definition: MarshaledObj.h:15

Here is the call graph for this function:

Here is the caller graph for this function:

void MarshaledExN04MuonHit::unmarshal1 ( )
inline

Definition at line 127 of file MarshaledExN04MuonHit.h.

127  {
128  //declare currentSize to be the size of this field
129  int msh_currentSize = 0;
130  //copy the size of the current field into currentSize
131  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
132  msh_cursor += sizeof(int);
133  //Now copy the setspec here
134  {
135  G4double anElement;
136  memcpy(&anElement, msh_cursor, sizeof(G4double));
137  param->SetEdep(anElement);
138 
139  }
140  msh_cursor += msh_currentSize;
141 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
char * msh_cursor
Definition: MarshaledObj.h:113
double G4double
Definition: G4Types.hh:76
void SetEdep(G4double de)
Definition: ExN04MuonHit.hh:54

Here is the call graph for this function:

Here is the caller graph for this function:

void MarshaledExN04MuonHit::unmarshal2 ( )
inline

Definition at line 184 of file MarshaledExN04MuonHit.h.

184  {
185  //declare currentSize to be the size of this field
186  int msh_currentSize = 0;
187  //copy the size of the current field into currentSize
188  memcpy(&msh_currentSize, msh_cursor, sizeof(int));
189  msh_cursor += sizeof(int);
190  //Now copy the setspec here
191  {
192  G4ThreeVector anElement;
193  memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector));
194  param->SetPos(anElement);
195 
196  }
197  msh_cursor += msh_currentSize;
198 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
char * msh_cursor
Definition: MarshaledObj.h:113
void SetPos(G4ThreeVector xyz)
Definition: ExN04MuonHit.hh:57

Here is the call graph for this function:

Here is the caller graph for this function:

void MarshaledExN04MuonHit::unmarshalTo ( ExN04MuonHit obj)
inline

Definition at line 71 of file MarshaledExN04MuonHit.h.

71  {
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;
80  this->msh_isUnmarshalDone = true;
81  unmarshal1();
82  unmarshal2();
83  }
84 }
bool msh_isUnmarshalDone
Definition: MarshaledObj.h:119
ShadowedMarshaledExN04MuonHit * Shadowed_param
size_t msh_size
Definition: MarshaledObj.h:110
#define MSH_HEADER_SIZE
Definition: MarshaledObj.h:15

Here is the call graph for this function:

Member Data Documentation

ExN04MuonHit* MarshaledExN04MuonHit::param

Definition at line 24 of file MarshaledExN04MuonHit.h.

ShadowedMarshaledExN04MuonHit* MarshaledExN04MuonHit::Shadowed_param

Definition at line 25 of file MarshaledExN04MuonHit.h.


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