ATLAS Offline Software
RecyclableDataObject.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
4 */
5 /*
6  */
15 #ifndef ATHENAKERNEL_RECYCLABLEDATAOBJECT_H
16 #define ATHENAKERNEL_RECYCLABLEDATAOBJECT_H
17 
18 
19 // tbb/machine/gcc_generic.h has spurious trailing semicolons after
20 // the clz() functiosn (as of TBB 2019 U1).
21 #if defined(__GNUC__)
22 # pragma GCC diagnostic push
23 # pragma GCC diagnostic ignored "-Wpedantic"
24 #endif
25 #include "tbb/concurrent_queue.h"
26 #if defined(__GNUC__)
27 # pragma GCC diagnostic pop
28 #endif
29 #include <memory>
30 
31 
32 namespace Athena {
33 
34 
86 template <class DOBJ>
87 class RecyclableDataObject : public DOBJ
88 {
89 public:
91  typedef tbb::concurrent_queue<DOBJ*> queue_t;
92 
93 
99  template <typename... ARGS>
100  RecyclableDataObject (std::shared_ptr<queue_t> queue, ARGS&&... args);
101 
102 
110  virtual unsigned long release() override;
111 
112 
113 private:
115  std::shared_ptr<queue_t> m_queue;
116 };
117 
118 
124 template <class DOBJ>
126 {
127 public:
130 
131 
136 
137 
142  template <typename... ARGS>
143  DOBJ* get (ARGS&&... args);
144 
145 
152 
153 
154 private:
157  std::shared_ptr<queue_t> m_queue;
158 };
159 
160 
161 } // namespace Athena
162 
163 
165 
166 
167 #endif // not ATHENAKERNEL_RECYCLABLEDATAOBJECT_H
Athena::RecyclableDataObject::queue_t
tbb::concurrent_queue< DOBJ * > queue_t
Underlying queue type holding these objects.
Definition: RecyclableDataObject.h:91
Athena::RecyclableDataQueue
Holder for recyclable objects.
Definition: RecyclableDataObject.h:126
Athena::RecyclableDataQueue::queue_t
RecyclableDataObject< DOBJ >::queue_t queue_t
Underlying queue type holding these objects.
Definition: RecyclableDataObject.h:129
Athena::RecyclableDataQueue::~RecyclableDataQueue
~RecyclableDataQueue()
Destructor.
Athena::RecyclableDataQueue::get
DOBJ * get(ARGS &&... args)
Get an object, either a new one or one recycled from a previous event.
Athena
Some weak symbol referencing magic...
Definition: AthLegacySequence.h:21
RecyclableDataObject.icc
beamspotman.queue
string queue
Definition: beamspotman.py:347
Athena::RecyclableDataQueue::RecyclableDataQueue
RecyclableDataQueue()
Constructor.
Athena::RecyclableDataQueue::m_queue
std::shared_ptr< queue_t > m_queue
Shared reference to the actual queue.
Definition: RecyclableDataObject.h:157
Athena::RecyclableDataObject::release
virtual unsigned long release() override
DataObject release method.
Athena::RecyclableDataObject
Helper for recycling objects from event to event.
Definition: RecyclableDataObject.h:88
Athena::RecyclableDataObject::RecyclableDataObject
RecyclableDataObject(std::shared_ptr< queue_t > queue, ARGS &&... args)
Constructor.
Athena::RecyclableDataObject::m_queue
std::shared_ptr< queue_t > m_queue
The queue on which this object will be placed when it is recycled.
Definition: RecyclableDataObject.h:115
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80