SimG4Core
Notification
interface
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
32
#include "
SimG4Core/Notification/interface/Observer.h
"
33
#include "
SimG4Core/Notification/interface/SimActivityRegistry.h
"
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>
45
struct
LastEnrollerHelper
{
46
static
void
enroll
(
SimActivityRegistry
&,
T
*) {}
47
};
48
49
template
<
class
T,
class
TVector>
50
struct
EnrollerHelper
{
51
typedef
typename
boost::mpl::pop_back<TVector>::type
RemainingVector
;
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<
56
typename
boost::mpl::prior<typename boost::mpl::end<TVector>::type
>
::type
>
::type
>
::enroll
(iReg, iT);
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> >,
63
boost::mpl::identity<EnrollerHelper<T, typename boost::mpl::pop_back<TVector>::type
> > >
::type
NextEnroller;
64
NextEnroller::enroll(iReg, iT);
65
}
66
};
67
68
}
// namespace enroller_helper
69
70
class
SimActivityRegistryEnroller
{
71
public
:
72
SimActivityRegistryEnroller
() {}
73
//virtual ~SimActivityRegistryEnroller();
74
typedef
boost::mpl::
75
vector<BeginOfJob, DDDWorld, BeginOfRun, BeginOfEvent, BeginOfTrack, BeginOfStep, G4Step, EndOfTrack, EndOfEvent, EndOfRun>
76
Signals
;
77
78
// ---------- const member functions ---------------------
79
80
// ---------- static member functions --------------------
81
template
<
class
T>
82
static
void
enroll
(
SimActivityRegistry
& iReg,
T
* iObj) {
83
enroller_helper::EnrollerHelper<T, Signals>::enroll
(iReg, 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
enroller_helper
Definition:
SimActivityRegistryEnroller.h:36
Observer< const T * >
SimActivityRegistryEnroller::operator=
const SimActivityRegistryEnroller & operator=(const SimActivityRegistryEnroller &)=delete
enroller_helper::EnrollerHelper::RemainingVector
boost::mpl::pop_back< TVector >::type RemainingVector
Definition:
SimActivityRegistryEnroller.h:51
enroller_helper::LastEnrollerHelper
Definition:
SimActivityRegistryEnroller.h:45
Observer.h
SimActivityRegistryEnroller
Definition:
SimActivityRegistryEnroller.h:70
SimActivityRegistry.h
SimActivityRegistryEnroller::SimActivityRegistryEnroller
SimActivityRegistryEnroller()
Definition:
SimActivityRegistryEnroller.h:72
enroller_helper::EnrollerHelper
Definition:
SimActivityRegistryEnroller.h:50
enroller_helper::Enrollment::enroll
static void enroll(SimActivityRegistry &, void *)
Definition:
SimActivityRegistryEnroller.h:40
enroller_helper::Enrollment::enroll
static void enroll(SimActivityRegistry &iReg, Observer< const T * > *iObs)
Definition:
SimActivityRegistryEnroller.h:39
enroller_helper::EnrollerHelper::enroll
static void enroll(SimActivityRegistry &iReg, T *iT)
Definition:
SimActivityRegistryEnroller.h:52
SimActivityRegistryEnroller::enroll
static void enroll(SimActivityRegistry &iReg, T *iObj)
Definition:
SimActivityRegistryEnroller.h:82
SimActivityRegistryEnroller::Signals
boost::mpl::vector< BeginOfJob, DDDWorld, BeginOfRun, BeginOfEvent, BeginOfTrack, BeginOfStep, G4Step, EndOfTrack, EndOfEvent, EndOfRun > Signals
Definition:
SimActivityRegistryEnroller.h:76
type
type
Definition:
HCALResponse.h:21
SimActivityRegistry
Definition:
SimActivityRegistry.h:43
T
long double T
Definition:
Basic3DVectorLD.h:48
SimActivityRegistry::connect
void connect(Observer< const BeginOfJob * > *iObject)
Definition:
SimActivityRegistry.h:51
enroller_helper::LastEnrollerHelper::enroll
static void enroll(SimActivityRegistry &, T *)
Definition:
SimActivityRegistryEnroller.h:46
enroller_helper::Enrollment
Definition:
SimActivityRegistryEnroller.h:38
Generated for CMSSW Reference Manual by
1.8.16