File indexing completed on 2024-04-06 12:30:26
0001 #ifndef Notification_SimActivityRegistryEnroller_h
0002 #define Notification_SimActivityRegistryEnroller_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include "SimG4Core/Notification/interface/Observer.h"
0022 #include "SimG4Core/Notification/interface/SimActivityRegistry.h"
0023
0024
0025 namespace enroller_helper {
0026 template <class T>
0027 struct Enrollment {
0028 static void enroll(SimActivityRegistry& iReg, Observer<const T*>* iObs) { iReg.connect(iObs); }
0029 static void enroll(SimActivityRegistry&, void*) {}
0030 };
0031
0032 template <class T>
0033 static void enroll(SimActivityRegistry& iReg, T* iT) {}
0034
0035 template <class T, class F, class... TVector>
0036 static void enroll(SimActivityRegistry& iReg, T* iT) {
0037
0038
0039 Enrollment<F>::enroll(iReg, iT);
0040 enroll<T, TVector...>(iReg, iT);
0041 }
0042
0043 }
0044
0045 class SimActivityRegistryEnroller {
0046 public:
0047 SimActivityRegistryEnroller() {}
0048
0049 template <class T>
0050 static void enroll(SimActivityRegistry& iReg, T* iObj) {
0051 enroller_helper::enroll<T,
0052 BeginOfJob,
0053 DDDWorld,
0054 BeginOfRun,
0055 BeginOfEvent,
0056 BeginOfTrack,
0057 BeginOfStep,
0058 G4Step,
0059 EndOfTrack,
0060 EndOfEvent,
0061 EndOfRun>(iReg, iObj);
0062 }
0063
0064
0065 SimActivityRegistryEnroller(const SimActivityRegistryEnroller&) = delete;
0066 const SimActivityRegistryEnroller& operator=(const SimActivityRegistryEnroller&) = delete;
0067 };
0068
0069 #endif