ATLAS Offline Software
CondObjDeleter.icc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
3  */
4 /**
5  * @file AthenaKernel/CondObjDeleter.icc
6  * @author scott snyder <snyder@bnl.gov>
7  * @date Jun, 2022
8  * @brief Deletion object for conditions payloads.
9  */
10 
11 
12 namespace Athena {
13 
14 
15 /**
16  * @brief Constructor.
17  * @param rcusvc Service with which to register.
18  */
19 template <class T>
20 CondObjDeleter<T>::CondObjDeleter (Athena::IRCUSvc& rcusvc)
21  : CxxUtils::IRangeMapPayloadDeleter<void, EventContext> (delPayload),
22  m_obj (rcusvc, Athena::IRCUObject::NoObject)
23 {
24 }
25 
26 
27 /**
28  * @brief Queue an object for deletion.
29  * @param p The object to delete.
30  *
31  * The object should not actually be deleted until @c quiescent has been
32  * called for each active slot.
33  */
34 template <class T>
35 void CondObjDeleter<T>::discard (const void* p)
36 {
37  const T* pp = static_cast<const T*> (p);
38  m_obj.discard (std::unique_ptr<const T> (pp));
39 }
40 
41 
42 /**
43  * @brief Mark a slot as quiescent.
44  * @param ctx Event context identifying the slot.
45  */
46 template <class T>
47 void CondObjDeleter<T>::quiescent (const EventContext& ctx)
48 {
49  m_obj.quiescent (ctx);
50 }
51 
52 
53 /**
54  * @brief Function to delete a payload object immediately.
55  */
56 template <class T>
57 void CondObjDeleter<T>::delPayload (const void* p)
58 {
59  delete static_cast<const T*>(p);
60 }
61 
62 
63 } // namespace Athena
64