00001 #ifndef SimG4Core_Notification_SimActivityRegistry_h 00002 #define SimG4Core_Notification_SimActivityRegistry_h 00003 // -*- C++ -*- 00004 // 00005 // Package: Notification 00006 // Class : SimActivityRegistry 00007 // 00016 // 00017 // Original Author: Chris Jones 00018 // Created: Sun Nov 13 11:43:40 EST 2005 00019 // $Id: SimActivityRegistry.h,v 1.7 2007/12/02 05:17:47 chrjones Exp $ 00020 // 00021 00022 // system include files 00023 #include "boost/bind.hpp" 00024 #include "boost/mem_fn.hpp" 00025 00026 // user include files 00027 #include "SimG4Core/Notification/interface/Signaler.h" 00028 00029 00030 // forward declarations 00031 class BeginOfJob; 00032 class BeginOfRun; 00033 class BeginOfEvent; 00034 class BeginOfTrack; 00035 class BeginOfStep; 00036 class EndOfRun; 00037 class EndOfEvent; 00038 class EndOfTrack; 00039 class DDDWorld; 00040 class G4Step; 00041 00042 #define SAR_CONNECT_METHOD(signal) void connect(Observer<const signal*>* iObject) { watch ## signal (iObject); } 00043 00044 class SimActivityRegistry 00045 { 00046 00047 public: 00048 SimActivityRegistry() {} 00049 //virtual ~SimActivityRegistry(); 00050 00051 typedef sim_act::Signaler<BeginOfJob> BeginOfJobSignal; 00052 BeginOfJobSignal beginOfJobSignal_; 00053 void watchBeginOfJob(const BeginOfJobSignal::slot_type& iSlot){ 00054 beginOfJobSignal_.connect(iSlot); 00055 } 00056 SAR_CONNECT_METHOD(BeginOfJob) 00057 00058 typedef sim_act::Signaler<DDDWorld> DDDWorldSignal; 00059 DDDWorldSignal dddWorldSignal_; 00060 void watchDDDWorld(const DDDWorldSignal::slot_type& iSlot){ 00061 dddWorldSignal_.connect(iSlot); 00062 } 00063 SAR_CONNECT_METHOD(DDDWorld) 00064 00065 typedef sim_act::Signaler<BeginOfRun> BeginOfRunSignal; 00066 BeginOfRunSignal beginOfRunSignal_; 00067 void watchBeginOfRun(const BeginOfRunSignal::slot_type& iSlot){ 00068 beginOfRunSignal_.connect(iSlot); 00069 } 00070 SAR_CONNECT_METHOD(BeginOfRun) 00071 00072 typedef sim_act::Signaler<BeginOfEvent> BeginOfEventSignal; 00073 BeginOfEventSignal beginOfEventSignal_; 00074 void watchBeginOfEvent(const BeginOfEventSignal::slot_type& iSlot){ 00075 beginOfEventSignal_.connect(iSlot); 00076 } 00077 SAR_CONNECT_METHOD(BeginOfEvent) 00078 00079 typedef sim_act::Signaler<BeginOfTrack> BeginOfTrackSignal; 00080 BeginOfTrackSignal beginOfTrackSignal_; 00081 void watchBeginOfTrack(const BeginOfTrackSignal::slot_type& iSlot){ 00082 beginOfTrackSignal_.connect(iSlot); 00083 } 00084 SAR_CONNECT_METHOD(BeginOfTrack) 00085 00086 typedef sim_act::Signaler<G4Step> G4StepSignal; 00087 G4StepSignal g4StepSignal_; 00088 void watchG4Step(const G4StepSignal::slot_type& iSlot){ 00089 g4StepSignal_.connect(iSlot); 00090 } 00091 SAR_CONNECT_METHOD(G4Step) 00092 00093 typedef sim_act::Signaler<EndOfRun> EndOfRunSignal; 00094 EndOfRunSignal endOfRunSignal_; 00095 void watchEndOfRun(const EndOfRunSignal::slot_type& iSlot){ 00096 endOfRunSignal_.connect(iSlot); 00097 } 00098 SAR_CONNECT_METHOD(EndOfRun) 00099 00100 typedef sim_act::Signaler<EndOfEvent> EndOfEventSignal; 00101 EndOfEventSignal endOfEventSignal_; 00102 void watchEndOfEvent(const EndOfEventSignal::slot_type& iSlot){ 00103 endOfEventSignal_.connect(iSlot); 00104 } 00105 SAR_CONNECT_METHOD(EndOfEvent) 00106 00107 typedef sim_act::Signaler<EndOfTrack> EndOfTrackSignal; 00108 EndOfTrackSignal endOfTrackSignal_; 00109 void watchEndOfTrack(const EndOfTrackSignal::slot_type& iSlot){ 00110 endOfTrackSignal_.connect(iSlot); 00111 } 00112 SAR_CONNECT_METHOD(EndOfTrack) 00113 00114 00115 void connect(SimActivityRegistry& iOther); 00116 00117 private: 00118 SimActivityRegistry(const SimActivityRegistry&); // stop default 00119 00120 const SimActivityRegistry& operator=(const SimActivityRegistry&); // stop default 00121 00122 // ---------- member data -------------------------------- 00123 00124 }; 00125 00126 00127 #endif