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