ATLAS Offline Software
UpdateHandleKey.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id$
6 /**
7  * @file StoreGate/UpdateHandleKey.icc
8  * @author scott snyder <snyder@bnl.gov>
9  * @date Feb, 2016
10  * @brief Property holding a SG store/key/clid from which an UpdateHandle is made.
11  */
12 
13 
14 namespace 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  */
26 template <class T>
27 UpdateHandleKey<T>::UpdateHandleKey (const std::string& key /*= ""*/,
28  const std::string& storeName /*= "StoreGateSvc"*/)
29  : VarHandleKey (ClassID_traits<T>::ID(), key,
30  Gaudi::DataHandle::Reader,
31  storeName)
32 {
33 }
34 
35 /**
36  * @brief auto-declaring Property Constructor.
37  * @param owner Owning component.
38  * @param name name of the Property
39  * @param key default StoreGate key for the object.
40  * @param doc Documentation string.
41  *
42  * will associate the named Property with this WHK via declareProperty
43  *
44  * The provided key may actually start with the name of the store,
45  * separated by a "+": "MyStore+Obj". If no "+" is present
46  * the store named by @c storeName is used.
47  */
48 template <class T>
49 template <class OWNER,
50  typename /*= typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type*/>
51 inline
52 UpdateHandleKey<T>::UpdateHandleKey( OWNER* owner,
53  std::string name,
54  const std::string& key /*= {}*/,
55  std::string doc /*= ""*/)
56  : UpdateHandleKey<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 /**
65  * @brief Change the key of the object to which we're referring.
66  * @param sgkey The StoreGate key for the object.
67  *
68  * The provided key may actually start with the name of the store,
69  * separated by a "+": "MyStore+Obj". If no "+" is present,
70  * the store is not changed.
71  */
72 template <class T>
73 UpdateHandleKey<T>& UpdateHandleKey<T>::operator= (const std::string& sgkey)
74 {
75  VarHandleKey::operator= (sgkey);
76  return *this;
77 }
78 
79 
80 } // namespace SG