Main Page
Namespaces
Classes
Package Documentation
FWCore
ServiceRegistry
interface
connect_but_block_self.h
Go to the documentation of this file.
1
#ifndef ServiceRegistry_connect_but_block_self_h
2
#define ServiceRegistry_connect_but_block_self_h
3
// -*- C++ -*-
4
//
5
// Package: ServiceRegistry
6
// Class : connect_but_block_self
7
//
17
//
18
// Original Author: Chris Jones
19
// Created: Thu Sep 22 20:42:32 CEST 2005
20
//
21
22
// system include files
23
#include <memory>
24
#include "
FWCore/Utilities/interface/Signal.h
"
25
26
// user include files
27
28
// forward declarations
29
namespace
edm
{
30
namespace
serviceregistry {
31
template
<
typename
Func>
32
class
BlockingWrapper
{
33
public
:
34
BlockingWrapper
(Func iFunc) :
func_
(iFunc),
numBlocks_
(0) {}
35
//virtual ~BlockingWrapper();
36
37
// ---------- const member functions ---------------------
38
template
<
typename
... Args>
39
void
operator()
(Args&&...
args
) {
40
std::shared_ptr<void> guard(static_cast<void*>(
nullptr
), std::bind(&
BlockingWrapper::unblock
,
this
));
41
if
(
startBlocking
()) {
42
func_
(std::forward<Args>(
args
)...);
43
}
44
}
45
46
// ---------- static member functions --------------------
47
48
// ---------- member functions ---------------------------
49
50
private
:
51
// ---------- member data --------------------------------
52
bool
startBlocking
() {
return
1 == ++
numBlocks_
; }
53
void
unblock
() { --
numBlocks_
; }
54
Func
func_
;
55
int
numBlocks_
;
56
};
57
58
template
<
class
Func,
class
Signal>
59
void
connect_but_block_self
(
Signal
& oSignal,
const
Func& iFunc) {
60
oSignal.connect(
BlockingWrapper<Func>
(iFunc));
61
}
62
}
// namespace serviceregistry
63
}
// namespace edm
64
65
#endif
edm::serviceregistry::BlockingWrapper::operator()
void operator()(Args &&...args)
Definition:
connect_but_block_self.h:39
edm::serviceregistry::BlockingWrapper::numBlocks_
int numBlocks_
Definition:
connect_but_block_self.h:55
edm::serviceregistry::BlockingWrapper::func_
Func func_
Definition:
connect_but_block_self.h:54
edm::serviceregistry::BlockingWrapper::unblock
void unblock()
Definition:
connect_but_block_self.h:53
Signal.h
edm::serviceregistry::BlockingWrapper::BlockingWrapper
BlockingWrapper(Func iFunc)
Definition:
connect_but_block_self.h:34
edm::serviceregistry::BlockingWrapper::startBlocking
bool startBlocking()
Definition:
connect_but_block_self.h:52
writedatasetfile.args
args
Definition:
writedatasetfile.py:18
edm
HLT enums.
Definition:
AlignableModifier.h:17
edm::serviceregistry::BlockingWrapper
Definition:
connect_but_block_self.h:32
edm::serviceregistry::connect_but_block_self
void connect_but_block_self(Signal &oSignal, const Func &iFunc)
Definition:
connect_but_block_self.h:59
Signal
Definition:
vlib.h:39
Generated for CMSSW Reference Manual by
1.8.11