File indexing completed on 2025-01-18 09:58:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef G4PhysListStamper_h
0027 #define G4PhysListStamper_h 1
0028
0029
0030 #include "globals.hh"
0031 #include "G4PhysListRegistry.hh"
0032 #include "G4VModularPhysicsList.hh"
0033
0034 class G4VBasePhysListStamper
0035 {
0036
0037 public:
0038
0039 virtual G4VModularPhysicsList* Instantiate(G4int ) = 0;
0040
0041 };
0042
0043
0044 template <typename T> class G4PhysListStamper : public G4VBasePhysListStamper
0045 {
0046 public:
0047
0048 G4PhysListStamper(const G4String& name)
0049 {
0050 G4PhysListRegistry::Instance()->AddFactory(name, this);
0051 }
0052
0053 virtual G4VModularPhysicsList* Instantiate(G4int verbose)
0054 {
0055 return new T(verbose);
0056 }
0057 };
0058
0059 #define G4_DECLARE_PHYSLIST_FACTORY(physics_list) \
0060 const G4PhysListStamper<physics_list>& physics_list##Factory = G4PhysListStamper<physics_list>(#physics_list)
0061
0062
0063
0064
0065 #define G4_DECLARE_PHYSLIST_FACTORY_NS( physics_list , nsname , plbase ) \
0066 namespace nsname { \
0067 const G4PhysListStamper<physics_list>& plbase##Factory = G4PhysListStamper<physics_list>(#physics_list); \
0068 } \
0069 typedef int xyzzy__LINE__
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 #define G4_REFERENCE_PHYSLIST_FACTORY(physics_list) \
0081 class G4VModularPhysicsList; \
0082 template <class T> class T##physics_list; \
0083 typedef T##physics_list<G4VModularPhysicsList> physics_list; \
0084 extern const G4PhysListStamper<physics_list>& physics_list##Factory; \
0085 const G4PhysListStamper<physics_list>& physics_list##FactoryRef = physics_list##Factory
0086
0087 #define G4_REFERENCE_PHYSLIST_FACTORY_NS(physics_list, nsname, plbase ) \
0088 class G4VModularPhysicsList; \
0089 namespace nsname { \
0090 template <class T> class T##plbase; \
0091 typedef T##plbase<G4VModularPhysicsList> plbase; \
0092 extern const G4PhysListStamper<plbase>& plbase##Factory; \
0093 const G4PhysListStamper<plbase>& plbase##FactoryRef = plbase##Factory; \
0094 } \
0095 typedef int xyzzy__LINE__
0096
0097
0098 #endif
0099