CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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){
40  iReg.connect(iObs);
41  }
42  static void enroll(SimActivityRegistry&, void*) {}
43  };
44 
45  //this class is used to terminate our recursion
46  template <class T>
48  static void enroll(SimActivityRegistry&, T*) {
49  }
50  };
51 
52  template< class T, class TVector>
53  struct EnrollerHelper {
55  static void enroll(SimActivityRegistry& iReg, T* iT) {
56  //Try to enroll the object if it inherits from the class at the
57  // end of TVector
59 
60  //If TVector is not at its end, call EnrollerHelper with a vector
61  // that had our last type 'popped off' the end
62  typedef typename boost::mpl::eval_if<boost::mpl::empty<TVector>,
63  boost::mpl::identity<LastEnrollerHelper<T> >,
65  >::type NextEnroller;
66  NextEnroller::enroll(iReg,iT);
67  }
68  };
69 
70 }
71 
73 {
74 
75  public:
77  //virtual ~SimActivityRegistryEnroller();
78  typedef boost::mpl::vector<BeginOfJob,DDDWorld,BeginOfRun,BeginOfEvent,BeginOfTrack,BeginOfStep,G4Step,EndOfTrack,EndOfEvent,EndOfRun> Signals;
79 
80  // ---------- const member functions ---------------------
81 
82  // ---------- static member functions --------------------
83  template<class T>
84  static void enroll(SimActivityRegistry& iReg, T* iObj){
86  }
87  // ---------- member functions ---------------------------
88 
89  private:
91 
93 
94  // ---------- member data --------------------------------
95 
96 };
97 
98 
99 #endif
type
Definition: HCALResponse.h:21
void connect(Observer< const BeginOfJob * > *iObject)
boost::mpl::pop_back< TVector >::type RemainingVector
static void enroll(SimActivityRegistry &iReg, T *iObj)
const SimActivityRegistryEnroller & operator=(const SimActivityRegistryEnroller &)
static void enroll(SimActivityRegistry &iReg, T *iT)
static void enroll(SimActivityRegistry &, T *)
static void enroll(SimActivityRegistry &iReg, Observer< const T * > *iObs)
boost::mpl::vector< BeginOfJob, DDDWorld, BeginOfRun, BeginOfEvent, BeginOfTrack, BeginOfStep, G4Step, EndOfTrack, EndOfEvent, EndOfRun > Signals
long double T
static void enroll(SimActivityRegistry &, void *)