ATLAS Offline Software
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // VarHandleBase.cxx
8 // Implementation file for class VarHandleBase
9 // Author: Nils Krumnack <Nils.Erik.Krumnack@cern.ch>
10 // Author: Paolo Calafiura (for original)
11 // Author: S.Binet<binet@cern.ch> (for original)
13 
16 
17 // #include "AsgDataHandles/exceptions.h"
18 
19 // #include <algorithm>
20 #include <sstream>
21 
22 
23 namespace SG {
24 
25 
30  VarHandleBase::VarHandleBase(const std::string& sgkey) :
31  m_ownedKey (std::make_unique<VarHandleKey> (sgkey)),
32  m_key (m_ownedKey.get())
33  {
34  }
35 
36 
45  VarHandleBase::VarHandleBase (const VarHandleKey& key,
46  const EventContext* /*ctx*/)
47  : m_key (&key)
48  {
49  }
50 
51 
52 
53  //*************************************************************************
54  // Accessors
55  //
56 
57 
64  const std::string& VarHandleBase::key() const
65  {
66  return m_key->key();
67  }
68 
69 
75  const std::string& VarHandleBase::name() const
76  {
77  return this->key();
78  }
79 
80 
81 // /**
82 // * @brief Return the name of the store holding the object we are proxying.
83 // */
84 // std::string VarHandleBase::store() const
85 // {
86 // if (m_store)
87 // return m_store->name();
88 // return this->storeHandle().name();
89 // }
90 
91 
92  //*************************************************************************
93  // Protected methods.
94  //
95 
96 
97 //*************************************************************************
98  // Free functions.
99  //
100 
101 
107  std::ostream& operator<<( std::ostream& out, const VarHandleBase& o )
108  {
109  out << "VarHandleBase @" << &o
110  // << " store=" <<o.store()
111  << ", key=" <<o.key();
112  return out;
113  }
114 
115 
119  bool operator==(const VarHandleBase& l, const VarHandleBase& r)
120  {
121  return (l.name() == r.name());// &&
122  // l.store() == r.store());
123  }
124 
125 
129  bool operator!=(const VarHandleBase& l, const VarHandleBase& r)
130  {
131  return !(l==r);
132  }
133 
134 
135 } /* namespace SG */
SG::operator!=
bool operator!=(const VarHandleBase &l, const VarHandleBase &r)
Inequality comparison.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:129
beamspotman.r
def r
Definition: beamspotman.py:676
common.sgkey
def sgkey(tool)
Definition: common.py:1028
SG::VarHandleBase::VarHandleBase
VarHandleBase(CLID clid, Gaudi::DataHandle::Mode mode)
Constructor with default key.
Definition: StoreGate/src/VarHandleBase.cxx:113
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
SG::VarHandleBase
Base class for VarHandle types.
Definition: StoreGate/StoreGate/VarHandleBase.h:83
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
SG::operator==
bool operator==(const VarHandleBase &l, const VarHandleBase &r)
Equality comparison.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:119
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
VarHandleBase.h
Base class for VarHandle classes.
SG::VarHandleBase::m_key
const VarHandleKey * m_key
The associated key object.
Definition: StoreGate/StoreGate/VarHandleBase.h:523
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
SG::VarHandleKey
A property holding a SG store/key/clid from which a VarHandle is made.
Definition: StoreGate/StoreGate/VarHandleKey.h:62
SG::get
const T * get(const ReadHandleKey< T > &key)
Convenience function to retrieve an object given a ReadHandleKey.
SG::operator<<
std::ostream & operator<<(std::ostream &os, const ArenaAllocatorBase::Stats::Stat &stat)
Format a statistic structure.
Definition: ArenaAllocatorBase.cxx:62
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
VarHandleKey.h
A property holding a SG store/key/clid from which a VarHandle is made.