Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite SimActivityRegistryEnroller with variadic types #33202

Merged
merged 6 commits into from Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
276 changes: 276 additions & 0 deletions SimG4Core/Notification/go.1
@@ -0,0 +1,276 @@
>> Local Products Rules ..... started
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops! will fix that

>> Local Products Rules ..... done
>> Entering Package SimG4Core/Notification
>> Compiling /dlange/210317/CMSSW_11_3_X_2021-03-16-2300/src/SimG4Core/Notification/test/simactivityregistryNew_t.cppunit.cpp
In file included from /cvmfs/cms-ib.cern.ch/nweek-02672/slc7_amd64_gcc900/external/boost/1.75.0-edb1ce683d8b13eb6857b17c4cf93614/include/boost/bind.hpp:30,
from /dlange/210317/CMSSW_11_3_X_2021-03-16-2300/src/SimG4Core/Notification/interface/SimActivityRegistry.h:22,
from /dlange/210317/CMSSW_11_3_X_2021-03-16-2300/src/SimG4Core/Notification/test/simactivityregistryNew_t.cppunit.cpp:10:
/cvmfs/cms-ib.cern.ch/nweek-02672/slc7_amd64_gcc900/external/boost/1.75.0-edb1ce683d8b13eb6857b17c4cf93614/include/boost/bind.hpp:36:1: note: #pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.
36 | BOOST_PRAGMA_MESSAGE(
| ^~~~~~~~~~~~~~~~~~~~
>> Building binary newtestSimG4CoreNotifications
Copying tmp/slc7_amd64_gcc900/src/SimG4Core/Notification/test/newtestSimG4CoreNotifications/newtestSimG4CoreNotifications to productstore area:
>> Leaving Package SimG4Core/Notification
>> Package SimG4Core/Notification built
Creating test log file logs/slc7_amd64_gcc900/testing.log
Package SimG4Core/Notification: Running test newtestSimG4CoreNotifications

===== Test "newtestSimG4CoreNotifications" ====
Running ...N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_18NoSignalE
ok N12_GLOBAL__N_18NoSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_19OneSignalE
ok N12_GLOBAL__N_19OneSignalE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_110TwoSignalsE
ok N12_GLOBAL__N_110TwoSignalsE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfRunEE
ok N12_GLOBAL__N_18CountingI10BeginOfRunEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI10BeginOfJobEE
ok N12_GLOBAL__N_18CountingI10BeginOfJobEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfEventEE
ok N12_GLOBAL__N_18CountingI12BeginOfEventEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI12BeginOfTrackEE
ok N12_GLOBAL__N_18CountingI12BeginOfTrackEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI8DDDWorldEE
ok N12_GLOBAL__N_18CountingI8DDDWorldEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI6G4StepEE
ok N12_GLOBAL__N_18CountingI6G4StepEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI8EndOfRunEE
ok N12_GLOBAL__N_18CountingI8EndOfRunEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfEventEE
ok N12_GLOBAL__N_18CountingI10EndOfEventEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE
N12_GLOBAL__N_18CountingI10EndOfTrackEE
ok N12_GLOBAL__N_18CountingI10EndOfTrackEE


OK (3)

---> test newtestSimG4CoreNotifications succeeded

^^^^ End Test newtestSimG4CoreNotifications ^^^^
Package SimG4Core/Notification: Running test testSimG4CoreNotifications

===== Test "testSimG4CoreNotifications" ====
Running ...

OK (3)

---> test testSimG4CoreNotifications succeeded

^^^^ End Test testSimG4CoreNotifications ^^^^
>> Tests for package SimG4Core/Notification ran.
4 changes: 0 additions & 4 deletions SimG4Core/Notification/interface/SimActivityRegistry.h
Expand Up @@ -18,10 +18,6 @@
// Created: Sun Nov 13 11:43:40 EST 2005
//

// system include files
#include "boost/bind.hpp"
#include "boost/mem_fn.hpp"

// user include files
#include "SimG4Core/Notification/interface/Signaler.h"

Expand Down
60 changes: 19 additions & 41 deletions SimG4Core/Notification/interface/SimActivityRegistryEnroller.h
Expand Up @@ -17,17 +17,6 @@
// Original Author: Chris Jones
// Created: Sun Nov 13 15:08:12 EST 2005
//

// system include files
#include "boost/mpl/pop_back.hpp"
#include "boost/mpl/begin_end.hpp"
#include "boost/mpl/copy_if.hpp"
#include "boost/mpl/deref.hpp"
#include "boost/mpl/prior.hpp"
#include "boost/mpl/vector.hpp"
#include "boost/mpl/eval_if.hpp"
#include "boost/mpl/empty.hpp"

// user include files
#include "SimG4Core/Notification/interface/Observer.h"
#include "SimG4Core/Notification/interface/SimActivityRegistry.h"
Expand All @@ -40,47 +29,36 @@ namespace enroller_helper {
static void enroll(SimActivityRegistry&, void*) {}
};

//this class is used to terminate our recursion
template <class T>
struct LastEnrollerHelper {
static void enroll(SimActivityRegistry&, T*) {}
};

template <class T, class TVector>
struct EnrollerHelper {
typedef typename boost::mpl::pop_back<TVector>::type RemainingVector;
static void enroll(SimActivityRegistry& iReg, T* iT) {
//Try to enroll the object if it inherits from the class at the
// end of TVector
Enrollment<typename boost::mpl::deref<
typename boost::mpl::prior<typename boost::mpl::end<TVector>::type>::type>::type>::enroll(iReg, iT);
static void enroll(SimActivityRegistry& iReg, T* iT) {}

//If TVector is not at its end, call EnrollerHelper with a vector
// that had our last type 'popped off' the end
typedef typename boost::mpl::eval_if<
boost::mpl::empty<TVector>,
boost::mpl::identity<LastEnrollerHelper<T> >,
boost::mpl::identity<EnrollerHelper<T, typename boost::mpl::pop_back<TVector>::type> > >::type NextEnroller;
NextEnroller::enroll(iReg, iT);
}
};
template <class T, class F, class... TVector>
static void enroll(SimActivityRegistry& iReg, T* iT) {
//Try to enroll the object if it inherits from the class at the
// start of TVector
Enrollment<F>::enroll(iReg, iT);
enroll<T, TVector...>(iReg, iT);
}

} // namespace enroller_helper

class SimActivityRegistryEnroller {
public:
SimActivityRegistryEnroller() {}
//virtual ~SimActivityRegistryEnroller();
typedef boost::mpl::
vector<BeginOfJob, DDDWorld, BeginOfRun, BeginOfEvent, BeginOfTrack, BeginOfStep, G4Step, EndOfTrack, EndOfEvent, EndOfRun>
Signals;

// ---------- const member functions ---------------------

// ---------- static member functions --------------------
template <class T>
static void enroll(SimActivityRegistry& iReg, T* iObj) {
enroller_helper::EnrollerHelper<T, Signals>::enroll(iReg, iObj);
enroller_helper::enroll<T,
BeginOfJob,
DDDWorld,
BeginOfRun,
BeginOfEvent,
BeginOfTrack,
BeginOfStep,
G4Step,
EndOfTrack,
EndOfEvent,
EndOfRun>(iReg, iObj);
}

// stop default
Expand Down
1 change: 0 additions & 1 deletion SimG4Core/Notification/test/BuildFile.xml
@@ -1,4 +1,3 @@
<use name="boost"/>
<use name="cppunit"/>
<use name="SimG4Core/Notification"/>
<bin name="testSimG4CoreNotifications" file="simactivityregistry_t.cppunit.cpp">
Expand Down