ATLAS Offline Software
Loading...
Searching...
No Matches
VarHandleKeyProperty.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
11
12// STL includes
13#include <sstream>
14#include <map>
15
16// StoreGate includes
18
19static const char* const storeSeparator = "+";
20
21namespace Gaudi {
22namespace Parsers {
23
24
34StatusCode
35parse(SG::VarHandleKey& v, const std::string& s)
36{
37 std::string prop;
38 StatusCode sc = Gaudi::Parsers::parse(prop, s);
39 if (sc.isSuccess())
40 sc = v.assign (prop);
41 return sc;
42}
43
44} //> ns Parsers
45
46namespace Utils {
47
48
58std::ostream&
59toStream(const SG::VarHandleKey& v, std::ostream& o)
60{
61 o << "'" << v.storeHandle().name() << storeSeparator << v.key() << "'";
62 return o;
63}
64
65} //> ns Utils
66
67} //> ns Gaudi
68
69
70namespace SG {
71
72
80 : DataHandleProperty( name, ref ),
81 m_pValue( &ref )
82{
83}
84
85
87 * @brief Assignment operator.
88 * @param value Value from which to assign.
89 *
90 * Copy the value object which we control from another value object.
91 */
94{
95 setValue( value );
96 return *this;
97}
98
99
108{
109 return new VarHandleKeyProperty( *this );
110}
111
112
121bool
122VarHandleKeyProperty::load( Gaudi::Details::PropertyBase& destination ) const
123{
124 return destination.assign( *this );
125}
126
127
136bool
137VarHandleKeyProperty::assign( const Gaudi::Details::PropertyBase& source )
138{
139 return fromString( source.toString() ).isSuccess();
140}
141
142
146std::string
148{
149 useReadHandler();
150 std::ostringstream o;
152 return o.str();
153}
154
155
160void
161VarHandleKeyProperty::toStream(std::ostream& out) const
162{
163 useReadHandler();
164 out << this->toString();
165}
166
167
174StatusCode
176{
177 if (!Gaudi::Parsers::parse(*m_pValue, s).isSuccess()) {
178 return StatusCode::FAILURE;
179 }
180 return useUpdateHandler()
181 ? StatusCode::SUCCESS
182 : StatusCode::FAILURE;
183}
184
185
189const SG::VarHandleKey&
191{
192 useReadHandler();
193 return *m_pValue;
194}
195
196
203bool
205{
206 m_pValue->operator=(value);
207 return useUpdateHandler();
208}
209
210
211} // namespace SG
const boost::regex ref(r_ef)
static Double_t sc
constexpr char const storeSeparator
Handle Gaudi property setting for VarHandleKey.
VarHandleKeyProperty(const std::string &name, SG::VarHandleKey &ref)
Constructor with parameters.
VarHandleKeyProperty is the class which wraps a SG::VarHandleKey.
bool setValue(const SG::VarHandleKey &value)
Set the value object for this Property.
VarHandleKeyProperty(const std::string &name, SG::VarHandleKey &ref)
Constructor with parameters.
virtual VarHandleKeyProperty * clone() const override
Return a new copy of this Property object.
VarHandleKeyProperty & operator=(const SG::VarHandleKey &value)
Assignment operator.
const SG::VarHandleKey & value() const
Return the value object for this Property.
virtual bool load(Gaudi::Details::PropertyBase &destination) const override
Set the value of another Property.
virtual StatusCode fromString(const std::string &s) override
Set this value object from a string.
virtual void toStream(std::ostream &out) const override
Write a string representation of the value object to a stream.
virtual bool assign(const Gaudi::Details::PropertyBase &source) override
Set the value of this Property from another.
SG::VarHandleKey * m_pValue
Pointer to the real property.
virtual std::string toString() const override
Return a string representation of the value object.
A property holding a SG store/key/clid from which a VarHandle is made.
StatusCode parse(std::tuple< Tup... > &tup, const Gaudi::Parsers::InputData &input)
std::ostream & toStream(const SG::VarHandleKeyArray &v, std::ostream &o)
Gaudi function used to convert a property to a string.
=============================================================================
Forward declaration.