Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
{
34
35
public
:
36
37
BlockingWrapper
(Func iFunc):
func_
(iFunc),
numBlocks_
(0) {}
38
//virtual ~BlockingWrapper();
39
40
// ---------- const member functions ---------------------
41
template
<
typename
...
Args
>
42
void
operator()
(
Args
&&...
args
) {
43
std::shared_ptr<void> guard(static_cast<void*>(0), std::bind(&
BlockingWrapper::unblock
,
this
) );
44
if
(
startBlocking
() ) {
func_
(std::forward<Args>(
args
)...); }
45
}
46
47
// ---------- static member functions --------------------
48
49
// ---------- member functions ---------------------------
50
51
private
:
52
// ---------- member data --------------------------------
53
bool
startBlocking
() {
return
1 == ++
numBlocks_
; }
54
void
unblock
() { --
numBlocks_
;}
55
Func
func_
;
56
int
numBlocks_
;
57
};
58
59
template
<
class
Func,
class
Signal>
60
void
61
connect_but_block_self
(
Signal
& oSignal,
const
Func& iFunc) {
62
oSignal.connect(
BlockingWrapper<Func>
(iFunc));
63
}
64
}
65
}
66
67
#endif
Args
Definition:
hcalDeleteObject.cc:41
edm::serviceregistry::BlockingWrapper::operator()
void operator()(Args &&...args)
Definition:
connect_but_block_self.h:42
edm::serviceregistry::BlockingWrapper::numBlocks_
int numBlocks_
Definition:
connect_but_block_self.h:56
edm::serviceregistry::BlockingWrapper::func_
Func func_
Definition:
connect_but_block_self.h:55
edm::serviceregistry::BlockingWrapper::unblock
void unblock()
Definition:
connect_but_block_self.h:54
ExtractAppInfoFromXML.args
args
Definition:
ExtractAppInfoFromXML.py:291
Signal.h
edm::serviceregistry::BlockingWrapper::BlockingWrapper
BlockingWrapper(Func iFunc)
Definition:
connect_but_block_self.h:37
edm::serviceregistry::BlockingWrapper::startBlocking
bool startBlocking()
Definition:
connect_but_block_self.h:53
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:61
Signal
Definition:
vlib.h:39
Generated for CMSSW Reference Manual by
1.8.5