ATLAS Offline Software
Loading...
Searching...
No Matches
VarHandleKeyProperty.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id$
12
13// STL includes
14#include <sstream>
15#include <map>
16#include <boost/tokenizer.hpp>
17
18// StoreGate includes
20
21static const char* const storeSeparator = "+";
22
23namespace Gaudi {
24namespace Parsers {
25
26
36StatusCode
37parse(SG::VarHandleKey& v, const std::string& s)
38{
39 std::string prop;
40 StatusCode sc = Gaudi::Parsers::parse(prop, s);
41 if (sc.isSuccess())
42 sc = v.assign (prop);
43 return sc;
44}
45
46} //> ns Parsers
47
48namespace Utils {
49
50
60std::ostream&
61toStream(const SG::VarHandleKey& v, std::ostream& o)
62{
63 o << "'" << v.storeHandle().name() << storeSeparator << v.key() << "'";
64 return o;
65}
66
67} //> ns Utils
68
69} //> ns Gaudi
70
71
72namespace SG {
73
74
82 : DataHandleProperty( name, ref ),
83 m_pValue( &ref )
84{
85}
86
96{
97 setValue( value );
98 return *this;
99}
100
101
110{
111 return new VarHandleKeyProperty( *this );
112}
113
114
123bool
124VarHandleKeyProperty::load( Gaudi::Details::PropertyBase& destination ) const
125{
126 return destination.assign( *this );
127}
128
129
138bool
139VarHandleKeyProperty::assign( const Gaudi::Details::PropertyBase& source )
140{
141 return fromString( source.toString() ).isSuccess();
142}
143
144
148std::string
150{
151 useReadHandler();
152 std::ostringstream o;
154 return o.str();
155}
156
157
162void
163VarHandleKeyProperty::toStream(std::ostream& out) const
164{
165 useReadHandler();
166 out << this->toString();
167}
168
169
176StatusCode
178{
179 if (!Gaudi::Parsers::parse(*m_pValue, s).isSuccess()) {
180 return StatusCode::FAILURE;
181 }
182 return useUpdateHandler()
183 ? StatusCode::SUCCESS
184 : StatusCode::FAILURE;
185}
186
187
191const SG::VarHandleKey&
193{
194 useReadHandler();
195 return *m_pValue;
196}
197
198
205bool
207{
208 m_pValue->operator=(value);
209 return useUpdateHandler();
210}
211
212
213} // 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.