Import Geant4 7.0.0 source tree
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: ExN04EMPhysics.hh,v 1.1 2002/03/05 15:22:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: ExN04GeneralPhysics.hh,v 1.1 2002/03/05 15:22:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ExN04HadronPhysics.hh,v 1.3 2003/12/03 14:28:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: ExN04IonPhysics.hh,v 1.2 2003/12/03 14:28:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: ExN04MuonPhysics.hh,v 1.2 2003/12/03 14:28:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: ExN04RunAction.hh,v 1.1 2003/12/03 14:32:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: ExN04SteppingVerbose.hh,v 1.1 2003/12/03 14:32:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// This class manages the verbose outputs in G4SteppingManager.
|
||||
// It inherits from G4SteppingVerbose.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: ExN04VisManager.hh,v 1.1 2003/12/03 14:28:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -0,0 +1,310 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
|
||||
#ifndef MarshaledExN04CalorimeterHit_H
|
||||
#define MarshaledExN04CalorimeterHit_H
|
||||
|
||||
|
||||
#include <ExN04CalorimeterHit.hh>
|
||||
//MSH_include_begin
|
||||
#include "MarshaledG4String.h"
|
||||
//MSH_include_end
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "MarshaledObj.h"
|
||||
|
||||
class MarshaledExN04CalorimeterHit;
|
||||
|
||||
class ShadowedMarshaledExN04CalorimeterHit : public ExN04CalorimeterHit{
|
||||
friend class MarshaledExN04CalorimeterHit;
|
||||
};
|
||||
|
||||
class MarshaledExN04CalorimeterHit : public MarshaledObj {
|
||||
public:
|
||||
ExN04CalorimeterHit* param;
|
||||
ShadowedMarshaledExN04CalorimeterHit* Shadowed_param;
|
||||
public:
|
||||
|
||||
|
||||
// Function implementations
|
||||
|
||||
MarshaledExN04CalorimeterHit(ExN04CalorimeterHit* objptr) : MarshaledObj() {
|
||||
msh_isUnmarshalDone = false;
|
||||
this->param = objptr;
|
||||
this->Shadowed_param = (ShadowedMarshaledExN04CalorimeterHit*)this->param;
|
||||
if (objptr == NULL)
|
||||
return;
|
||||
|
||||
marshal1();
|
||||
marshal2();
|
||||
marshal3();
|
||||
marshal4();
|
||||
}
|
||||
|
||||
MarshaledExN04CalorimeterHit(void *buf, char isUnmarshaling = 'u')
|
||||
: MarshaledObj(buf, isUnmarshaling) {
|
||||
msh_isUnmarshalDone = false;
|
||||
}
|
||||
|
||||
~MarshaledExN04CalorimeterHit() {
|
||||
//if(msh_isUnmarshalDone && this->param != NULL) {
|
||||
//delete this->param;
|
||||
//}
|
||||
}
|
||||
|
||||
ExN04CalorimeterHit* unmarshal() {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return NULL;
|
||||
} else {
|
||||
{
|
||||
param = new ExN04CalorimeterHit();
|
||||
}
|
||||
this->Shadowed_param = (ShadowedMarshaledExN04CalorimeterHit*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
unmarshal2();
|
||||
unmarshal3();
|
||||
unmarshal4();
|
||||
return this->param;
|
||||
}
|
||||
}
|
||||
|
||||
void unmarshalTo(ExN04CalorimeterHit* obj) {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return;
|
||||
} else {
|
||||
this->param = obj;
|
||||
this->Shadowed_param = (ShadowedMarshaledExN04CalorimeterHit*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
unmarshal2();
|
||||
unmarshal3();
|
||||
unmarshal4();
|
||||
}
|
||||
}
|
||||
|
||||
void marshal1() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
msh_currentSize = sizeof(G4int);
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4int anElement;
|
||||
anElement = param->GetZ();
|
||||
memcpy(msh_cursor, &anElement, sizeof(G4int));
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal1() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
G4int anElement;
|
||||
memcpy(&anElement, msh_cursor, sizeof(G4int));
|
||||
param->SetCellID(anElement, param->GetPhi());
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
void marshal2() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
msh_currentSize = sizeof(G4int);
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4int anElement;
|
||||
anElement = param->GetPhi();
|
||||
memcpy(msh_cursor, &anElement, sizeof(G4int));
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal2() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
G4int anElement;
|
||||
memcpy(&anElement, msh_cursor, sizeof(G4int));
|
||||
param->SetCellID(param->GetZ(), anElement);
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
void marshal3() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
msh_currentSize = sizeof(G4double);
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4double anElement;
|
||||
anElement = param->GetEdep();
|
||||
memcpy(msh_cursor, &anElement, sizeof(G4double));
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal3() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
G4double anElement;
|
||||
memcpy(&anElement, msh_cursor, sizeof(G4double));
|
||||
param->SetEdep(anElement);
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
void marshal4() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
msh_currentSize = sizeof(G4ThreeVector);
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4ThreeVector anElement;
|
||||
anElement = param->GetPos();
|
||||
memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector));
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal4() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
G4ThreeVector anElement;
|
||||
memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector));
|
||||
param->SetPos(anElement);
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
|
||||
#ifndef MarshaledExN04MuonHit_H
|
||||
#define MarshaledExN04MuonHit_H
|
||||
|
||||
|
||||
#include <ExN04MuonHit.hh>
|
||||
//MSH_include_begin
|
||||
#include "MarshaledG4String.h"
|
||||
//MSH_include_end
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "MarshaledObj.h"
|
||||
|
||||
class MarshaledExN04MuonHit;
|
||||
|
||||
class ShadowedMarshaledExN04MuonHit : public ExN04MuonHit{
|
||||
friend class MarshaledExN04MuonHit;
|
||||
};
|
||||
|
||||
class MarshaledExN04MuonHit : public MarshaledObj {
|
||||
public:
|
||||
ExN04MuonHit* param;
|
||||
ShadowedMarshaledExN04MuonHit* Shadowed_param;
|
||||
public:
|
||||
|
||||
|
||||
// Function implementations
|
||||
|
||||
MarshaledExN04MuonHit(ExN04MuonHit* objptr) : MarshaledObj() {
|
||||
msh_isUnmarshalDone = false;
|
||||
this->param = objptr;
|
||||
this->Shadowed_param = (ShadowedMarshaledExN04MuonHit*)this->param;
|
||||
if (objptr == NULL)
|
||||
return;
|
||||
|
||||
marshal1();
|
||||
marshal2();
|
||||
}
|
||||
|
||||
MarshaledExN04MuonHit(void *buf, char isUnmarshaling = 'u')
|
||||
: MarshaledObj(buf, isUnmarshaling) {
|
||||
msh_isUnmarshalDone = false;
|
||||
}
|
||||
|
||||
~MarshaledExN04MuonHit() {
|
||||
//if(msh_isUnmarshalDone && this->param != NULL) {
|
||||
//delete this->param;
|
||||
//}
|
||||
}
|
||||
|
||||
ExN04MuonHit* unmarshal() {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return NULL;
|
||||
} else {
|
||||
{
|
||||
param = new ExN04MuonHit();
|
||||
}
|
||||
this->Shadowed_param = (ShadowedMarshaledExN04MuonHit*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
unmarshal2();
|
||||
return this->param;
|
||||
}
|
||||
}
|
||||
|
||||
void unmarshalTo(ExN04MuonHit* obj) {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return;
|
||||
} else {
|
||||
this->param = obj;
|
||||
this->Shadowed_param = (ShadowedMarshaledExN04MuonHit*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
unmarshal2();
|
||||
}
|
||||
}
|
||||
|
||||
void marshal1() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
msh_currentSize = sizeof(G4double);
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4double anElement;
|
||||
anElement = param->GetEdep();
|
||||
memcpy(msh_cursor, &anElement, sizeof(G4double));
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal1() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
G4double anElement;
|
||||
memcpy(&anElement, msh_cursor, sizeof(G4double));
|
||||
param->SetEdep(anElement);
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
void marshal2() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
msh_currentSize = sizeof(G4ThreeVector);
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4ThreeVector anElement;
|
||||
anElement = param->GetPos();
|
||||
memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector));
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal2() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
G4ThreeVector anElement;
|
||||
memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector));
|
||||
param->SetPos(anElement);
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
|
||||
#ifndef MarshaledExN04TrackerHit_H
|
||||
#define MarshaledExN04TrackerHit_H
|
||||
|
||||
|
||||
#include <ExN04TrackerHit.hh>
|
||||
//MSH_include_begin
|
||||
#include "MarshaledG4String.h"
|
||||
//MSH_include_end
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "MarshaledObj.h"
|
||||
|
||||
class MarshaledExN04TrackerHit;
|
||||
|
||||
class ShadowedMarshaledExN04TrackerHit : public ExN04TrackerHit{
|
||||
friend class MarshaledExN04TrackerHit;
|
||||
};
|
||||
|
||||
class MarshaledExN04TrackerHit : public MarshaledObj {
|
||||
public:
|
||||
ExN04TrackerHit* param;
|
||||
ShadowedMarshaledExN04TrackerHit* Shadowed_param;
|
||||
public:
|
||||
|
||||
|
||||
// Function implementations
|
||||
|
||||
MarshaledExN04TrackerHit(ExN04TrackerHit* objptr) : MarshaledObj() {
|
||||
msh_isUnmarshalDone = false;
|
||||
this->param = objptr;
|
||||
this->Shadowed_param = (ShadowedMarshaledExN04TrackerHit*)this->param;
|
||||
if (objptr == NULL)
|
||||
return;
|
||||
|
||||
marshal1();
|
||||
marshal2();
|
||||
}
|
||||
|
||||
MarshaledExN04TrackerHit(void *buf, char isUnmarshaling = 'u')
|
||||
: MarshaledObj(buf, isUnmarshaling) {
|
||||
msh_isUnmarshalDone = false;
|
||||
}
|
||||
|
||||
~MarshaledExN04TrackerHit() {
|
||||
//if(msh_isUnmarshalDone && this->param != NULL) {
|
||||
//delete this->param;
|
||||
//}
|
||||
}
|
||||
|
||||
ExN04TrackerHit* unmarshal() {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return NULL;
|
||||
} else {
|
||||
{
|
||||
param = new ExN04TrackerHit();
|
||||
}
|
||||
this->Shadowed_param = (ShadowedMarshaledExN04TrackerHit*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
unmarshal2();
|
||||
return this->param;
|
||||
}
|
||||
}
|
||||
|
||||
void unmarshalTo(ExN04TrackerHit* obj) {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return;
|
||||
} else {
|
||||
this->param = obj;
|
||||
this->Shadowed_param = (ShadowedMarshaledExN04TrackerHit*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
unmarshal2();
|
||||
}
|
||||
}
|
||||
|
||||
void marshal1() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
msh_currentSize = sizeof(G4ThreeVector);
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4ThreeVector anElement;
|
||||
anElement = param->GetPos();
|
||||
memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector));
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal1() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
G4ThreeVector anElement;
|
||||
memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector));
|
||||
param->SetPos(anElement);
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
void marshal2() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
msh_currentSize = sizeof(G4double);
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4double anElement;
|
||||
anElement = param->GetEdep();
|
||||
memcpy(msh_cursor, &anElement, sizeof(G4double));
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal2() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
G4double anElement;
|
||||
memcpy(&anElement, msh_cursor, sizeof(G4double));
|
||||
param->SetEdep(anElement);
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
|
||||
#ifndef MarshaledG4HCofThisEvent_H
|
||||
#define MarshaledG4HCofThisEvent_H
|
||||
|
||||
|
||||
#include <G4HCofThisEvent.hh>
|
||||
//MSH_include_begin
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "ExN04TrackerHit.hh"
|
||||
#include "MarshaledExN04TrackerHit.h"
|
||||
#include "MarshaledG4THitsCollection.h"
|
||||
#include "MarshaledG4VHitsCollection.h"
|
||||
//MSH_include_end
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "MarshaledObj.h"
|
||||
|
||||
class MarshaledG4HCofThisEvent;
|
||||
|
||||
class ShadowedMarshaledG4HCofThisEvent : public G4HCofThisEvent{
|
||||
friend class MarshaledG4HCofThisEvent;
|
||||
};
|
||||
|
||||
class MarshaledG4HCofThisEvent : public MarshaledObj {
|
||||
public:
|
||||
G4HCofThisEvent* param;
|
||||
ShadowedMarshaledG4HCofThisEvent* Shadowed_param;
|
||||
public:
|
||||
|
||||
|
||||
// Function implementations
|
||||
|
||||
MarshaledG4HCofThisEvent(G4HCofThisEvent* objptr) : MarshaledObj() {
|
||||
msh_isUnmarshalDone = false;
|
||||
this->param = objptr;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4HCofThisEvent*)this->param;
|
||||
if (objptr == NULL)
|
||||
return;
|
||||
|
||||
marshal1();
|
||||
}
|
||||
|
||||
MarshaledG4HCofThisEvent(void *buf, char isUnmarshaling = 'u')
|
||||
: MarshaledObj(buf, isUnmarshaling) {
|
||||
msh_isUnmarshalDone = false;
|
||||
}
|
||||
|
||||
~MarshaledG4HCofThisEvent() {
|
||||
//if(msh_isUnmarshalDone && this->param != NULL) {
|
||||
//delete this->param;
|
||||
//}
|
||||
}
|
||||
|
||||
G4HCofThisEvent* unmarshal() {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return NULL;
|
||||
} else {
|
||||
{
|
||||
param = new G4HCofThisEvent();
|
||||
}
|
||||
this->Shadowed_param = (ShadowedMarshaledG4HCofThisEvent*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
return this->param;
|
||||
}
|
||||
}
|
||||
|
||||
void unmarshalTo(G4HCofThisEvent* obj) {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return;
|
||||
} else {
|
||||
this->param = obj;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4HCofThisEvent*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
}
|
||||
}
|
||||
|
||||
void marshal1() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
int copy_off = 0;
|
||||
int elementNum;
|
||||
elementNum = param->GetNumberOfCollections();
|
||||
memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int index=0;index<elementNum;index++){
|
||||
G4VHitsCollection* anElement;
|
||||
anElement = param->GetHC(index);
|
||||
MarshaledG4VHitsCollection marEle(anElement);
|
||||
EXTEND_BUFFER(marEle.getBufferSize());
|
||||
memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
|
||||
copy_off += marEle.getBufferSize();
|
||||
}
|
||||
msh_currentSize = copy_off;
|
||||
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal1() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
int copy_off = 0;
|
||||
int elementNum;
|
||||
memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int index=0;index<elementNum;index++){
|
||||
MarshaledG4VHitsCollection marEle(msh_cursor+copy_off);
|
||||
G4VHitsCollection* anElement = (G4VHitsCollection*)marEle.unmarshal();
|
||||
copy_off += marEle.getBufferSize();
|
||||
param->AddHitsCollection(index, anElement);
|
||||
}
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
|
||||
#ifndef MarshaledG4String_H
|
||||
#define MarshaledG4String_H
|
||||
|
||||
|
||||
#include <G4String.hh>
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "MarshaledObj.h"
|
||||
|
||||
class MarshaledG4String;
|
||||
|
||||
class ShadowedMarshaledG4String : public G4String{
|
||||
friend class MarshaledG4String;
|
||||
};
|
||||
|
||||
class MarshaledG4String : public MarshaledObj {
|
||||
public:
|
||||
G4String* param;
|
||||
ShadowedMarshaledG4String* Shadowed_param;
|
||||
public:
|
||||
|
||||
|
||||
// Function implementations
|
||||
|
||||
MarshaledG4String(G4String* objptr) : MarshaledObj() {
|
||||
msh_isUnmarshalDone = false;
|
||||
this->param = objptr;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4String*)this->param;
|
||||
if (objptr == NULL)
|
||||
return;
|
||||
|
||||
marshal1();
|
||||
}
|
||||
|
||||
MarshaledG4String(void *buf, char isUnmarshaling = 'u')
|
||||
: MarshaledObj(buf, isUnmarshaling) {
|
||||
msh_isUnmarshalDone = false;
|
||||
}
|
||||
|
||||
~MarshaledG4String() {
|
||||
//if(msh_isUnmarshalDone && this->param != NULL) {
|
||||
//delete this->param;
|
||||
//}
|
||||
}
|
||||
|
||||
G4String* unmarshal() {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return NULL;
|
||||
} else {
|
||||
{
|
||||
param = new G4String();
|
||||
}
|
||||
this->Shadowed_param = (ShadowedMarshaledG4String*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
return this->param;
|
||||
}
|
||||
}
|
||||
|
||||
void unmarshalTo(G4String* obj) {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return;
|
||||
} else {
|
||||
this->param = obj;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4String*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
}
|
||||
}
|
||||
|
||||
void marshal1() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
int size = param->size()+1;
|
||||
while(size%8) size++;
|
||||
msh_currentSize = size;
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
memcpy(msh_cursor, param->c_str(), param->size());
|
||||
*(msh_cursor+param->size()) = '\0';
|
||||
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal1() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
G4String* s = new G4String(msh_cursor);
|
||||
memcpy(param, s, sizeof(G4String));
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,381 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
|
||||
#ifndef MarshaledG4HitsCollection_H
|
||||
#define MarshaledG4HitsCollection_H
|
||||
|
||||
|
||||
#include <G4THitsCollection.hh>
|
||||
//MSH_include_begin
|
||||
#include "ExN04CalorimeterHit.hh"
|
||||
#include "ExN04MuonHit.hh"
|
||||
#include "ExN04TrackerHit.hh"
|
||||
#include "MarshaledExN04CalorimeterHit.h"
|
||||
#include "MarshaledExN04MuonHit.h"
|
||||
#include "MarshaledExN04TrackerHit.h"
|
||||
//MSH_include_end
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "MarshaledObj.h"
|
||||
|
||||
class MarshaledG4HitsCollection;
|
||||
|
||||
class ShadowedMarshaledG4HitsCollection : public G4HitsCollection{
|
||||
friend class MarshaledG4HitsCollection;
|
||||
};
|
||||
|
||||
|
||||
template <class T> class MarshaledG4THitsCollection;
|
||||
|
||||
template <class T> class ShadowedMarshaledG4THitsCollection : public G4THitsCollection<T>{
|
||||
friend class MarshaledG4THitsCollection<T>;
|
||||
};
|
||||
|
||||
class MarshaledG4HitsCollection : public MarshaledObj {
|
||||
public:
|
||||
G4HitsCollection* param;
|
||||
ShadowedMarshaledG4HitsCollection* Shadowed_param;
|
||||
public:
|
||||
|
||||
|
||||
// Function implementations
|
||||
|
||||
MarshaledG4HitsCollection(G4HitsCollection* objptr) : MarshaledObj() {
|
||||
msh_isUnmarshalDone = false;
|
||||
this->param = objptr;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
|
||||
if (objptr == NULL)
|
||||
return;
|
||||
|
||||
marshal1();
|
||||
}
|
||||
|
||||
MarshaledG4HitsCollection(void *buf, char isUnmarshaling = 'u')
|
||||
: MarshaledObj(buf, isUnmarshaling) {
|
||||
msh_isUnmarshalDone = false;
|
||||
}
|
||||
|
||||
~MarshaledG4HitsCollection() {
|
||||
//if(msh_isUnmarshalDone && this->param != NULL) {
|
||||
//delete this->param;
|
||||
//}
|
||||
}
|
||||
|
||||
G4HitsCollection* unmarshal() {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return NULL;
|
||||
} else {
|
||||
{
|
||||
param = new G4HitsCollection();
|
||||
}
|
||||
this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
return this->param;
|
||||
}
|
||||
}
|
||||
|
||||
void unmarshalTo(G4HitsCollection* obj) {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return;
|
||||
} else {
|
||||
this->param = obj;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
}
|
||||
}
|
||||
|
||||
void marshal1() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
int copy_off = 0;
|
||||
int elementNum;
|
||||
|
||||
if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
||||
elementNum = ((G4THitsCollection<ExN04CalorimeterHit>*)param)->entries();
|
||||
else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
||||
elementNum = ((G4THitsCollection<ExN04MuonHit>*)param)->entries();
|
||||
else
|
||||
elementNum = ((G4THitsCollection<ExN04TrackerHit>*)param)->entries();
|
||||
|
||||
memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int index=0;index<elementNum;index++){
|
||||
if(0){}
|
||||
else if((dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL) ){
|
||||
void* anElement;
|
||||
|
||||
if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
||||
anElement = (*((G4THitsCollection<ExN04CalorimeterHit>*)param))[index];
|
||||
else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
||||
anElement = (*((G4THitsCollection<ExN04MuonHit>*)param))[index];
|
||||
else
|
||||
anElement = (*((G4THitsCollection<ExN04TrackerHit>*)param))[index];
|
||||
|
||||
MarshaledExN04CalorimeterHit marEle((ExN04CalorimeterHit* )anElement);
|
||||
EXTEND_BUFFER(marEle.getBufferSize());
|
||||
memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
|
||||
copy_off += marEle.getBufferSize();
|
||||
}
|
||||
else if( (dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL) ){
|
||||
void* anElement;
|
||||
|
||||
if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
||||
anElement = (*((G4THitsCollection<ExN04CalorimeterHit>*)param))[index];
|
||||
else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
||||
anElement = (*((G4THitsCollection<ExN04MuonHit>*)param))[index];
|
||||
else
|
||||
anElement = (*((G4THitsCollection<ExN04TrackerHit>*)param))[index];
|
||||
|
||||
MarshaledExN04MuonHit marEle((ExN04MuonHit* )anElement);
|
||||
EXTEND_BUFFER(marEle.getBufferSize());
|
||||
memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
|
||||
copy_off += marEle.getBufferSize();
|
||||
}
|
||||
else if( true ){
|
||||
void* anElement;
|
||||
|
||||
if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
||||
anElement = (*((G4THitsCollection<ExN04CalorimeterHit>*)param))[index];
|
||||
else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
||||
anElement = (*((G4THitsCollection<ExN04MuonHit>*)param))[index];
|
||||
else
|
||||
anElement = (*((G4THitsCollection<ExN04TrackerHit>*)param))[index];
|
||||
|
||||
MarshaledExN04TrackerHit marEle((ExN04TrackerHit*)anElement);
|
||||
EXTEND_BUFFER(marEle.getBufferSize());
|
||||
memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
|
||||
copy_off += marEle.getBufferSize();
|
||||
}
|
||||
}
|
||||
msh_currentSize = copy_off;
|
||||
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal1() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
if(0){}
|
||||
else if((dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL) ){
|
||||
int copy_off = 0;
|
||||
int elementNum;
|
||||
memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int index=0;index<elementNum;index++){
|
||||
MarshaledExN04CalorimeterHit marEle(msh_cursor+copy_off);
|
||||
ExN04CalorimeterHit* anElement = (ExN04CalorimeterHit* )marEle.unmarshal();
|
||||
copy_off += marEle.getBufferSize();
|
||||
|
||||
if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
||||
((G4THitsCollection<ExN04CalorimeterHit>*)param)->insert((ExN04CalorimeterHit*)anElement);
|
||||
else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
||||
((G4THitsCollection<ExN04MuonHit>*)param)->insert((ExN04MuonHit*)anElement);
|
||||
else
|
||||
((G4THitsCollection<ExN04TrackerHit>*)param)->insert((ExN04TrackerHit*)anElement);
|
||||
|
||||
}
|
||||
}
|
||||
else if( (dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL) ){
|
||||
int copy_off = 0;
|
||||
int elementNum;
|
||||
memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int index=0;index<elementNum;index++){
|
||||
MarshaledExN04MuonHit marEle(msh_cursor+copy_off);
|
||||
ExN04MuonHit* anElement = (ExN04MuonHit* )marEle.unmarshal();
|
||||
copy_off += marEle.getBufferSize();
|
||||
|
||||
if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
||||
((G4THitsCollection<ExN04CalorimeterHit>*)param)->insert((ExN04CalorimeterHit*)anElement);
|
||||
else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
||||
((G4THitsCollection<ExN04MuonHit>*)param)->insert((ExN04MuonHit*)anElement);
|
||||
else
|
||||
((G4THitsCollection<ExN04TrackerHit>*)param)->insert((ExN04TrackerHit*)anElement);
|
||||
|
||||
}
|
||||
}
|
||||
else if( true ){
|
||||
int copy_off = 0;
|
||||
int elementNum;
|
||||
memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int index=0;index<elementNum;index++){
|
||||
MarshaledExN04TrackerHit marEle(msh_cursor+copy_off);
|
||||
ExN04TrackerHit* anElement = (ExN04TrackerHit*)marEle.unmarshal();
|
||||
copy_off += marEle.getBufferSize();
|
||||
|
||||
if(dynamic_cast<G4THitsCollection<ExN04CalorimeterHit>*>(param)!=NULL)
|
||||
((G4THitsCollection<ExN04CalorimeterHit>*)param)->insert((ExN04CalorimeterHit*)anElement);
|
||||
else if(dynamic_cast<G4THitsCollection<ExN04MuonHit>*>(param)!=NULL)
|
||||
((G4THitsCollection<ExN04MuonHit>*)param)->insert((ExN04MuonHit*)anElement);
|
||||
else
|
||||
((G4THitsCollection<ExN04TrackerHit>*)param)->insert((ExN04TrackerHit*)anElement);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
};
|
||||
template <class T> class MarshaledG4THitsCollection : public MarshaledObj {
|
||||
public:
|
||||
G4THitsCollection<T>* param;
|
||||
ShadowedMarshaledG4THitsCollection<T>* Shadowed_param;
|
||||
public:
|
||||
|
||||
|
||||
// Function implementations
|
||||
|
||||
MarshaledG4THitsCollection(G4THitsCollection<T>* objptr) : MarshaledObj() {
|
||||
msh_isUnmarshalDone = false;
|
||||
this->param = objptr;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
|
||||
if (objptr == NULL)
|
||||
return;
|
||||
|
||||
marshal1();
|
||||
}
|
||||
|
||||
MarshaledG4THitsCollection(void *buf, char isUnmarshaling = 'u')
|
||||
: MarshaledObj(buf, isUnmarshaling) {
|
||||
msh_isUnmarshalDone = false;
|
||||
}
|
||||
|
||||
~MarshaledG4THitsCollection() {
|
||||
//if(msh_isUnmarshalDone && this->param != NULL) {
|
||||
//delete this->param;
|
||||
//}
|
||||
}
|
||||
|
||||
G4THitsCollection<T>* unmarshal() {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return NULL;
|
||||
} else {
|
||||
{
|
||||
param = new G4THitsCollection<T>();
|
||||
}
|
||||
this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
return this->param;
|
||||
}
|
||||
}
|
||||
|
||||
void unmarshalTo(G4THitsCollection<T>* obj) {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return;
|
||||
} else {
|
||||
this->param = obj;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
}
|
||||
}
|
||||
|
||||
void marshal1() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
//code for size, just dummy code because the size will be set correctly at the end of marshaling code
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
MarshaledG4HitsCollection marParent(param);
|
||||
EXTEND_BUFFER(marParent.getBufferSize());
|
||||
memcpy(msh_cursor,marParent.getBuffer(), marParent.getBufferSize());
|
||||
msh_currentSize = marParent.getBufferSize();
|
||||
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal1() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
MarshaledG4HitsCollection marObj(msh_cursor);
|
||||
marObj.unmarshalTo(param);
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
|
||||
#ifndef MarshaledG4VHitsCollection_H
|
||||
#define MarshaledG4VHitsCollection_H
|
||||
|
||||
|
||||
#include <G4VHitsCollection.hh>
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "MarshaledObj.h"
|
||||
|
||||
class MarshaledG4VHitsCollection;
|
||||
|
||||
class ShadowedMarshaledG4VHitsCollection : public G4VHitsCollection{
|
||||
friend class MarshaledG4VHitsCollection;
|
||||
};
|
||||
|
||||
class MarshaledG4VHitsCollection : public MarshaledObj {
|
||||
public:
|
||||
G4VHitsCollection* param;
|
||||
ShadowedMarshaledG4VHitsCollection* Shadowed_param;
|
||||
public:
|
||||
|
||||
|
||||
// Function implementations
|
||||
|
||||
MarshaledG4VHitsCollection(G4VHitsCollection* objptr) : MarshaledObj() {
|
||||
msh_isUnmarshalDone = false;
|
||||
this->param = objptr;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
|
||||
if (objptr == NULL)
|
||||
return;
|
||||
|
||||
marshal1();
|
||||
marshal2();
|
||||
marshal3();
|
||||
}
|
||||
|
||||
MarshaledG4VHitsCollection(void *buf, char isUnmarshaling = 'u')
|
||||
: MarshaledObj(buf, isUnmarshaling) {
|
||||
msh_isUnmarshalDone = false;
|
||||
}
|
||||
|
||||
~MarshaledG4VHitsCollection() {
|
||||
//if(msh_isUnmarshalDone && this->param != NULL) {
|
||||
//delete this->param;
|
||||
//}
|
||||
}
|
||||
|
||||
G4VHitsCollection* unmarshal() {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return NULL;
|
||||
} else {
|
||||
{
|
||||
if(0){}
|
||||
else if(msh_typechoice == 0){
|
||||
param = new G4THitsCollection<ExN04CalorimeterHit>("","");
|
||||
}
|
||||
else if(msh_typechoice == 1){
|
||||
param = new G4THitsCollection<ExN04MuonHit>("","");
|
||||
}
|
||||
else if(msh_typechoice == 2){
|
||||
param = new G4THitsCollection<ExN04TrackerHit>("","");
|
||||
}
|
||||
}
|
||||
this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
unmarshal2();
|
||||
unmarshal3();
|
||||
return this->param;
|
||||
}
|
||||
}
|
||||
|
||||
void unmarshalTo(G4VHitsCollection* obj) {
|
||||
//We don't want to unmarshal the buffer is empty.
|
||||
if(msh_size <= MSH_HEADER_SIZE) {
|
||||
//This is buggy, we can't always assume that
|
||||
//obj == NULL <==> List is empty.
|
||||
return;
|
||||
} else {
|
||||
this->param = obj;
|
||||
this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
|
||||
this->msh_isUnmarshalDone = true;
|
||||
unmarshal1();
|
||||
unmarshal2();
|
||||
unmarshal3();
|
||||
}
|
||||
}
|
||||
|
||||
void marshal1() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
// no need to declare size since msh_currentSize is already assigned in the MARSHAL field
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4String anElement;
|
||||
anElement = param->GetName();
|
||||
MarshaledG4String var(&anElement);
|
||||
EXTEND_BUFFER(var.getBufferSize());
|
||||
msh_currentSize = var.getBufferSize();
|
||||
memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal1() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
MarshaledG4String var(msh_cursor, 'u');
|
||||
G4String anElement;
|
||||
var.unmarshalTo(&anElement);
|
||||
Shadowed_param->collectionName=anElement;
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
void marshal2() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
// no need to declare size since msh_currentSize is already assigned in the MARSHAL field
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
G4String anElement;
|
||||
anElement = param->GetSDname();
|
||||
MarshaledG4String var(&anElement);
|
||||
EXTEND_BUFFER(var.getBufferSize());
|
||||
msh_currentSize = var.getBufferSize();
|
||||
memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal2() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
MarshaledG4String var(msh_cursor, 'u');
|
||||
G4String anElement;
|
||||
var.unmarshalTo(&anElement);
|
||||
Shadowed_param->SDname=anElement;
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
void marshal3() {
|
||||
//declare field_size to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in obj marked isUnmarshaling == true";
|
||||
|
||||
//Copy the sizespec into msh_currentSize here:
|
||||
{
|
||||
//code for size, just dummy code because the size will be set correctly at the end of marshaling code
|
||||
|
||||
}
|
||||
|
||||
//Increase the size of buffer if needed
|
||||
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)
|
||||
//Mark the beginning position for this field, will write the total size of this field here later
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//Advance cursor of distance = sizeof(int)
|
||||
msh_cursor += sizeof(int);
|
||||
|
||||
//Now just copy "get" functions here
|
||||
{
|
||||
if(0){}
|
||||
else if((param->GetName() == "calCollection") ){
|
||||
G4THitsCollection<ExN04CalorimeterHit> *aObj949 = (G4THitsCollection<ExN04CalorimeterHit>*)param;
|
||||
MarshaledG4THitsCollection<ExN04CalorimeterHit> marChild(aObj949);
|
||||
EXTEND_BUFFER(marChild.getBufferSize());
|
||||
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
|
||||
msh_currentSize = marChild.getBufferSize();
|
||||
msh_typechoice = 0;
|
||||
}
|
||||
else if( (param->GetName() == "muonCollection") ){
|
||||
G4THitsCollection<ExN04MuonHit> *aObj949 = (G4THitsCollection<ExN04MuonHit>*)param;
|
||||
MarshaledG4THitsCollection<ExN04MuonHit> marChild(aObj949);
|
||||
EXTEND_BUFFER(marChild.getBufferSize());
|
||||
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
|
||||
msh_currentSize = marChild.getBufferSize();
|
||||
msh_typechoice = 1;
|
||||
}
|
||||
else if( true ){
|
||||
G4THitsCollection<ExN04TrackerHit> *aObj949 = (G4THitsCollection<ExN04TrackerHit>*)param;
|
||||
MarshaledG4THitsCollection<ExN04TrackerHit> marChild(aObj949);
|
||||
EXTEND_BUFFER(marChild.getBufferSize());
|
||||
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
|
||||
msh_currentSize = marChild.getBufferSize();
|
||||
msh_typechoice = 2;
|
||||
}
|
||||
|
||||
}
|
||||
//Now advance the cursor
|
||||
msh_cursor += msh_currentSize;
|
||||
//Now set the size of this field
|
||||
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
|
||||
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
|
||||
memcpy(msh_field_begin, &tmp, sizeof(int));
|
||||
|
||||
//Now set msh_size
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
}
|
||||
|
||||
void unmarshal3() {
|
||||
//declare currentSize to be the size of this field
|
||||
int msh_currentSize = 0;
|
||||
//copy the size of the current field into currentSize
|
||||
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
//Now copy the setspec here
|
||||
{
|
||||
if(0){}
|
||||
else if(msh_typechoice == 0){
|
||||
MarshaledG4THitsCollection<ExN04CalorimeterHit> marObj(msh_cursor);
|
||||
marObj.unmarshalTo((G4THitsCollection<ExN04CalorimeterHit>*)param);
|
||||
}
|
||||
else if(msh_typechoice == 1){
|
||||
MarshaledG4THitsCollection<ExN04MuonHit> marObj(msh_cursor);
|
||||
marObj.unmarshalTo((G4THitsCollection<ExN04MuonHit>*)param);
|
||||
}
|
||||
else if(msh_typechoice == 2){
|
||||
MarshaledG4THitsCollection<ExN04TrackerHit> marObj(msh_cursor);
|
||||
marObj.unmarshalTo((G4THitsCollection<ExN04TrackerHit>*)param);
|
||||
}
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
/**********************************************************************
|
||||
* Parallel Library for Geant4 *
|
||||
* Copyright (c) 2001 Gene Cooperman <gene@ccs.neu.edu> *
|
||||
* *
|
||||
* This library is free software distributed under the GNU *
|
||||
* Lesser General Public License. See the file COPYING for details. *
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef PARMARSHALEDOBJ_H
|
||||
#define PARMARSHALEDOBJ_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define MSH_ASSERT(X) {assert(X);}
|
||||
|
||||
#define MSH_HEADER_SIZE (sizeof(int)*2)
|
||||
// the first field (first sizeof(int) bytes) contains the $TYPE_CHOICE
|
||||
// the second field contains the size including the header
|
||||
#define MSH_TOTALSIZE_OFFSET (sizeof(int))
|
||||
#define MSH_TYPECHOICE_OFFSET 0
|
||||
|
||||
#define MSH_SET_TYPECHOICE(X) { memcpy(msh_buffer+MSH_TYPECHOICE_OFFSET,&(X),sizeof(int));}
|
||||
#define MSH_SET_TOTALSIZE(X) { memcpy(msh_buffer+MSH_TOTALSIZE_OFFSET,&(X),sizeof(int));}
|
||||
#define MSH_GET_TYPECHOICE(X,BUF) { memcpy(&(X), ((char*)BUF)+MSH_TYPECHOICE_OFFSET,sizeof(int));}
|
||||
#define MSH_GET_TOTALSIZE(X,BUF) { memcpy(&(X), ((char*)BUF)+MSH_TOTALSIZE_OFFSET,sizeof(int));}
|
||||
|
||||
|
||||
class MarshaledObj {
|
||||
private:
|
||||
// Make sure all marshaled objects are word aligned.
|
||||
static const int WORD_SIZE = sizeof(long);
|
||||
public:
|
||||
static int ROUND_UP( int x ){
|
||||
return (((x)+(WORD_SIZE-1)) / WORD_SIZE) * WORD_SIZE;
|
||||
}
|
||||
|
||||
public:
|
||||
// Constructs an empty MarshaledObj,
|
||||
MarshaledObj(){
|
||||
msh_extent = 128;
|
||||
msh_size = MSH_HEADER_SIZE;
|
||||
msh_isUnmarshalDone = false;
|
||||
|
||||
msh_buffer = (char *)malloc(msh_extent);
|
||||
MSH_ASSERT(msh_buffer);
|
||||
|
||||
msh_cursor = msh_buffer + MSH_HEADER_SIZE;
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
msh_typechoice = 0;
|
||||
int totalsize = msh_cursor-msh_buffer;
|
||||
|
||||
MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
MSH_SET_TOTALSIZE(totalsize);
|
||||
}
|
||||
|
||||
//MarshaledObj(void *buf);
|
||||
// This constructs a MarshledObj from a buffer (of type char*) for unmarshaling.
|
||||
// buf is obtain from an already marshaled object.
|
||||
// The first field of buf must be an int that contains the size of the buf
|
||||
// NOT including itself.
|
||||
// isUnmarshaling must be 'u' (for unmarshaling) .
|
||||
MarshaledObj(void *buf, char isUnmarshaling) {
|
||||
msh_isUnmarshalDone = false;
|
||||
|
||||
if(isUnmarshaling != 'u') {
|
||||
printf("MarshaledObj(void*, char): wrong argument\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//msh_extent = ROUND_UP(*(int *)buf + sizeof(int));
|
||||
MSH_GET_TYPECHOICE(msh_typechoice,buf);
|
||||
|
||||
MSH_GET_TOTALSIZE(msh_size,buf);
|
||||
msh_extent = ROUND_UP(msh_size);
|
||||
|
||||
msh_buffer = (char *)malloc(msh_extent);
|
||||
MSH_ASSERT(msh_buffer);
|
||||
|
||||
memcpy(msh_buffer, (char *)buf, msh_extent);
|
||||
msh_cursor = msh_buffer + MSH_HEADER_SIZE;
|
||||
msh_field_begin = msh_cursor;
|
||||
|
||||
//MSH_SET_TYPECHOICE(msh_typechoice);
|
||||
|
||||
}
|
||||
|
||||
~MarshaledObj() {
|
||||
if ( ! isUnmarshaling() )
|
||||
free(msh_buffer);
|
||||
}
|
||||
|
||||
inline bool isUnmarshaling() {
|
||||
return (msh_extent <= 0);
|
||||
}
|
||||
|
||||
private:
|
||||
// Dont use copy constructor
|
||||
const MarshaledObj& operator=(const MarshaledObj& right);
|
||||
|
||||
protected:
|
||||
int msh_typechoice; // alias of $TYPE_CHOICE
|
||||
|
||||
// points to the buffer (header+body)
|
||||
char *msh_buffer;
|
||||
|
||||
// msh_field_begin points to the size of the current field being marshaled
|
||||
char* msh_field_begin;
|
||||
|
||||
// msh_size contains the total size of msh_buffer. i.e.,
|
||||
int msh_size;
|
||||
|
||||
// msh_cursor points to the next field to be marshaled.
|
||||
char *msh_cursor;
|
||||
|
||||
// msh_extent is the total allocated space for msh_buffer.
|
||||
// msh_extent is always >= msh_size
|
||||
int msh_extent;
|
||||
|
||||
bool msh_isUnmarshalDone; //Is unmarshaling done yet?
|
||||
|
||||
public:
|
||||
inline void EXTEND_BUFFER(int size){
|
||||
msh_size += size;
|
||||
if(msh_size > msh_extent){
|
||||
resizeBuffer(msh_size);
|
||||
}
|
||||
}
|
||||
|
||||
void resizeBuffer(int new_size ) {
|
||||
int msh_displacement = msh_cursor - msh_buffer;
|
||||
int field_displacement = msh_field_begin - msh_buffer;
|
||||
|
||||
while(new_size > msh_extent)
|
||||
msh_extent *= 2;
|
||||
|
||||
msh_buffer = (char *)realloc( msh_buffer, msh_extent);
|
||||
MSH_ASSERT(msh_buffer);
|
||||
|
||||
msh_cursor = msh_buffer + msh_displacement;
|
||||
msh_field_begin = msh_buffer + field_displacement;
|
||||
}
|
||||
|
||||
public:
|
||||
// Returns the total size of buffer
|
||||
inline int getBufferSize() {
|
||||
return msh_size;
|
||||
}
|
||||
|
||||
inline char *getBuffer() {
|
||||
return msh_buffer;
|
||||
}
|
||||
|
||||
/* p: pointer to the data field, size: size of that primitive data field */
|
||||
void marshalPrimitive(void* p, int size) {
|
||||
int msh_currentSize;
|
||||
if (isUnmarshaling())
|
||||
throw "Tried to marshal in object marked isUnmarshaling = true";
|
||||
msh_currentSize = size;
|
||||
EXTEND_BUFFER(msh_currentSize + sizeof(int));
|
||||
|
||||
// *(int *)msh_cursor = msh_currentSize;
|
||||
memcpy(msh_cursor, &msh_currentSize, sizeof(int));
|
||||
msh_cursor += sizeof(int);
|
||||
memcpy(msh_cursor, p, size);
|
||||
msh_cursor += msh_currentSize;
|
||||
msh_size = msh_cursor - msh_buffer;
|
||||
|
||||
MSH_SET_TOTALSIZE(msh_size);
|
||||
}
|
||||
|
||||
void unmarshalPrimitive(void* p, int size) {
|
||||
int msh_currentSize;
|
||||
//memcpy(&msh_currentSize, msh_cursor, sizeof(int));
|
||||
/* in case *msh_cursor is invalid, use "size" not to crash the memory */
|
||||
msh_currentSize = size;
|
||||
msh_cursor += sizeof(int);
|
||||
memcpy(p, msh_cursor, msh_currentSize);
|
||||
msh_cursor += msh_currentSize;
|
||||
//msh_size = msh_cursor - msh_buffer;
|
||||
}
|
||||
};
|
||||
|
||||
/* Used for distinguish the class types of the template parameter
|
||||
vietha 2003.05.01 */
|
||||
template <class T,class>
|
||||
class MSH_IsSameClass
|
||||
{
|
||||
public:
|
||||
enum {Is = 0};
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class MSH_IsSameClass<T,T>
|
||||
{
|
||||
public:
|
||||
enum {Is = 1};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,148 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ParExMarshaledHits.hh,v 1.1 2002/03/05 15:22:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef ParExMarshaledHits_h
|
||||
#define ParExMarshaledHits_h 1
|
||||
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "ParMarshaledObj.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
// Calling sequence:
|
||||
// MarshaledHCofThisEvent::MarshaledHCofThisEvent()
|
||||
// -> MarshaledHCofThisEvent::MarshalHitsCollection
|
||||
// (G4VHitsCollection * aBaseHC, G4String HCname)
|
||||
// -> TMarshaledHitsCollection<T>::Marshal(G4VHitsCollection * aBaseHC)
|
||||
// -> TMarshaledHitsCollection<T>::MarshalHit(T *aHit)
|
||||
// MarshaledHCofThisEvent::UnmarshalSlaveHCofThisEvent()
|
||||
// -> TMarshaledHitsCollection<T>::UnmarshalSlaveHitsCollection
|
||||
// (G4String HCname, G4String SDname)
|
||||
// -> TMarshaledHitsCollection<T>::Unmarshal(G4THitsCollection<T> * aHC)
|
||||
// -> TMarshaledHitsCollection<T>::UnmarshalHit(T * aHit)
|
||||
|
||||
// class T derived from G4VHit
|
||||
template <class T> class TMarshaledHitsCollection
|
||||
: public MarshaledObj
|
||||
{
|
||||
public:
|
||||
inline void Marshal(G4VHitsCollection * aBaseHC); // Marshal hits of aBaseHC
|
||||
|
||||
inline void UnmarshalSlaveHitsCollection(G4String & HCname, G4String & SDname);
|
||||
inline void Unmarshal(G4THitsCollection<T> * aHC);
|
||||
|
||||
// By default, we a hit of type T as a void pointer
|
||||
inline void MarshalHit( T *aHit )
|
||||
{ MarshaledObj::Marshal((void *)aHit, sizeof(*aHit)); }
|
||||
|
||||
// Unmarshal hits into HC for T. By default assume it was marshaled
|
||||
// as a void pointer (ObjPtr)
|
||||
inline void UnmarshalHit(T * aHit)
|
||||
{
|
||||
if (isNewHitsCollection)
|
||||
*aHit = *(T *)MarshaledObj::UnmarshalAsSharedObjPtr();
|
||||
else
|
||||
G4Exception(
|
||||
"Event Level Parallelism: Every hit collection sent to master"
|
||||
" should be new.\n Current hit collection, "
|
||||
+ collectionName + ", is not new.\n"
|
||||
);
|
||||
}
|
||||
|
||||
protected:
|
||||
static G4bool isNewHitsCollection;
|
||||
static G4String collectionName;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
G4bool TMarshaledHitsCollection<T>::isNewHitsCollection = true;
|
||||
|
||||
template <class T>
|
||||
G4String TMarshaledHitsCollection<T>::collectionName = "<not initialized>";
|
||||
|
||||
template <class T>
|
||||
inline void TMarshaledHitsCollection<T>::Marshal(G4VHitsCollection * aBaseHC)
|
||||
{ G4THitsCollection<T> *aHC = (G4THitsCollection<T> *)aBaseHC;
|
||||
G4int numHits = aHC->entries();
|
||||
MarshaledObj::Marshal( numHits );
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "Marshaled numHits: " << numHits << G4endl;
|
||||
#endif
|
||||
for (int j = 0; j < numHits; j++) {
|
||||
T *aHit = (*aHC)[j];
|
||||
MarshalHit( aHit );
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void TMarshaledHitsCollection<T>::Unmarshal
|
||||
(G4THitsCollection<T> * aHC)
|
||||
{
|
||||
G4int numHits;
|
||||
MarshaledObj::Unmarshal( numHits );
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "numHits: " << numHits << G4endl;
|
||||
#endif
|
||||
for (int j = 0; j < numHits; j++) {
|
||||
T *aHit = new T;
|
||||
UnmarshalHit( aHit );
|
||||
aHC->insert( aHit );
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void TMarshaledHitsCollection<T>::UnmarshalSlaveHitsCollection
|
||||
(G4String & HCname, G4String & SDname)
|
||||
{
|
||||
G4HCofThisEvent *HCE = G4RunManager::GetRunManager()->
|
||||
GetCurrentEvent()->
|
||||
GetHCofThisEvent();
|
||||
// Find or create HitsCollection, aHC, with name HCname
|
||||
G4THitsCollection<T> *aHC;
|
||||
// HCname is unique.
|
||||
collectionName = HCname;
|
||||
G4int HCID = G4SDManager::GetSDMpointer()->GetCollectionID(HCname);
|
||||
if (HCID < 0)
|
||||
{ aHC = new G4THitsCollection<T>(SDname, HCname);
|
||||
HCID = G4SDManager::GetSDMpointer()->GetCollectionID(HCname);
|
||||
HCE->AddHitsCollection( HCID, aHC );
|
||||
isNewHitsCollection = true;
|
||||
}
|
||||
else {
|
||||
aHC = (G4THitsCollection<T> *)HCE->GetHC(HCID);
|
||||
isNewHitsCollection = ( aHC->entries() == 0 ? true : false );
|
||||
}
|
||||
|
||||
Unmarshal(aHC);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,275 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ParMarshaledObj.hh,v 1.2 2003/06/16 16:49:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef ParMarshaledObj_h
|
||||
#define ParMarshaledObj_h
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
|
||||
// Geant4 types
|
||||
#include "globals.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
// A MarshaledObj is conceptually a
|
||||
// dynamically resizable buffer, size, and cursor.
|
||||
// Data structure of buffer: <field1, field2, ...>
|
||||
// Note that buffer has no internal construct to determine size of buffer
|
||||
// It is the responsibility of the user to know types of field1, ...
|
||||
// There are two types of MarshaledObj, depending on whether
|
||||
// IsUnmarshaling() is true or false.
|
||||
// I use malloc/free because I can also use realloc to extend the buffer.
|
||||
|
||||
class MarshaledObj {
|
||||
private:
|
||||
// Make sure all marshaled objects are word aligned.
|
||||
static const int WORD_SIZE = sizeof(long);
|
||||
static inline int ROUND_UP( int x )
|
||||
{ return (((x)+(WORD_SIZE-1)) / WORD_SIZE) * WORD_SIZE; }
|
||||
|
||||
public:
|
||||
inline MarshaledObj(int total_size)
|
||||
:extent(ROUND_UP(total_size)),size(0)
|
||||
{ if (extent > 0)
|
||||
buffer = (char *)malloc(extent);
|
||||
else
|
||||
buffer = NULL;
|
||||
cursor = buffer + size;
|
||||
}
|
||||
inline MarshaledObj()
|
||||
:extent(128),size(0)
|
||||
{ buffer = (char *)malloc(extent);
|
||||
cursor = buffer + size;
|
||||
}
|
||||
// this is for an arbitrary buffer; we specify the size explicitly
|
||||
// if buf_len == 0, then we'll be unmarshaling
|
||||
inline MarshaledObj(void *buf, int buf_len = 0)
|
||||
:extent(ROUND_UP(buf_len+sizeof(int))),
|
||||
size(ROUND_UP(buf_len+sizeof(buf_len)))
|
||||
{ if ( buf_len <= 0 ) {
|
||||
extent = size = 0; // IMPLIES: IsUnmarshaling() => true
|
||||
buffer = (char *)buf;
|
||||
cursor = buffer;
|
||||
} else {
|
||||
buffer = (char *)malloc(extent);
|
||||
*(int *)buffer = buf_len;
|
||||
memcpy( buffer+sizeof(int), (char *)buf, extent );
|
||||
cursor = buffer + size;
|
||||
}
|
||||
}
|
||||
inline ~MarshaledObj()
|
||||
{ if ( ! IsUnmarshaling() )
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
inline bool IsUnmarshaling() { return (extent <= 0); }
|
||||
|
||||
private:
|
||||
// Don't use copy constructor
|
||||
const MarshaledObj& operator=(const MarshaledObj& right);
|
||||
|
||||
protected:
|
||||
char *buffer; /* First entry is size of buffer */
|
||||
private:
|
||||
int extent; /* extent is number of bytes allocated, extent >= size */
|
||||
int size; /* Initially, buffer has entry for size */
|
||||
char *cursor;
|
||||
|
||||
inline void ResizeBuffer( size_t new_size )
|
||||
{ int displacement = cursor - buffer;
|
||||
extent = new_size;
|
||||
buffer = (char *)realloc( buffer, extent );
|
||||
cursor = buffer + displacement;
|
||||
}
|
||||
|
||||
public:
|
||||
inline int BufferSize()
|
||||
{ return cursor - buffer; }
|
||||
inline void *GetBuffer() {
|
||||
return buffer;
|
||||
}
|
||||
// inline void SetNewBuffer(void *buf) {
|
||||
// free(buffer);
|
||||
// buffer = (char *)buf;
|
||||
// size = 0; /* unknown size */
|
||||
// cursor = buffer;
|
||||
// }
|
||||
|
||||
#define MarshalDefinition(TYPE) \
|
||||
inline void Marshal(TYPE a##TYPE) { \
|
||||
if (IsUnmarshaling()) \
|
||||
throw "Tried to marshal in object marked isUnmarshaling = true"; \
|
||||
size += ROUND_UP(sizeof(a##TYPE)); \
|
||||
while ( size > extent ) \
|
||||
ResizeBuffer( 2 * extent ); \
|
||||
*(TYPE *)cursor = a##TYPE; \
|
||||
cursor = buffer + size; \
|
||||
} \
|
||||
inline void Unmarshal(TYPE & a##TYPE) { \
|
||||
a##TYPE = *(TYPE *)cursor; \
|
||||
cursor += ROUND_UP(sizeof(a##TYPE)); \
|
||||
} \
|
||||
inline TYPE UnmarshalAs##TYPE() { \
|
||||
TYPE a##TYPE = *(TYPE *)cursor; \
|
||||
cursor += ROUND_UP(sizeof(a##TYPE)); \
|
||||
return a##TYPE; \
|
||||
}
|
||||
|
||||
// This works for any inline objects (no embedded pointers)
|
||||
MarshalDefinition(G4int)
|
||||
MarshalDefinition(G4double)
|
||||
MarshalDefinition(G4ThreeVector)
|
||||
// MarshalDefinition(int)
|
||||
// MarshalDefinition(double)
|
||||
|
||||
|
||||
// These cannot follow the pattern, since the data is not inline.
|
||||
inline void MarshalG4String(G4String& aG4String) {
|
||||
if (IsUnmarshaling())
|
||||
throw "Tried to marshal in object marked isUnmarshaling = true";
|
||||
size += ROUND_UP( aG4String.length() + 1 ); // 1 for final NULL char
|
||||
while ( size > extent )
|
||||
ResizeBuffer( 2 * extent );
|
||||
strcpy( (char *)cursor, aG4String );
|
||||
cursor = buffer + size;
|
||||
}
|
||||
inline void Marshal(G4String& aG4String)
|
||||
{ MarshalG4String( aG4String ); }
|
||||
inline void Unmarshal(G4String& aG4String) {
|
||||
aG4String = (char *)cursor;
|
||||
cursor += ROUND_UP( aG4String.length() + 1 ); // 1 for final NULL char
|
||||
}
|
||||
// INEFFICIENT? (copies return value)
|
||||
inline G4String UnmarshalAsG4String() {
|
||||
G4String aG4String = (char *)cursor;
|
||||
cursor += ROUND_UP( aG4String.length() + 1 ); // 1 for final NULL char
|
||||
return aG4String;
|
||||
}
|
||||
|
||||
// USAGE: MarshalObjPtr( &aG4obj, sizeof(aG4obj) );
|
||||
// USAGE: MarshaledObj tmp;
|
||||
// G4Obj *aObjPtr = tmp.UnmarshalObjPtr();
|
||||
// ...
|
||||
// delete aObjPtr;
|
||||
inline void MarshalObjPtr(const void * aObjPtr, int obj_size)
|
||||
{
|
||||
if (IsUnmarshaling())
|
||||
throw "Tried to marshal in object marked isUnmarshaling = true";
|
||||
size += ROUND_UP( obj_size + sizeof(int) );
|
||||
while ( size > extent )
|
||||
ResizeBuffer( 2 * extent );
|
||||
*(int *)cursor = obj_size;
|
||||
memcpy( cursor+sizeof(int), aObjPtr, obj_size );
|
||||
cursor = buffer + size;
|
||||
}
|
||||
inline void Marshal(const void * aObjPtr, int obj_size)
|
||||
{ MarshalObjPtr(aObjPtr,obj_size); }
|
||||
inline void Unmarshal(void * & aObjPtr)
|
||||
{
|
||||
int obj_size = *(int *)cursor;
|
||||
aObjPtr = malloc( obj_size );
|
||||
memcpy( aObjPtr, cursor+sizeof(int), obj_size );
|
||||
cursor += ROUND_UP( obj_size + sizeof(int) );
|
||||
}
|
||||
inline void * UnmarshalAsObjPtr()
|
||||
{
|
||||
void *aObjPtr;
|
||||
Unmarshal(aObjPtr);
|
||||
return aObjPtr;
|
||||
}
|
||||
inline void * UnmarshalAsSharedObjPtr()
|
||||
{
|
||||
int obj_size = *(int *)cursor;
|
||||
void *aObjPtr;
|
||||
aObjPtr = cursor+sizeof(int);
|
||||
cursor += ROUND_UP( obj_size + sizeof(int) );
|
||||
return aObjPtr;
|
||||
}
|
||||
// UnmarshalAsSharedObjPtr: return value points into buffer of curr. obj.
|
||||
|
||||
inline void MarshalMarshaledObj(MarshaledObj& aMarshaledObj) {
|
||||
if (IsUnmarshaling())
|
||||
throw "Tried to marshal in object marked isUnmarshaling = true";
|
||||
MarshalObjPtr( aMarshaledObj.GetBuffer(), aMarshaledObj.BufferSize() );
|
||||
}
|
||||
// INEFFICIENT? (copies return value)
|
||||
inline MarshaledObj UnmarshalAsMarshaledObj() {
|
||||
MarshaledObj aMarshaledObj( ((char *)cursor)+sizeof(int), *(int *)cursor );
|
||||
cursor += ROUND_UP( aMarshaledObj.BufferSize()+sizeof(int) );
|
||||
return aMarshaledObj;
|
||||
}
|
||||
};
|
||||
|
||||
class MarshaledHCofThisEvent : public MarshaledObj
|
||||
{
|
||||
public:
|
||||
inline MarshaledHCofThisEvent(int size) : MarshaledObj(size) { }
|
||||
// Trivial constructor. MarshaledHCofThisEvent(0) creates nothing.
|
||||
MarshaledHCofThisEvent();
|
||||
// Constructor copies hits from HCE of master in this marshaled object
|
||||
MarshaledHCofThisEvent(G4Event *anEvent);
|
||||
// Constructor copies hits from HCE of anEvent in this marshaled object
|
||||
inline MarshaledHCofThisEvent(void *buf)
|
||||
: MarshaledObj(buf) // Object will be set for IsUnmarshaling
|
||||
{ }
|
||||
|
||||
void UnmarshalSlaveHCofThisEvent();
|
||||
// Unmarshal copies hits from slave in HCE of master
|
||||
// We inherit destructor of ParMarshaledObj
|
||||
// It does so by calling UnmarshalSlaveHitsCollection for dispatching
|
||||
void UnmarshalSlaveHitsCollection(G4String & HCname, G4String & SDname);
|
||||
|
||||
void MarshalHitsCollection(G4VHitsCollection * aBaseHC, G4String HCname);
|
||||
// To be defined in ParExN02MarshaledHits.cc or other
|
||||
// application-specific file.
|
||||
|
||||
private:
|
||||
// Don't use copy constructor
|
||||
const MarshaledHCofThisEvent& operator=(const MarshaledHCofThisEvent& right);
|
||||
void MarshalHitsCollection(const G4Event *anEvent);
|
||||
};
|
||||
|
||||
/*
|
||||
main() {
|
||||
MarshaledObj tmp = MarshaledObj();
|
||||
tmp.Marshal(5);
|
||||
tmp.Marshal(5.3);
|
||||
tmp.Marshal(7);
|
||||
|
||||
MarshaledObj tmp2;
|
||||
tmp2.MarshalMarshaledObj(tmp);
|
||||
cout << tmp2.UnmarshalAsG4int() << "\n";
|
||||
cout << tmp2.UnmarshalAsG4double() << "\n";
|
||||
cout << tmp2.UnmarshalAsG4int() << "\n";
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
@@ -1,84 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ParRandomState.hh,v 1.2 2003/07/04 15:36:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
// Each of the three members below must be modified for the application.
|
||||
// This default version simply sets the random seed on the slave using
|
||||
// the eventID.
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef ParRandomState_h
|
||||
#define ParRandomState_h 1
|
||||
|
||||
#include "ParMarshaledObj.hh"
|
||||
|
||||
class ParMarshaledRandomState : public MarshaledObj
|
||||
{
|
||||
public:
|
||||
// If 0, GetNextRandomStateForSlave not called.
|
||||
static const int RANDOM_STATE_SIZE = sizeof(long);
|
||||
|
||||
// Called on master
|
||||
inline void *GetNextRandomStateForSlave()
|
||||
{ static long * nextSeed = new long;
|
||||
*nextSeed = (long) (100000000L * HepRandom::getTheGenerator()->flat());
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "GET SEED: " << *nextSeed << G4endl;
|
||||
#endif
|
||||
return nextSeed;
|
||||
}
|
||||
|
||||
// Called on slave at beginning of new event.
|
||||
inline void SetNextRandomStateForSlave( G4int, void *randomState )
|
||||
{ HepRandom::setTheSeed( *(long *)randomState );
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "SET SEED: " << *(long *)randomState << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
// The constructors do not need to be modified.
|
||||
inline ParMarshaledRandomState( G4int eventID )
|
||||
: MarshaledObj(RANDOM_STATE_SIZE+sizeof(int)+sizeof(G4int))
|
||||
{ Marshal(eventID);
|
||||
Marshal( GetNextRandomStateForSlave(), RANDOM_STATE_SIZE );
|
||||
}
|
||||
inline ParMarshaledRandomState( void *buf )
|
||||
: MarshaledObj(buf)
|
||||
// MarshaledObj() called with buf and 0 size, creates object for unmarshaling
|
||||
{ }
|
||||
|
||||
inline void unmarshalEventIDandSetState( G4int & eventID )
|
||||
{ Unmarshal(eventID);
|
||||
// SharedObjPtr is pointer to random state.
|
||||
SetNextRandomStateForSlave( eventID, UnmarshalAsSharedObjPtr() );
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ParRunManager.hh,v 1.2 2002/06/06 17:05:05 cooperma Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: ParRunManager.hh,v 1.3 2004/11/22 17:51:13 cooperma Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
@@ -40,7 +40,7 @@
|
||||
class ParRunManager : public G4RunManager
|
||||
{
|
||||
|
||||
protected: // with description
|
||||
protected:
|
||||
virtual void DoEventLoop(G4int n_event,
|
||||
const char* macroFile=0,
|
||||
G4int n_select=-1);
|
||||
@@ -61,8 +61,6 @@ class ParRunManager : public G4RunManager
|
||||
static G4int n_select;
|
||||
static G4String msg;
|
||||
|
||||
G4int i_event; // Used in lieu of i_event in RunManager::DoEventLoop()
|
||||
|
||||
inline void ImportDoEventLoopLocals(
|
||||
G4StateManager* stateManager, G4int n_event,
|
||||
G4int n_select, G4String msg )
|
||||
|
||||
Reference in New Issue
Block a user