Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
The files in this directory are the files that were used to build
|
||||
../include/Marshaled*.hh . The files ../include/Marshaled*.hh contain
|
||||
marshaling (serialization) routines that are used by Parallel Geantr4.
|
||||
|
||||
Marshalgen is a package that allows one to add a small number of annotations
|
||||
to the original sequential code, in order to create marshalling or
|
||||
serialization routines. Those marshalling routines are then used
|
||||
by ParGeant4 to pass data between slave processes and the master process.
|
||||
|
||||
INPUT FILES:
|
||||
1. G4*.hh : The files *.hh are taken from Geant4. They include annotations
|
||||
(comments) that describe how to marshal individual fields of the
|
||||
given classes. These files have additional annotations that describe
|
||||
how to marshal individual fields of the given classes. For a new
|
||||
application, you have to change any references to Ex* to your
|
||||
own example/application include files. These files are then reused
|
||||
in the new Geant4 parallel application.
|
||||
2. ../include/Ex*Hit.hh : These files are the original sequential Geant4
|
||||
application files that describe the application-defined hits.
|
||||
They remain in the application include directory because they may
|
||||
depend on other files in the include directory.
|
||||
For most new parallel Geant4 applications, these files are sufficiently
|
||||
simple, that one needs only to add Marshalgen begin and end comments
|
||||
bracketing the class that needs to be marshalled, and a small number
|
||||
of annotations specifying accessor functions to get and set fields
|
||||
in the class. It may also be necessary to include marshalling
|
||||
include files, if it is necessary to marshal other Geant4 data
|
||||
structures.
|
||||
Information on how to marshal the fields, etc., is in the Marshalgen
|
||||
manual, along with the Marshalgen package:
|
||||
http://www.ccs.neu.edu/home/gene/marshalgen
|
||||
|
||||
|
||||
Marshalgen was then called on the above input files. One calls:
|
||||
./marshalgen *.hh
|
||||
./marshalgen ../include/Ex*Hit.hh
|
||||
|
||||
OUTPUT FILES:
|
||||
3. *.msh : These files are intermediate files generated automatically
|
||||
by marshalgen ( http://www.ccs.neu.edu/home/gene/marshalgen )
|
||||
These files can be deleted if desired.
|
||||
4. Marshaled*.h : These files are generated by Marshalgen. They
|
||||
include of type both MarshaledEx*.h and MarshaledG4*.h .
|
||||
(In addition, the file MarshaledObj.h is copied directly from
|
||||
the Marshalgen distribution.) These files are all copied to
|
||||
the include directory of the Geant4 parallel application.
|
||||
They provide the marshalling functions that are then used by Geant4.
|
||||
@@ -0,0 +1,129 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file parallel/ParN02/AnnotatedFiles/G4HCofThisEvent.hh
|
||||
/// \brief Definition of the G4HCofThisEvent class
|
||||
//
|
||||
//
|
||||
// $Id: G4HCofThisEvent.hh 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
|
||||
#ifndef G4HCofThisEvent_h
|
||||
#define G4HCofThisEvent_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4VHitsCollection.hh"
|
||||
#include <vector>
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a class which stores hits collections generated at one event.
|
||||
// This class is exclusively constructed by G4SDManager when the first
|
||||
// hits collection of an event is passed to the manager, and this class
|
||||
// object is deleted by G4RunManager when a G4Event class object is deleted.
|
||||
// Almost all public methods must be used by Geant4 kernel classes and
|
||||
// the user should not invoke them. The user can use two const methods,
|
||||
// GetHC() and GetNumberOfCollections() for accessing to the stored hits
|
||||
// collection(s).
|
||||
|
||||
|
||||
//vietha 2003/04/26 , include files needed to copy to the beginning of MarshaledG4HCofThisEvent.h
|
||||
// in order to compile
|
||||
//MSH_include_begin
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "ExN02TrackerHit.hh"
|
||||
#include "MarshaledExN02TrackerHit.h"
|
||||
#include "MarshaledG4THitsCollection.h"
|
||||
#include "MarshaledG4VHitsCollection.h"
|
||||
//MSH_include_end
|
||||
//MSH_BEGIN
|
||||
class G4HCofThisEvent
|
||||
{
|
||||
public:
|
||||
G4HCofThisEvent();
|
||||
G4HCofThisEvent(G4int cap);
|
||||
~G4HCofThisEvent();
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void* anHCoTE);
|
||||
|
||||
void AddHitsCollection(G4int HCID,G4VHitsCollection * aHC);
|
||||
|
||||
private:
|
||||
std::vector<G4VHitsCollection*> * HC; /*MSH: ptr_as_array
|
||||
[elementType: G4VHitsCollection*]
|
||||
[elementCount: { $ELE_COUNT = $THIS->GetNumberOfCollections(); }]
|
||||
[elementGet: { $ELEMENT = $THIS->GetHC($ELE_INDEX); }]
|
||||
[elementSet: { $THIS->AddHitsCollection($ELE_INDEX, $ELEMENT); }] */
|
||||
|
||||
public: // with description
|
||||
inline G4VHitsCollection* GetHC(G4int i)
|
||||
{ return (*HC)[i]; }
|
||||
// Returns a pointer to a hits collection. Null will be returned
|
||||
// if the particular collection is not stored at the current event.
|
||||
// The integer argument is ID number which is assigned by G4SDManager
|
||||
// and the number can be obtained by G4SDManager::GetHitsCollectionID()
|
||||
// method.
|
||||
inline G4int GetNumberOfCollections()
|
||||
{
|
||||
G4int n = 0;
|
||||
for(size_t i=0;i<HC->size();i++)
|
||||
{
|
||||
if((*HC)[i]) n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
// Returns the number of hits collections which are stored in this class
|
||||
// object.
|
||||
public:
|
||||
inline G4int GetCapacity()
|
||||
{
|
||||
return HC->size();
|
||||
}
|
||||
};
|
||||
//MSH_END
|
||||
|
||||
#if defined G4DIGI_ALLOC_EXPORT
|
||||
extern G4DLLEXPORT G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
|
||||
#else
|
||||
extern G4DLLIMPORT G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
|
||||
#endif
|
||||
|
||||
inline void* G4HCofThisEvent::operator new(size_t)
|
||||
{
|
||||
void* anHCoTH;
|
||||
anHCoTH = (void*)anHCoTHAllocator.MallocSingle();
|
||||
return anHCoTH;
|
||||
}
|
||||
|
||||
inline void G4HCofThisEvent::operator delete(void* anHCoTH)
|
||||
{
|
||||
anHCoTHAllocator.FreeSingle((G4HCofThisEvent*)anHCoTH);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
%{
|
||||
#include <G4HCofThisEvent.hh>
|
||||
//MSH_include_begin
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "ExN02TrackerHit.hh"
|
||||
#include "MarshaledExN02TrackerHit.h"
|
||||
#include "MarshaledG4THitsCollection.h"
|
||||
#include "MarshaledG4VHitsCollection.h"
|
||||
//MSH_include_end
|
||||
%}
|
||||
|
||||
// This file is generated automatically from G4HCofThisEvent.hh . It is an
|
||||
// intermediate file useful for debugging, but otherwise may be deleted.
|
||||
|
||||
marshaling class MarshaledG4HCofThisEvent (G4HCofThisEvent* param) {
|
||||
|
||||
std::vector<G4VHitsCollection*> * HC;
|
||||
//FIELDMARSHAL:
|
||||
{
|
||||
int copy_off = 0;
|
||||
int $ELE_COUNT;
|
||||
$ELE_COUNT = $THIS->GetNumberOfCollections();
|
||||
memcpy( $$+copy_off, &$ELE_COUNT,sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int $ELE_INDEX=0;$ELE_INDEX<$ELE_COUNT;$ELE_INDEX++){
|
||||
G4VHitsCollection* $ELEMENT;
|
||||
$ELEMENT = $THIS->GetHC($ELE_INDEX);
|
||||
MarshaledG4VHitsCollection marEle($ELEMENT);
|
||||
EXTEND_BUFFER(marEle.getBufferSize());
|
||||
memcpy($$+copy_off, marEle.getBuffer(), marEle.getBufferSize());
|
||||
copy_off += marEle.getBufferSize();
|
||||
}
|
||||
$SIZE = copy_off;
|
||||
|
||||
}
|
||||
//FIELDUNMARSHAL:
|
||||
{
|
||||
int copy_off = 0;
|
||||
int $ELE_COUNT;
|
||||
memcpy(&$ELE_COUNT, $$+copy_off, sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int $ELE_INDEX=0;$ELE_INDEX<$ELE_COUNT;$ELE_INDEX++){
|
||||
MarshaledG4VHitsCollection marEle($$+copy_off);
|
||||
G4VHitsCollection* $ELEMENT = (G4VHitsCollection*)marEle.unmarshal();
|
||||
copy_off += marEle.getBufferSize();
|
||||
$THIS->AddHitsCollection($ELE_INDEX, $ELEMENT);
|
||||
}
|
||||
|
||||
}
|
||||
//FIELDSIZE:
|
||||
{
|
||||
|
||||
}
|
||||
unmarshaling constructor {
|
||||
$THIS = new G4HCofThisEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file parallel/ParN02/AnnotatedFiles/G4String.hh
|
||||
/// \brief Definition of the place-holder for the G4String class
|
||||
//
|
||||
/*
|
||||
This file only serves as a place-holder for the annotations of G4String class,
|
||||
which is a type alias in Geant4.
|
||||
|
||||
Only the marshaling code (MarshaledG4String.hh) generated from this file
|
||||
should be used in your code. Please make sure that this G4String.hh
|
||||
itself is NOT included in your code. Otherwise, it will override Geant4's
|
||||
valid G4String class and bad things would happen.
|
||||
|
||||
vietha 2003.05.08
|
||||
*/
|
||||
|
||||
#ifndef __G4String
|
||||
#define __G4String
|
||||
|
||||
//MSH_BEGIN
|
||||
class G4String : public std::string
|
||||
{
|
||||
int dummy; /*MSH: manual
|
||||
{ memcpy($$, param->c_str(), param->size());
|
||||
*($$+param->size()) = '\0';
|
||||
}
|
||||
{ G4String* s = new G4String($$);
|
||||
memcpy(param, s, sizeof(G4String));
|
||||
}
|
||||
{ int size = param->size()+1;
|
||||
while(size%8) size++;
|
||||
$SIZE = size; } */
|
||||
};
|
||||
//MSH_END
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
%{
|
||||
#include <G4String.hh>
|
||||
|
||||
%}
|
||||
|
||||
// This file is generated automatically from G4String.hh . It is an
|
||||
// intermediate file useful for debugging, but otherwise may be deleted.
|
||||
|
||||
marshaling class MarshaledG4String (G4String* param) {
|
||||
|
||||
int dummy;
|
||||
//FIELDMARSHAL:
|
||||
{
|
||||
memcpy($$, param->c_str(), param->size());
|
||||
*($$+param->size()) = '\0';
|
||||
|
||||
}
|
||||
//FIELDUNMARSHAL:
|
||||
{
|
||||
G4String* s = new G4String($$);
|
||||
memcpy(param, s, sizeof(G4String));
|
||||
|
||||
}
|
||||
//FIELDSIZE:
|
||||
{
|
||||
int size = param->size()+1;
|
||||
while(size%8) size++;
|
||||
$SIZE = size;
|
||||
}
|
||||
unmarshaling constructor {
|
||||
$THIS = new G4String();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file parallel/ParN02/AnnotatedFiles/G4THitsCollection.hh
|
||||
/// \brief Definition of the G4THitsCollection class
|
||||
//
|
||||
//
|
||||
// $Id: G4THitsCollection.hh 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
|
||||
#ifndef G4THitsCollection_h
|
||||
#define G4THitsCollection_h 1
|
||||
|
||||
#include "G4VHitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "globals.hh"
|
||||
//#include "g4rw/tpordvec.h"
|
||||
#include <vector>
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a template class of hits collection and parametrized by
|
||||
// The concrete class of G4VHit. This is a uniform collection for
|
||||
// a particular concrete hit class objects.
|
||||
// An intermediate layer class G4HitsCollection appeared in this
|
||||
// header file is used just for G4Allocator, because G4Allocator
|
||||
// cannot be instansiated with a template class. Thus G4HitsCollection
|
||||
// class MUST NOT be directly used by the user.
|
||||
|
||||
//MSH_BEGIN
|
||||
class G4HitsCollection : public G4VHitsCollection
|
||||
{
|
||||
public:
|
||||
G4HitsCollection();
|
||||
G4HitsCollection(G4String detName,G4String colNam);
|
||||
virtual ~G4HitsCollection();
|
||||
G4int operator==(const G4HitsCollection &right) const;
|
||||
|
||||
protected:
|
||||
void* theCollection; /*MSH: ptr_as_array
|
||||
[elementType: ExN02TrackerHit* ]
|
||||
[elementCount: { $ELE_COUNT = ((G4THitsCollection<ExN02TrackerHit>*)$THIS)->entries(); }]
|
||||
[elementGet: { $ELEMENT = (*((G4THitsCollection<ExN02TrackerHit>*)$THIS))[$ELE_INDEX]; }]
|
||||
[elementSet: { ((G4THitsCollection<ExN02TrackerHit>*)$THIS)->insert((ExN02TrackerHit*)$ELEMENT); }]
|
||||
*/
|
||||
|
||||
};
|
||||
//MSH_END
|
||||
|
||||
#if defined G4DIGI_ALLOC_EXPORT
|
||||
extern G4DLLEXPORT G4Allocator<G4HitsCollection> anHCAllocator;
|
||||
#else
|
||||
extern G4DLLIMPORT G4Allocator<G4HitsCollection> anHCAllocator;
|
||||
#endif
|
||||
|
||||
//MSH_BEGIN
|
||||
template <class T> class G4THitsCollection : public G4HitsCollection
|
||||
{
|
||||
public:
|
||||
G4THitsCollection();
|
||||
public: // with description
|
||||
G4THitsCollection(G4String detName,G4String colNam);
|
||||
// constructor.
|
||||
public:
|
||||
virtual ~G4THitsCollection();
|
||||
G4int operator==(const G4THitsCollection<T> &right) const;
|
||||
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void* anHC);
|
||||
public: // with description
|
||||
virtual void DrawAllHits();
|
||||
virtual void PrintAllHits();
|
||||
// These two methods invokes Draw() and Print() methods of all of
|
||||
// hit objects stored in this collection, respectively.
|
||||
|
||||
public: // with description
|
||||
inline T* operator[](size_t i) const
|
||||
{ return (*((std::vector<T*>*)theCollection))[i]; }
|
||||
// Returns a pointer to a concrete hit object.
|
||||
inline std::vector<T*>* GetVector() const
|
||||
{ return (std::vector<T*>*)theCollection; }
|
||||
// Returns a collection vector.
|
||||
inline G4int insert(T* aHit)
|
||||
{
|
||||
std::vector<T*>*theHitsCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
theHitsCollection->push_back(aHit);
|
||||
return theHitsCollection->size();
|
||||
}
|
||||
// Insert a hit object. Total number of hit objects stored in this
|
||||
// collection is returned.
|
||||
inline G4int entries() const
|
||||
{
|
||||
std::vector<T*>*theHitsCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
return theHitsCollection->size();
|
||||
}
|
||||
// Returns the number of hit objects stored in this collection
|
||||
|
||||
public:
|
||||
virtual G4VHit* GetHit(size_t i) const
|
||||
{ return (*((std::vector<T*>*)theCollection))[i]; }
|
||||
virtual size_t GetSize() const
|
||||
{ return ((std::vector<T*>*)theCollection)->size(); }
|
||||
|
||||
// MSH_superclass : G4HitsCollection
|
||||
|
||||
};
|
||||
//MSH_END
|
||||
|
||||
template <class T> inline void* G4THitsCollection<T>::operator new(size_t)
|
||||
{
|
||||
void* anHC;
|
||||
anHC = (void*)anHCAllocator.MallocSingle();
|
||||
return anHC;
|
||||
}
|
||||
|
||||
template <class T> inline void G4THitsCollection<T>::operator delete(void* anHC)
|
||||
{
|
||||
anHCAllocator.FreeSingle((G4HitsCollection*)anHC);
|
||||
}
|
||||
|
||||
template <class T> G4THitsCollection<T>::G4THitsCollection()
|
||||
{
|
||||
std::vector<T*> * theHitsCollection
|
||||
= new std::vector<T*>;
|
||||
theCollection = (void*)theHitsCollection;
|
||||
}
|
||||
|
||||
template <class T> G4THitsCollection<T>::G4THitsCollection(G4String detName,G4String colNam)
|
||||
: G4HitsCollection(detName,colNam)
|
||||
{
|
||||
std::vector<T*> * theHitsCollection
|
||||
= new std::vector<T*>;
|
||||
theCollection = (void*)theHitsCollection;
|
||||
}
|
||||
|
||||
template <class T> G4THitsCollection<T>::~G4THitsCollection()
|
||||
{
|
||||
std::vector<T*> * theHitsCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
//theHitsCollection->clearAndDestroy();
|
||||
for(size_t i=0;i<theHitsCollection->size();i++)
|
||||
{ delete (*theHitsCollection)[i]; }
|
||||
theHitsCollection->clear();
|
||||
delete theHitsCollection;
|
||||
}
|
||||
|
||||
template <class T> G4int G4THitsCollection<T>::operator==(const G4THitsCollection<T> &right) const
|
||||
{ return (collectionName==right.collectionName); }
|
||||
|
||||
template <class T> void G4THitsCollection<T>::DrawAllHits()
|
||||
{
|
||||
std::vector<T*> * theHitsCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
size_t n = theHitsCollection->size();
|
||||
for(size_t i=0;i<n;i++)
|
||||
{ (*theHitsCollection)[i]->Draw(); }
|
||||
}
|
||||
|
||||
template <class T> void G4THitsCollection<T>::PrintAllHits()
|
||||
{
|
||||
std::vector<T*> * theHitsCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
size_t n = theHitsCollection->size();
|
||||
for(size_t i=0;i<n;i++)
|
||||
{ (*theHitsCollection)[i]->Print(); }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
%{
|
||||
#include <G4THitsCollection.hh>
|
||||
|
||||
%}
|
||||
|
||||
// This file is generated automatically from G4THitsCollection.hh . It is an
|
||||
// intermediate file useful for debugging, but otherwise may be deleted.
|
||||
|
||||
marshaling class MarshaledG4HitsCollection (G4HitsCollection* param) {
|
||||
|
||||
void* theCollection;
|
||||
//FIELDMARSHAL:
|
||||
{
|
||||
int copy_off = 0;
|
||||
int $ELE_COUNT;
|
||||
$ELE_COUNT = ((G4THitsCollection<ExN02TrackerHit>*)$THIS)->entries();
|
||||
memcpy( $$+copy_off, &$ELE_COUNT,sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int $ELE_INDEX=0;$ELE_INDEX<$ELE_COUNT;$ELE_INDEX++){
|
||||
ExN02TrackerHit* $ELEMENT;
|
||||
$ELEMENT = (*((G4THitsCollection<ExN02TrackerHit>*)$THIS))[$ELE_INDEX];
|
||||
MarshaledExN02TrackerHit marEle($ELEMENT);
|
||||
EXTEND_BUFFER(marEle.getBufferSize());
|
||||
memcpy($$+copy_off, marEle.getBuffer(), marEle.getBufferSize());
|
||||
copy_off += marEle.getBufferSize();
|
||||
}
|
||||
$SIZE = copy_off;
|
||||
|
||||
}
|
||||
//FIELDUNMARSHAL:
|
||||
{
|
||||
int copy_off = 0;
|
||||
int $ELE_COUNT;
|
||||
memcpy(&$ELE_COUNT, $$+copy_off, sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int $ELE_INDEX=0;$ELE_INDEX<$ELE_COUNT;$ELE_INDEX++){
|
||||
MarshaledExN02TrackerHit marEle($$+copy_off);
|
||||
ExN02TrackerHit* $ELEMENT = (ExN02TrackerHit* )marEle.unmarshal();
|
||||
copy_off += marEle.getBufferSize();
|
||||
((G4THitsCollection<ExN02TrackerHit>*)$THIS)->insert((ExN02TrackerHit*)$ELEMENT);
|
||||
}
|
||||
|
||||
}
|
||||
//FIELDSIZE:
|
||||
{
|
||||
|
||||
}
|
||||
unmarshaling constructor {
|
||||
$THIS = new G4HitsCollection();
|
||||
}
|
||||
}
|
||||
|
||||
template <class T> marshaling class MarshaledG4THitsCollection<T> (G4THitsCollection<T>* param) : public G4HitsCollection {
|
||||
int __dummy569; // marshaling code for MSH_superclass
|
||||
//FIELDMARSHAL:
|
||||
{
|
||||
MarshaledG4HitsCollection marParent($THIS);
|
||||
EXTEND_BUFFER(marParent.getBufferSize());
|
||||
memcpy($$,marParent.getBuffer(), marParent.getBufferSize());
|
||||
$SIZE = marParent.getBufferSize();
|
||||
|
||||
}
|
||||
//FIELD UNMARSHAL:
|
||||
{
|
||||
MarshaledG4HitsCollection marObj($$);
|
||||
marObj.unmarshalTo($THIS);
|
||||
|
||||
}
|
||||
//FIELD SIZE :
|
||||
{
|
||||
//code for size, just dummy code because the size will be set correctly at the end of marshaling code
|
||||
|
||||
}
|
||||
unmarshaling constructor {
|
||||
$THIS = new G4THitsCollection<T>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file parallel/ParN02/AnnotatedFiles/G4VHitsCollection.hh
|
||||
/// \brief Definition of the G4VHitsCollection class
|
||||
//
|
||||
//
|
||||
// $Id: G4VHitsCollection.hh 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
|
||||
#ifndef G4VHitsCollection_h
|
||||
#define G4VHitsCollection_h 1
|
||||
|
||||
class G4VHit;
|
||||
#include "globals.hh"
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is the base class of hits collection. The user is advised to
|
||||
// use G4THitsCollection template class in case his/her collection is
|
||||
// transient. While, in case the collection is persistent with ODBMS,
|
||||
// the concrete collection class can be directly derived from this
|
||||
// class.
|
||||
// Geant4 kernel will use this class methods.
|
||||
|
||||
//MSH_BEGIN
|
||||
class G4VHitsCollection
|
||||
{
|
||||
public:
|
||||
G4VHitsCollection();
|
||||
G4VHitsCollection(G4String detName,G4String colNam);
|
||||
virtual ~G4VHitsCollection();
|
||||
G4int operator==(const G4VHitsCollection &right) const;
|
||||
|
||||
virtual void DrawAllHits();
|
||||
virtual void PrintAllHits();
|
||||
|
||||
protected:
|
||||
|
||||
// Collection name
|
||||
G4String collectionName; /*MSH: predefined
|
||||
[elementGet: { $ELEMENT = $THIS->GetName(); }]
|
||||
[elementSet: { Shadowed_param->collectionName=$ELEMENT; }]
|
||||
*/
|
||||
|
||||
G4String SDname; /* MSH: predefined
|
||||
[elementGet: { $ELEMENT = $THIS->GetSDname(); }]
|
||||
[elementSet: { Shadowed_param->SDname=$ELEMENT; }]
|
||||
*/
|
||||
|
||||
/* MSH_derivedclass: G4THitsCollection<ExN02TrackerHit>("","") */
|
||||
|
||||
public:
|
||||
inline G4String GetName()
|
||||
{ return collectionName; }
|
||||
inline G4String GetSDname()
|
||||
{ return SDname; }
|
||||
|
||||
public:
|
||||
// GetHit and GetSize are given a default implementation here so
|
||||
// that the template G4THitsCollection can be used, but they
|
||||
// are re-implemented G4THitsCollection.
|
||||
virtual G4VHit* GetHit(size_t) const { return 0; }
|
||||
virtual size_t GetSize() const { return 0; };
|
||||
|
||||
};
|
||||
//MSH_END
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
%{
|
||||
#include <G4VHitsCollection.hh>
|
||||
|
||||
%}
|
||||
|
||||
// This file is generated automatically from G4VHitsCollection.hh . It is an
|
||||
// intermediate file useful for debugging, but otherwise may be deleted.
|
||||
|
||||
marshaling class MarshaledG4VHitsCollection (G4VHitsCollection* param) {
|
||||
|
||||
G4String collectionName;
|
||||
//FIELDMARSHAL:
|
||||
{
|
||||
G4String $ELEMENT;
|
||||
$ELEMENT = $THIS->GetName();
|
||||
MarshaledG4String var(&$ELEMENT);
|
||||
EXTEND_BUFFER(var.getBufferSize());
|
||||
$SIZE = var.getBufferSize();
|
||||
memcpy($$, var.getBuffer(), var.getBufferSize());
|
||||
}
|
||||
//FIELDUNMARSHAL:
|
||||
{
|
||||
MarshaledG4String var($$, 'u');
|
||||
G4String $ELEMENT;
|
||||
var.unmarshalTo(&$ELEMENT);
|
||||
Shadowed_param->collectionName=$ELEMENT;
|
||||
|
||||
}
|
||||
//FIELDSIZE:
|
||||
{
|
||||
// no need to declare size since $SIZE is already assigned in the MARSHAL field
|
||||
|
||||
}
|
||||
|
||||
G4String SDname;
|
||||
//FIELDMARSHAL:
|
||||
{
|
||||
G4String $ELEMENT;
|
||||
$ELEMENT = $THIS->GetSDname();
|
||||
MarshaledG4String var(&$ELEMENT);
|
||||
EXTEND_BUFFER(var.getBufferSize());
|
||||
$SIZE = var.getBufferSize();
|
||||
memcpy($$, var.getBuffer(), var.getBufferSize());
|
||||
}
|
||||
//FIELDUNMARSHAL:
|
||||
{
|
||||
MarshaledG4String var($$, 'u');
|
||||
G4String $ELEMENT;
|
||||
var.unmarshalTo(&$ELEMENT);
|
||||
Shadowed_param->SDname=$ELEMENT;
|
||||
|
||||
}
|
||||
//FIELDSIZE:
|
||||
{
|
||||
// no need to declare size since $SIZE is already assigned in the MARSHAL field
|
||||
|
||||
}
|
||||
int __dummy630; // marshaling code for MSH_derivedclass
|
||||
//FIELDMARSHAL:
|
||||
{
|
||||
G4THitsCollection<ExN02TrackerHit> *aObj630 = (G4THitsCollection<ExN02TrackerHit>*)$THIS;
|
||||
MarshaledG4THitsCollection<ExN02TrackerHit> marChild(aObj630);
|
||||
EXTEND_BUFFER(marChild.getBufferSize());
|
||||
memcpy($$,marChild.getBuffer(), marChild.getBufferSize());
|
||||
$SIZE = marChild.getBufferSize();
|
||||
$TYPE_CHOICE = 0;
|
||||
|
||||
}
|
||||
//FIELD UNMARSHAL:
|
||||
{
|
||||
MarshaledG4THitsCollection<ExN02TrackerHit> marObj($$);
|
||||
marObj.unmarshalTo((G4THitsCollection<ExN02TrackerHit>*)$THIS);
|
||||
|
||||
}
|
||||
//FIELD SIZE :
|
||||
{
|
||||
//code for size, just dummy code because the size will be set correctly at the end of marshaling code
|
||||
|
||||
}
|
||||
unmarshaling constructor {
|
||||
$THIS = new G4THitsCollection<ExN02TrackerHit>("","");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
//
|
||||
/// \file parallel/ParN02/AnnotatedFiles/MarshaledG4HCofThisEvent.h
|
||||
/// \brief Definition of the MaraledG4HCofisEvent class
|
||||
|
||||
#ifndef MarshaledG4HCofThisEvent_H
|
||||
#define MarshaledG4HCofThisEvent_H
|
||||
|
||||
|
||||
#include <G4HCofThisEvent.hh>
|
||||
//MSH_include_begin
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "ExN02TrackerHit.hh"
|
||||
#include "MarshaledExN02TrackerHit.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,140 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
//
|
||||
/// \file parallel/ParN02/AnnotatedFiles/MarshaledG4String.h
|
||||
/// \brief Definition of the MaraledG4String class
|
||||
|
||||
#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,282 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
//
|
||||
/// \file parallel/ParN02/AnnotatedFiles/MarshaledG4THitsCollection.h
|
||||
/// \brief Definition of the MaraledG4THitsCollection class
|
||||
|
||||
#ifndef MarshaledG4HitsCollection_H
|
||||
#define MarshaledG4HitsCollection_H
|
||||
|
||||
|
||||
#include <G4THitsCollection.hh>
|
||||
|
||||
|
||||
#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;
|
||||
elementNum = ((G4THitsCollection<ExN02TrackerHit>*)param)->entries();
|
||||
memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
|
||||
copy_off += sizeof(int);
|
||||
for(int index=0;index<elementNum;index++){
|
||||
ExN02TrackerHit* anElement;
|
||||
anElement = (*((G4THitsCollection<ExN02TrackerHit>*)param))[index];
|
||||
MarshaledExN02TrackerHit 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++){
|
||||
MarshaledExN02TrackerHit marEle(msh_cursor+copy_off);
|
||||
ExN02TrackerHit* anElement = (ExN02TrackerHit* )marEle.unmarshal();
|
||||
copy_off += marEle.getBufferSize();
|
||||
((G4THitsCollection<ExN02TrackerHit>*)param)->insert((ExN02TrackerHit*)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,265 @@
|
||||
// This file was generated automatically by marshalgen.
|
||||
//
|
||||
/// \file parallel/ParN02/AnnotatedFiles/MarshaledG4VHitsCollection.h
|
||||
/// \brief Definition of the MaraledG4VHitsCollection class
|
||||
|
||||
#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 {
|
||||
{
|
||||
param = new G4THitsCollection<ExN02TrackerHit>("","");
|
||||
}
|
||||
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
|
||||
{
|
||||
G4THitsCollection<ExN02TrackerHit> *aObj630 = (G4THitsCollection<ExN02TrackerHit>*)param;
|
||||
MarshaledG4THitsCollection<ExN02TrackerHit> marChild(aObj630);
|
||||
EXTEND_BUFFER(marChild.getBufferSize());
|
||||
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
|
||||
msh_currentSize = marChild.getBufferSize();
|
||||
msh_typechoice = 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 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
|
||||
{
|
||||
MarshaledG4THitsCollection<ExN02TrackerHit> marObj(msh_cursor);
|
||||
marObj.unmarshalTo((G4THitsCollection<ExN02TrackerHit>*)param);
|
||||
|
||||
}
|
||||
msh_cursor += msh_currentSize;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user