ThreadsafeGalleryEvent.h
Go to the documentation of this file.
1 #ifndef WEBEVD_THREADSAFEGALLERYEVENT_H
2 #define WEBEVD_THREADSAFEGALLERYEVENT_H
3 
4 #include "gallery/Event.h"
5 
6 #include <mutex>
7 
8 namespace evd
9 {
10  /// gallery::Event is not designed to be threadsafe. Serializing calls
11  /// through this wrapper should be more efficient than giving up on threading
12  /// as a whole. This way we can still write and transfer the PNGs in parallel
13  /// for example.
15  {
16  public:
17  template<class PROD> using HandleT = gallery::Event::template HandleT<PROD>;
18 
20  {
21  }
22 
23  template<class T>
25  {
26  std::lock_guard guard(fLock);
27  return fEvt->getByLabel(tag, result);
28  }
29 
30  template<class T>
31  std::vector<art::InputTag> getInputTags() const
32  {
33  std::lock_guard guard(fLock);
34  return fEvt->getInputTags<T>();
35  }
36 
38  {
39  std::lock_guard guard(fLock);
40  return fEvt->eventAuxiliary();
41  }
42 
43  protected:
44  mutable std::mutex fLock;
46  };
47 }
48 
49 #endif
static QCString result
art::EventAuxiliary const & eventAuxiliary() const
Definition: Event.cc:35
ThreadsafeGalleryEvent(const gallery::Event *evt)
std::vector< art::InputTag > getInputTags() const
Definition: Event.h:218
LArSoft includes.
Definition: InfoTransfer.h:33
std::vector< art::InputTag > getInputTags() const
const art::EventAuxiliary & eventAuxiliary() const
bool getByLabel(art::InputTag const &, Handle< PROD > &result) const
Definition: Event.h:174
gallery::Event::template HandleT< PROD > HandleT
TCEvent evt
Definition: DataStructs.cxx:7
bool getByLabel(const art::InputTag &tag, gallery::Handle< T > &result) const