ATLAS Offline Software
Loading...
Searching...
No Matches
UpdateHandleKey.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5/**
6 * @file StoreGate/UpdateHandleKey.icc
7 * @author scott snyder <snyder@bnl.gov>
8 * @date Feb, 2016
9 * @brief Property holding a SG store/key/clid from which an UpdateHandle is made.
10 */
11
12
13namespace SG {
14
15
16/**
17 * @brief Constructor.
18 * @param key The StoreGate key for the object.
19 * @param storeName Name to use for the store, if it's not encoded in sgkey.
20 *
21 * The provided key may actually start with the name of the store,
22 * separated by a "+": "MyStore+Obj". If no "+" is present
23 * the store named by @c storeName is used.
24 */
25template <class T>
26UpdateHandleKey<T>::UpdateHandleKey (const std::string& key /*= ""*/,
27 const std::string& storeName /*= "StoreGateSvc"*/)
28 : VarHandleKey (ClassID_traits<T>::ID(), key,
29 Gaudi::DataHandle::Reader,
30 storeName)
31{
32}
33
34/**
35 * @brief auto-declaring Property Constructor.
36 * @param owner Owning component.
37 * @param name name of the Property
38 * @param key default StoreGate key for the object.
39 * @param doc Documentation string.
40 *
41 * will associate the named Property with this WHK via declareProperty
42 *
43 * The provided key may actually start with the name of the store,
44 * separated by a "+": "MyStore+Obj". If no "+" is present
45 * the store named by @c storeName is used.
46 */
47template <class T>
48template <std::derived_from<IProperty> OWNER>
49inline
50UpdateHandleKey<T>::UpdateHandleKey( OWNER* owner,
51 std::string name,
52 const std::string& key /*= {}*/,
53 std::string doc /*= ""*/)
54 : UpdateHandleKey<T> (key)
55{
56 auto p = owner->declareProperty(std::move(name), *this, std::move(doc));
57 p->template setOwnerType<OWNER>();
58}
59
60
61
62/**
63 * @brief Change the key of the object to which we're referring.
64 * @param sgkey The StoreGate key for the object.
65 *
66 * The provided key may actually start with the name of the store,
67 * separated by a "+": "MyStore+Obj". If no "+" is present,
68 * the store is not changed.
69 */
70template <class T>
71UpdateHandleKey<T>& UpdateHandleKey<T>::operator= (const std::string& sgkey)
72{
73 VarHandleKey::operator= (sgkey);
74 return *this;
75}
76
77
78} // namespace SG