Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataObjectHandleProperty.cpp
Go to the documentation of this file.
2 
4 #include "GaudiKernel/System.h"
6 
7 #include <sstream>
8 
9 namespace Gaudi {
10  namespace Parsers {
12  DataObjID id;
13  auto sc = parse( id, s );
14  if ( sc ) v.setKey( std::move( id ) );
15  return sc;
16  }
17  } // namespace Parsers
18 
19  namespace Utils {
20  std::ostream& toStream( const DataObjectHandleBase& v, std::ostream& o ) { return o << v; }
21  } // namespace Utils
22 } // namespace Gaudi
23 
24 //---------------------------------------------------------------------------
25 
27  : PropertyWithHandlers( name, typeid( DataObjectHandleBase ) ), m_pValue( &ref ) {}
28 
29 //---------------------------------------------------------------------------
30 
32  if ( !Gaudi::Parsers::parse( *m_pValue, s ).isSuccess() ) { return StatusCode::FAILURE; }
34 }
35 
36 //---------------------------------------------------------------------------
37 
39  *m_pValue = value;
40  return useUpdateHandler();
41 }
42 
43 //---------------------------------------------------------------------------
44 
47  return m_pValue->toString();
48 }
49 
50 //---------------------------------------------------------------------------
52  // implicitly invokes useReadHandler()
53  out << toString();
54 }
55 
56 //---------------------------------------------------------------------------
57 
59  setValue( value );
60  return *this;
61 }
62 
63 //---------------------------------------------------------------------------
64 
66 
67 //---------------------------------------------------------------------------
68 
69 bool DataObjectHandleProperty::load( Property& destination ) const { return destination.assign( *this ); }
70 
71 //---------------------------------------------------------------------------
72 
73 bool DataObjectHandleProperty::assign( const Property& source ) { return fromString( source.toString() ).isSuccess(); }
74 
75 //---------------------------------------------------------------------------
76 
79  return *m_pValue;
80 }
bool load(Property &destination) const override
DataObjectHandleProperty & operator=(const DataObjectHandleBase &value)
DataObjectHandleBase * m_pValue
Pointer to the real property.
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
std::string toString() const
virtual void setKey(const DataObjID &key) const
Definition: DataHandle.h:44
Gaudi::Details::PropertyBase Property
backward compatibility hack for old Property base class
Definition: PropertyFwd.h:25
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
bool assign(const Property &source) override
DataObjectHandleProperty.h GaudiKernel/DataObjectHandleProperty.h.
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:805
void toStream(std::ostream &out) const override
value -> stream
STL class.
DataObjectHandleProperty * clone() const override
clones the current property
DataObjectHandleProperty(const std::string &name, DataObjectHandleBase &ref)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
std::ostream & toStream(const DataObjID &d, std::ostream &os)
Definition: DataObjID.cpp:82
T move(T...args)
bool setValue(const DataObjectHandleBase &value)
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:828
StatusCode fromString(const std::string &s) override
string -> value
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:831
string s
Definition: gaudirun.py:312
constexpr static const auto FAILURE
Definition: StatusCode.h:86
const DataObjectHandleBase & value() const
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1
std::string toString() const override
value -> string