ATLAS Offline Software
Loading...
Searching...
No Matches
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 */
13
14
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
32namespace Athena {
33
34
86template <class DOBJ>
87class RecyclableDataObject : public DOBJ
88{
89public:
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
113private:
115 std::shared_ptr<queue_t> m_queue;
116};
117
118
124template <class DOBJ>
126{
127public:
130
131
136
137
142 template <typename... ARGS>
143 DOBJ* get (ARGS&&... args);
144
145
152
153
154private:
157 std::shared_ptr<queue_t> m_queue;
158};
159
160
161} // namespace Athena
162
163
165
166
167#endif // not ATHENAKERNEL_RECYCLABLEDATAOBJECT_H
virtual unsigned long release() override
DataObject release method.
std::shared_ptr< queue_t > m_queue
tbb::concurrent_queue< DOBJ * > queue_t
Underlying queue type holding these objects.
RecyclableDataObject(std::shared_ptr< queue_t > queue, ARGS &&... args)
Constructor.
std::shared_ptr< queue_t > m_queue
Shared reference to the actual queue.
DOBJ * get(ARGS &&... args)
Get an object, either a new one or one recycled from a previous event.
RecyclableDataObject< DOBJ >::queue_t queue_t
Underlying queue type holding these objects.
RecyclableDataQueue()
Constructor.
~RecyclableDataQueue()
Destructor.
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....