FWCore
Utilities
interface
Signal.h
Go to the documentation of this file.
1
#ifndef FWCore_ServiceRegistry_Signal_h
2
#define FWCore_ServiceRegistry_Signal_h
3
// -*- C++ -*-
4
//
5
// Package: ServiceRegistry
6
// Class : Signal
7
//
19
//
20
// Original Author: Chris Jones
21
// Created: Thu Jan 17 16:03:51 CST 2013
22
//
23
24
// system include files
25
#include <vector>
26
#include <functional>
27
28
// user include files
29
30
// forward declarations
31
32
namespace
edm
{
33
namespace
signalslot {
34
template
<
typename
T>
35
class
Signal
{
36
public
:
37
typedef
std::function<T>
slot_type
;
38
typedef
std::vector<slot_type>
slot_list_type
;
39
40
Signal
() =
default
;
41
~Signal
() =
default
;
42
Signal
(
Signal
&&) =
default
;
43
44
// ---------- const member functions ---------------------
45
template
<
typename
... Args>
46
void
emit
(Args&&...
args
)
const
{
47
for
(
auto
& slot :
m_slots
) {
48
slot(std::forward<Args>(
args
)...);
49
}
50
}
51
52
template
<
typename
... Args>
53
void
operator()
(Args&&...
args
)
const
{
54
emit
(std::forward<Args>(
args
)...);
55
}
56
57
slot_list_type
const
&
slots
()
const
{
return
m_slots
; }
58
// ---------- static member functions --------------------
59
60
// ---------- member functions ---------------------------
61
template
<
typename
U>
62
void
connect
(
U
iFunc) {
63
m_slots
.push_back(std::function<T>(iFunc));
64
}
65
66
template
<
typename
U>
67
void
connect_front
(
U
iFunc) {
68
m_slots
.insert(
m_slots
.begin(), std::function<T>(iFunc));
69
}
70
71
private
:
72
Signal
(
const
Signal
&) =
delete
;
// stop default
73
74
const
Signal
&
operator=
(
const
Signal
&) =
delete
;
// stop default
75
76
// ---------- member data --------------------------------
77
slot_list_type
m_slots
;
78
};
79
}
// namespace signalslot
80
}
// namespace edm
81
82
#endif
writedatasetfile.args
args
Definition:
writedatasetfile.py:18
edm::signalslot::Signal::emit
void emit(Args &&... args) const
Definition:
Signal.h:46
edm::signalslot::Signal::operator=
const Signal & operator=(const Signal &)=delete
edm
HLT enums.
Definition:
AlignableModifier.h:19
Signal
Definition:
vlib.h:28
edm::signalslot::Signal::~Signal
~Signal()=default
edm::signalslot::Signal::m_slots
slot_list_type m_slots
Definition:
Signal.h:77
edm::signalslot::Signal::connect_front
void connect_front(U iFunc)
Definition:
Signal.h:67
mitigatedMETSequence_cff.U
U
Definition:
mitigatedMETSequence_cff.py:36
edm::signalslot::Signal::operator()
void operator()(Args &&... args) const
Definition:
Signal.h:53
edm::signalslot::Signal::slots
slot_list_type const & slots() const
Definition:
Signal.h:57
edm::signalslot::Signal::slot_type
std::function< T > slot_type
Definition:
Signal.h:37
edm::signalslot::Signal::slot_list_type
std::vector< slot_type > slot_list_type
Definition:
Signal.h:38
edm::signalslot::Signal::connect
void connect(U iFunc)
Definition:
Signal.h:62
edm::signalslot::Signal
Definition:
DelayedReader.h:26
edm::signalslot::Signal::Signal
Signal()=default
Generated for CMSSW Reference Manual by
1.8.16