Main Page
Namespaces
Classes
Package Documentation
RecoEgamma
EgammaTools
interface
ThreadSafeStringCut.h
Go to the documentation of this file.
1
#ifndef RecoEgamma_EgammaTools_ThreadSafeStringCut_H
2
#define RecoEgamma_EgammaTools_ThreadSafeStringCut_H
3
4
#include "
CommonTools/Utils/interface/StringObjectFunction.h
"
5
#include "
CommonTools/Utils/interface/StringCutObjectSelector.h
"
6
7
#include <mutex>
8
#include "
FWCore/Utilities/interface/thread_safety_macros.h
"
9
10
/*
11
* This class is a simple wrapper around either a StringObjectFunction or
12
* StringCutObjectSelector to use them in a thread safe way.
13
*
14
*/
15
16
template
<
class
F,
class
T>
17
class
ThreadSafeStringCut
18
{
19
public
:
20
21
ThreadSafeStringCut
(
const
std::string
&
expr
)
// constructor
22
:
func_
(expr)
23
,
expr_
(expr)
24
{}
25
26
ThreadSafeStringCut
(
ThreadSafeStringCut
&&
other
)
noexcept
// move constructor
27
:
func_
(
std
::
move
(
other
.
func_
))
28
,
expr_
(
std
::
move
(
other
.
expr_
))
29
{}
30
31
typename
std::result_of<F&(T)>::type
operator()
(
const
T
&
t
)
const
32
{
33
std::lock_guard<std::mutex> guard(
mutex_
);
34
return
func_
(t);
35
}
36
37
private
:
38
39
const
F
func_
;
40
const
std::string
expr_
;
41
CMS_THREAD_SAFE
mutable
std::mutex
mutex_
;
42
};
43
44
#endif
type
type
Definition:
HCALResponse.h:21
ThreadSafeStringCut::func_
const F func_
Definition:
ThreadSafeStringCut.h:39
mutex
static boost::mutex mutex
Definition:
Proxy.cc:11
ThreadSafeStringCut::mutex_
std::mutex mutex_
Definition:
ThreadSafeStringCut.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
noexcept
#define noexcept
thread_safety_macros.h
std
Definition:
JetResolutionObject.h:80
StringObjectFunction.h
ThreadSafeStringCut::ThreadSafeStringCut
ThreadSafeStringCut(const std::string &expr)
Definition:
ThreadSafeStringCut.h:21
jets_cff.expr
expr
Definition:
jets_cff.py:222
StringCutObjectSelector.h
ThreadSafeStringCut::expr_
const std::string expr_
Definition:
ThreadSafeStringCut.h:40
trackingPlots.other
other
Definition:
trackingPlots.py:1439
CMS_THREAD_SAFE
#define CMS_THREAD_SAFE
ThreadSafeStringCut::operator()
std::result_of< F &(T)>::type operator()(const T &t) const
Definition:
ThreadSafeStringCut.h:31
ThreadSafeStringCut::ThreadSafeStringCut
ThreadSafeStringCut(ThreadSafeStringCut &&other)
Definition:
ThreadSafeStringCut.h:26
ThreadSafeStringCut
Definition:
ThreadSafeStringCut.h:17
lumiQTWidget.t
t
Definition:
lumiQTWidget.py:50
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition:
blowfish.cc:281
T
long double T
Definition:
Basic3DVectorLD.h:66
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Generated for CMSSW Reference Manual by
1.8.11