CMS 3D CMS Logo

ThreadSafeStringCut.h
Go to the documentation of this file.
1 #ifndef RecoEgamma_EgammaTools_ThreadSafeStringCut_H
2 #define RecoEgamma_EgammaTools_ThreadSafeStringCut_H
3 
6 
7 #include <mutex>
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>
18 public:
19  ThreadSafeStringCut(const std::string& expr) // constructor
20  : func_(expr), expr_(expr) {}
21 
24 
25  typename std::invoke_result_t<F, T> operator()(const T& t) const {
26  std::lock_guard<std::mutex> guard(mutex_);
27  return func_(t);
28  }
29 
30 private:
31  const F func_;
34 };
35 
36 #endif
static boost::mutex mutex
Definition: Proxy.cc:9
std::invoke_result_t< F, T > operator()(const T &t) const
ThreadSafeStringCut(const std::string &expr)
const std::string expr_
#define CMS_THREAD_SAFE
#define noexcept
ThreadSafeStringCut(ThreadSafeStringCut &&other)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
long double T
def move(src, dest)
Definition: eostools.py:511