The Gaudi Framework  v30r3 (a5ef0a68)
DataObjectHandleProperty.cpp
Go to the documentation of this file.
2 
4 #include "GaudiKernel/Parsers.h"
5 #include "GaudiKernel/System.h"
6 
7 #include <sstream>
8 
9 namespace Gaudi
10 {
11  namespace Parsers
12  {
14  {
15  DataObjID id;
16  auto sc = parse( id, s );
17  if ( sc ) v.setKey( std::move( id ) );
18  return sc;
19  }
20  }
21 
22  namespace Utils
23  {
24  std::ostream& toStream( const DataObjectHandleBase& v, std::ostream& o ) { return o << v; }
25  }
26 }
27 
28 //---------------------------------------------------------------------------
29 
31  : PropertyWithHandlers( name, typeid( DataObjectHandleBase ) ), m_pValue( &ref )
32 {
33 }
34 
35 //---------------------------------------------------------------------------
36 
38 {
39  if ( !Gaudi::Parsers::parse( *m_pValue, s ).isSuccess() ) {
40  return StatusCode::FAILURE;
41  }
43 }
44 
45 //---------------------------------------------------------------------------
46 
48 {
49  *m_pValue = value;
50  return useUpdateHandler();
51 }
52 
53 //---------------------------------------------------------------------------
54 
56 {
58  return m_pValue->toString();
59 }
60 
61 //---------------------------------------------------------------------------
63 {
64  // implicitly invokes useReadHandler()
65  out << toString();
66 }
67 
68 //---------------------------------------------------------------------------
69 
71 {
72  setValue( value );
73  return *this;
74 }
75 
76 //---------------------------------------------------------------------------
77 
79 
80 //---------------------------------------------------------------------------
81 
82 bool DataObjectHandleProperty::load( Property& destination ) const { return destination.assign( *this ); }
83 
84 //---------------------------------------------------------------------------
85 
86 bool DataObjectHandleProperty::assign( const Property& source ) { return fromString( source.toString() ).isSuccess(); }
87 
88 //---------------------------------------------------------------------------
89 
91 {
93  return *m_pValue;
94 }
bool load(Property &destination) const override
constexpr static const auto FAILURE
Definition: StatusCode.h:88
DataObjectHandleProperty & operator=(const DataObjectHandleBase &value)
DataObjectHandleBase * m_pValue
Pointer to the real property.
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
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:46
Gaudi::Details::PropertyBase Property
backward compatibility hack for old Property base class
Definition: PropertyFwd.h:28
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:856
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:51
std::ostream & toStream(const DataObjID &d, std::ostream &os)
Definition: DataObjID.cpp:92
T move(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
bool setValue(const DataObjectHandleBase &value)
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:882
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:885
string s
Definition: gaudirun.py:253
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