Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
ParN04/include/MarshaledG4String.h
이 파일의 문서화 페이지로 가기
1 // This file was generated automatically by marshalgen.
2 
3 #ifndef MarshaledG4String_H
4 #define MarshaledG4String_H
5 
6 
7 #include <G4String.hh>
8 
9 
10 #include <stdio.h>
11 #include <string.h>
12 #include "MarshaledObj.h"
13 
14  class MarshaledG4String;
15 
16  class ShadowedMarshaledG4String : public G4String{
17  friend class MarshaledG4String;
18 };
19 
20  class MarshaledG4String : public MarshaledObj {
21 public:
22  G4String* param;
24 public:
25 
26 
27 // Function implementations
28 
30  msh_isUnmarshalDone = false;
31  this->param = objptr;
33  if (objptr == NULL)
34  return;
35 
36  marshal1();
37 }
38 
39 MarshaledG4String(void *buf, char chIsUnmarshaling = 'u')
40 : MarshaledObj(buf, chIsUnmarshaling) {
41  msh_isUnmarshalDone = false;
42 }
43 
45  //if(msh_isUnmarshalDone && this->param != NULL) {
46  //delete this->param;
47  //}
48 }
49 
51  //We don't want to unmarshal the buffer is empty.
52  if(msh_size <= MSH_HEADER_SIZE) {
53  //This is buggy, we can't always assume that
54  //obj == NULL <==> List is empty.
55  return NULL;
56  } else {
57  {
58  param = new G4String();
59  }
61  this->msh_isUnmarshalDone = true;
62  unmarshal1();
63  return this->param;
64  }
65 }
66 
67 void unmarshalTo(G4String* obj) {
68  //We don't want to unmarshal the buffer is empty.
69  if(msh_size <= MSH_HEADER_SIZE) {
70  //This is buggy, we can't always assume that
71  //obj == NULL <==> List is empty.
72  return;
73  } else {
74  this->param = obj;
76  this->msh_isUnmarshalDone = true;
77  unmarshal1();
78  }
79 }
80 
81 void marshal1() {
82  //declare field_size to be the size of this field
83  int msh_currentSize = 0;
84  if (isUnmarshaling())
85  throw "Tried to marshal in obj marked isUnmarshaling == true";
86 
87  //Copy the sizespec into msh_currentSize here:
88  {
89  int size = param->size()+1;
90  while(size%8) size++;
91  msh_currentSize = size;
92  }
93 
94  //Increase the size of buffer if needed
95  EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
96  // 4 bytes for the total size of field, 4 bytes for the number of
97  // elements in the array (in the case of array marshaling)
98  //Mark the beginning position for this field, will write the total size
99  //of this field here later
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
121 }
122 
123 void unmarshal1() {
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* sc = new G4String(msh_cursor);
132  memcpy(param, sc, sizeof(G4String));
133 
134  }
135  msh_cursor += msh_currentSize;
136 }
137 
138 };
139 #endif
140 
Float_t tmp
#define MSH_SET_TOTALSIZE(X)
#define MSH_SET_TYPECHOICE(X)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
MarshaledG4String(void *buf, char chIsUnmarshaling= 'u')
#define MSH_HEADER_SIZE
ShadowedMarshaledG4String * Shadowed_param
void EXTEND_BUFFER(int size)