CMS 3D CMS Logo

SimActivityRegistryEnroller.h
Go to the documentation of this file.
1 #ifndef Notification_SimActivityRegistryEnroller_h
2 #define Notification_SimActivityRegistryEnroller_h
3 // -*- C++ -*-
4 //
5 // Package: Notification
6 // Class : SimActivityRegistryEnroller
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Sun Nov 13 15:08:12 EST 2005
19 //
20 
21 // system include files
22 #include "boost/mpl/pop_back.hpp"
23 #include "boost/mpl/begin_end.hpp"
24 #include "boost/mpl/copy_if.hpp"
25 #include "boost/mpl/deref.hpp"
26 #include "boost/mpl/prior.hpp"
27 #include "boost/mpl/vector.hpp"
28 #include "boost/mpl/eval_if.hpp"
29 #include "boost/mpl/empty.hpp"
30 
31 // user include files
34 
35 // forward declarations
36 namespace enroller_helper {
37  template <class T>
38  struct Enrollment {
39  static void enroll(SimActivityRegistry& iReg, Observer<const T*>* iObs) { iReg.connect(iObs); }
40  static void enroll(SimActivityRegistry&, void*) {}
41  };
42 
43  //this class is used to terminate our recursion
44  template <class T>
46  static void enroll(SimActivityRegistry&, T*) {}
47  };
48 
49  template <class T, class TVector>
50  struct EnrollerHelper {
52  static void enroll(SimActivityRegistry& iReg, T* iT) {
53  //Try to enroll the object if it inherits from the class at the
54  // end of TVector
55  Enrollment<typename boost::mpl::deref<
57 
58  //If TVector is not at its end, call EnrollerHelper with a vector
59  // that had our last type 'popped off' the end
60  typedef typename boost::mpl::eval_if<
61  boost::mpl::empty<TVector>,
62  boost::mpl::identity<LastEnrollerHelper<T> >,
64  NextEnroller::enroll(iReg, iT);
65  }
66  };
67 
68 } // namespace enroller_helper
69 
71 public:
73  //virtual ~SimActivityRegistryEnroller();
74  typedef boost::mpl::
75  vector<BeginOfJob, DDDWorld, BeginOfRun, BeginOfEvent, BeginOfTrack, BeginOfStep, G4Step, EndOfTrack, EndOfEvent, EndOfRun>
77 
78  // ---------- const member functions ---------------------
79 
80  // ---------- static member functions --------------------
81  template <class T>
82  static void enroll(SimActivityRegistry& iReg, T* iObj) {
84  }
85  // ---------- member functions ---------------------------
86 
87 private:
88  SimActivityRegistryEnroller(const SimActivityRegistryEnroller&) = delete; // stop default
89 
90  const SimActivityRegistryEnroller& operator=(const SimActivityRegistryEnroller&) = delete; // stop default
91 
92  // ---------- member data --------------------------------
93 };
94 
95 #endif
type
Definition: HCALResponse.h:21
boost::mpl::vector< BeginOfJob, DDDWorld, BeginOfRun, BeginOfEvent, BeginOfTrack, BeginOfStep, G4Step, EndOfTrack, EndOfEvent, EndOfRun > Signals
void connect(Observer< const BeginOfJob * > *iObject)
boost::mpl::pop_back< TVector >::type RemainingVector
static void enroll(SimActivityRegistry &iReg, T *iObj)
static void enroll(SimActivityRegistry &iReg, T *iT)
static void enroll(SimActivityRegistry &, T *)
static void enroll(SimActivityRegistry &iReg, Observer< const T * > *iObs)
long double T
static void enroll(SimActivityRegistry &, void *)