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 // $Id: SimActivityRegistryEnroller.h,v 1.4 2005/11/24 19:59:52 chrjones Exp $
20 //
21 
22 // system include files
23 #include "boost/mpl/pop_back.hpp"
24 #include "boost/mpl/begin_end.hpp"
25 #include "boost/mpl/copy_if.hpp"
26 #include "boost/mpl/deref.hpp"
27 #include "boost/mpl/prior.hpp"
28 #include "boost/mpl/vector.hpp"
29 #include "boost/mpl/eval_if.hpp"
30 #include "boost/mpl/empty.hpp"
31 
32 // user include files
35 
36 // forward declarations
37 namespace enroller_helper {
38  template <class T>
39  struct Enrollment {
40  static void enroll(SimActivityRegistry& iReg, Observer<const T*>* iObs){
41  iReg.connect(iObs);
42  }
43  static void enroll(SimActivityRegistry&, void*) {}
44  };
45 
46  //this class is used to terminate our recursion
47  template <class T>
49  static void enroll(SimActivityRegistry&, T*) {
50  }
51  };
52 
53  template< class T, class TVector>
54  struct EnrollerHelper {
56  static void enroll(SimActivityRegistry& iReg, T* iT) {
57  //Try to enroll the object if it inherits from the class at the
58  // end of TVector
60 
61  //If TVector is not at its end, call EnrollerHelper with a vector
62  // that had our last type 'popped off' the end
63  typedef typename boost::mpl::eval_if<boost::mpl::empty<TVector>,
64  boost::mpl::identity<LastEnrollerHelper<T> >,
66  >::type NextEnroller;
67  NextEnroller::enroll(iReg,iT);
68  }
69  };
70 
71 }
72 
74 {
75 
76  public:
78  //virtual ~SimActivityRegistryEnroller();
79  typedef boost::mpl::vector<BeginOfJob,DDDWorld,BeginOfRun,BeginOfEvent,BeginOfTrack,BeginOfStep,G4Step,EndOfTrack,EndOfEvent,EndOfRun> Signals;
80 
81  // ---------- const member functions ---------------------
82 
83  // ---------- static member functions --------------------
84  template<class T>
85  static void enroll(SimActivityRegistry& iReg, T* iObj){
87  }
88  // ---------- member functions ---------------------------
89 
90  private:
92 
94 
95  // ---------- member data --------------------------------
96 
97 };
98 
99 
100 #endif
type
Definition: HCALResponse.h:22
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 *)