The Gaudi Framework  master (594c33fa)
GaudiHandleProperty Class Reference

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

Inheritance diagram for GaudiHandleProperty:
Collaboration diagram for GaudiHandleProperty:

Public Member Functions

 GaudiHandleProperty (std::string name, GaudiHandleBase &ref)
 
GaudiHandlePropertyoperator= (const GaudiHandleBase &value)
 
GaudiHandlePropertyclone () const override
 clones the current property More...
 
bool load (PropertyBase &destination) const override
 
bool assign (const PropertyBase &source) override
 
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 GaudiHandleBasevalue () const
 
bool setValue (const GaudiHandleBase &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 bool load (PropertyBase &dest) const =0
 export the property value to the destination More...
 
virtual bool assign (const PropertyBase &source)=0
 import the property value form the source 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...
 

Private Attributes

GaudiHandleBasem_pValue
 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

Definition at line 580 of file Property.h.

Constructor & Destructor Documentation

◆ GaudiHandleProperty()

GaudiHandleProperty::GaudiHandleProperty ( std::string  name,
GaudiHandleBase ref 
)

Definition at line 114 of file Property.cpp.

115  : PropertyWithHandlers( std::move( name_ ), typeid( GaudiHandleBase ) ), m_pValue( &ref ) {
117 }

Member Function Documentation

◆ assign()

bool GaudiHandleProperty::assign ( const PropertyBase source)
inlineoverride

Definition at line 593 of file Property.h.

593 { return fromString( source.toString() ).isSuccess(); }

◆ clone()

GaudiHandleProperty* GaudiHandleProperty::clone ( ) const
inlineoverridevirtual

clones the current property

Implements Gaudi::Details::PropertyBase.

Definition at line 589 of file Property.h.

589 { return new GaudiHandleProperty( *this ); }

◆ fromString()

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

string -> value

\fixme strip optional quotes around the string

Implements Gaudi::Details::PropertyBase.

Definition at line 134 of file Property.cpp.

134  {
136  if ( s.size() > 1 && ( s.front() == '\'' || s.front() == '\"' ) && s.front() == s.back() ) {
137  m_pValue->setTypeAndName( s.substr( 1, s.size() - 2 ) );
138  } else {
140  }
142  return StatusCode::SUCCESS;
143 }

◆ load()

bool GaudiHandleProperty::load ( PropertyBase destination) const
inlineoverride

Definition at line 591 of file Property.h.

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

◆ operator=()

GaudiHandleProperty& GaudiHandleProperty::operator= ( const GaudiHandleBase value)
inline

Definition at line 584 of file Property.h.

584  {
585  setValue( value );
586  return *this;
587  }

◆ setValue()

bool GaudiHandleProperty::setValue ( const GaudiHandleBase value)

Definition at line 119 of file Property.cpp.

119  {
121  return useUpdateHandler();
122 }

◆ toStream()

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

value -> stream

Implements Gaudi::Details::PropertyBase.

Definition at line 129 of file Property.cpp.

129  {
130  useReadHandler();
131  out << m_pValue->typeAndName();
132 }

◆ toString()

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

value -> string

Implements Gaudi::Details::PropertyBase.

Definition at line 124 of file Property.cpp.

124  {
125  useReadHandler();
126  return m_pValue->typeAndName();
127 }

◆ value()

const GaudiHandleBase& GaudiHandleProperty::value ( ) const
inline

Definition at line 601 of file Property.h.

601  {
602  useReadHandler();
603  return *m_pValue;
604  }

Member Data Documentation

◆ m_pValue

GaudiHandleBase* GaudiHandleProperty::m_pValue
private

Pointer to the real property.

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

Definition at line 611 of file Property.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
GaudiHandleProperty::m_pValue
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition: Property.h:611
GaudiHandleProperty::GaudiHandleProperty
GaudiHandleProperty(std::string name, GaudiHandleBase &ref)
Definition: Property.cpp:114
std::move
T move(T... args)
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
gaudirun.s
string s
Definition: gaudirun.py:346
GaudiHandleProperty::setValue
bool setValue(const GaudiHandleBase &value)
Definition: Property.cpp:119
GaudiHandleBase
Definition: GaudiHandle.h:102
GaudiHandleBase::typeAndName
std::string typeAndName() const
The full type and name: "type/name".
Definition: GaudiHandle.h:128
GaudiHandleProperty::value
const GaudiHandleBase & value() const
Definition: Property.h:601
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
PropertyWithHandlers<>::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:567
GaudiHandleProperty::fromString
StatusCode fromString(const std::string &s) override
string -> value
Definition: Property.cpp:134
compareRootHistos.ref
ref
Definition: compareRootHistos.py:27
GaudiHandleInfo::setPropertyName
void setPropertyName(std::string propName)
set name as used in declareProperty(name,gaudiHandle).
Definition: GaudiHandle.h:63
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
GaudiHandleBase::setTypeAndName
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
Definition: GaudiHandle.cpp:19