The Gaudi Framework  master (594c33fa)
DataHandleProperty Class Reference

DataHandleProperty.h GaudiKernel/DataHandleProperty.h. More...

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/DataHandleProperty.h>

Inheritance diagram for DataHandleProperty:
Collaboration diagram for DataHandleProperty:

Public Member Functions

 DataHandleProperty (const std::string &name, Gaudi::DataHandle &ref)
 
DataHandlePropertyoperator= (const Gaudi::DataHandle &value)
 
DataHandlePropertyclone () const override
 clones the current property More...
 
bool load (Gaudi::Details::PropertyBase &destination) const override
 export the property value to the destination More...
 
bool assign (const Gaudi::Details::PropertyBase &source) override
 import the property value form the source More...
 
std::string toString () const override
 value -> string More...
 
void toStream (std::ostream &out) const override
 value -> stream More...
 
StatusCode fromString (const std::string &s) override
 string -> value More...
 
const Gaudi::DataHandlevalue () const
 
bool setValue (const Gaudi::DataHandle &value)
 
- Public Member Functions inherited from PropertyWithHandlers<>
PropertyBasedeclareReadHandler (std::function< void(PropertyBase &)> fun) override
 set new callback for reading More...
 
PropertyBasedeclareUpdateHandler (std::function< void(PropertyBase &)> fun) override
 set new callback for update More...
 
const std::function< void(PropertyBase &)> readCallBack () const override
 get a reference to the readCallBack More...
 
const std::function< void(PropertyBase &)> updateCallBack () const override
 get a reference to the updateCallBack More...
 
void useReadHandler () const
 use the call-back function at reading, if available More...
 
bool useUpdateHandler () override
 use the call-back function at update, if available More...
 
- Public Member Functions inherited from Gaudi::Details::PropertyBase
const std::string name () const
 property name More...
 
std::string documentation () const
 property documentation More...
 
std::string semantics () const
 property semantics More...
 
const std::type_infotype_info () const
 property type-info More...
 
std::string type () const
 property type More...
 
virtual PropertyBasedeclareReadHandler (std::function< void(PropertyBase &)> fun)=0
 set new callback for reading More...
 
virtual PropertyBasedeclareUpdateHandler (std::function< void(PropertyBase &)> fun)=0
 set new callback for update More...
 
virtual const std::function< void(PropertyBase &)> readCallBack () const =0
 get a reference to the readCallBack More...
 
virtual const std::function< void(PropertyBase &)> updateCallBack () const =0
 get a reference to the updateCallBack More...
 
template<class HT >
PropertyBasedeclareReadHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
template<class HT >
PropertyBasedeclareUpdateHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
virtual ~PropertyBase ()
 virtual destructor More...
 
void setName (std::string value)
 set the new value for the property name More...
 
void setDocumentation (std::string value)
 set the documentation string More...
 
void setSemantics (std::string value)
 set the semantics string More...
 
virtual std::ostreamfillStream (std::ostream &) const
 the printout of the property value More...
 
void setOwnerType (const std::type_info &ownerType)
 set the type of the owner class (used for documentation) More...
 
template<class OWNER >
void setOwnerType ()
 set the type of the owner class (used for documentation) More...
 
const std::type_infoownerType () const
 get the type of the owner class (used for documentation) More...
 
std::string ownerTypeName () const
 get the string for the type of the owner class (used for documentation) More...
 

Protected Attributes

Gaudi::DataHandlem_pValue = nullptr
 Pointer to the real property. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Gaudi::Details::PropertyBase
 PropertyBase (const std::type_info &type, std::string name="", std::string doc="", std::string semantics="")
 constructor from the property name and the type More...
 
 PropertyBase (std::string name, const std::type_info &type)
 constructor from the property name and the type More...
 
 PropertyBase (const PropertyBase &)=default
 copy constructor More...
 
PropertyBaseoperator= (const PropertyBase &)=default
 assignment operator More...
 

Detailed Description

DataHandleProperty.h GaudiKernel/DataHandleProperty.h.

Helper class to manage DataHandles and DataHandleColls as properties

Author
Charles Leggett
Date
2015-09-01

Definition at line 34 of file DataHandleProperty.h.

Constructor & Destructor Documentation

◆ DataHandleProperty()

DataHandleProperty::DataHandleProperty ( const std::string name,
Gaudi::DataHandle ref 
)

Definition at line 36 of file DataHandleProperty.cpp.

37  : PropertyWithHandlers( name, typeid( ref ) ), m_pValue( &ref ) {}

Member Function Documentation

◆ assign()

bool DataHandleProperty::assign ( const Gaudi::Details::PropertyBase source)
overridevirtual

import the property value form the source

Implements Gaudi::Details::PropertyBase.

Definition at line 83 of file DataHandleProperty.cpp.

83  {
84  return fromString( source.toString() ).isSuccess();
85 }

◆ clone()

DataHandleProperty * DataHandleProperty::clone ( ) const
overridevirtual

clones the current property

Implements Gaudi::Details::PropertyBase.

Definition at line 75 of file DataHandleProperty.cpp.

75 { return new DataHandleProperty( *this ); }

◆ fromString()

StatusCode DataHandleProperty::fromString ( const std::string value)
overridevirtual

string -> value

Implements Gaudi::Details::PropertyBase.

Definition at line 41 of file DataHandleProperty.cpp.

41  {
42  if ( !Gaudi::Parsers::parse( *m_pValue, s ).isSuccess() ) { return StatusCode::FAILURE; }
44 }

◆ load()

bool DataHandleProperty::load ( Gaudi::Details::PropertyBase dest) const
overridevirtual

export the property value to the destination

Implements Gaudi::Details::PropertyBase.

Definition at line 79 of file DataHandleProperty.cpp.

79 { return destination.assign( *this ); }

◆ operator=()

DataHandleProperty & DataHandleProperty::operator= ( const Gaudi::DataHandle value)

Definition at line 68 of file DataHandleProperty.cpp.

68  {
69  setValue( value );
70  return *this;
71 }

◆ setValue()

bool DataHandleProperty::setValue ( const Gaudi::DataHandle value)

Definition at line 48 of file DataHandleProperty.cpp.

48  {
49  *m_pValue = value;
50  return useUpdateHandler();
51 }

◆ toStream()

void DataHandleProperty::toStream ( std::ostream out) const
overridevirtual

value -> stream

Implements Gaudi::Details::PropertyBase.

Definition at line 61 of file DataHandleProperty.cpp.

61  {
62  // implicitly invokes useReadHandler()
63  out << toString();
64 }

◆ toString()

std::string DataHandleProperty::toString ( ) const
overridevirtual

value -> string

Implements Gaudi::Details::PropertyBase.

Definition at line 55 of file DataHandleProperty.cpp.

55  {
57  return m_pValue->objKey();
58 }

◆ value()

const Gaudi::DataHandle & DataHandleProperty::value ( ) const

Definition at line 89 of file DataHandleProperty.cpp.

89  {
91  return *m_pValue;
92 }

Member Data Documentation

◆ m_pValue

Gaudi::DataHandle* DataHandleProperty::m_pValue = nullptr
protected

Pointer to the real property.

Reference would be better, but Reflex does not support references yet

Definition at line 52 of file DataHandleProperty.h.


The documentation for this class was generated from the following files:
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: PropertyBase.h:39
DataHandleProperty::toString
std::string toString() const override
value -> string
Definition: DataHandleProperty.cpp:55
DataHandleProperty::value
const Gaudi::DataHandle & value() const
Definition: DataHandleProperty.cpp:89
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
DataHandleProperty::setValue
bool setValue(const Gaudi::DataHandle &value)
Definition: DataHandleProperty.cpp:48
Gaudi::Parsers::parse
StatusCode parse(GaudiUtils::HashMap< K, V > &result, std::string_view input)
Basic parser for the types of HashMap used in DODBasicMapper.
Definition: DODBasicMapper.cpp:21
gaudirun.s
string s
Definition: gaudirun.py:346
DataHandleProperty::m_pValue
Gaudi::DataHandle * m_pValue
Pointer to the real property.
Definition: DataHandleProperty.h:52
DataHandleProperty::fromString
StatusCode fromString(const std::string &s) override
string -> value
Definition: DataHandleProperty.cpp:41
DataHandleProperty::DataHandleProperty
DataHandleProperty(const std::string &name, Gaudi::DataHandle &ref)
Definition: DataHandleProperty.cpp:36
Gaudi::DataHandle::objKey
virtual const std::string & objKey() const
Definition: DataHandle.h:60
PropertyWithHandlers
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:541
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Details::PropertyBase::toString
virtual std::string toString() const =0
value -> string
PropertyWithHandlers<>::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:567
compareRootHistos.ref
ref
Definition: compareRootHistos.py:27
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
PropertyWithHandlers<>::useReadHandler
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:564
PrepareBase.out
out
Definition: PrepareBase.py:20