The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
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
 
bool load (PropertyBase &destination) const override
 
bool assign (const PropertyBase &source) override
 
std::string toString () const override
 value -> string
 
void toStream (std::ostream &out) const override
 value -> stream
 
StatusCode fromString (const std::string &s) override
 string -> value
 
const GaudiHandleBasevalue () const
 
bool setValue (const GaudiHandleBase &value)
 
- Public Member Functions inherited from PropertyWithHandlers< Handler >
PropertyBasedeclareReadHandler (std::function< void(PropertyBase &)> fun) override
 set new callback for reading
 
PropertyBasedeclareUpdateHandler (std::function< void(PropertyBase &)> fun) override
 set new callback for update
 
const std::function< void(PropertyBase &)> readCallBack () const override
 get a reference to the readCallBack
 
const std::function< void(PropertyBase &)> updateCallBack () const override
 get a reference to the updateCallBack
 
void useReadHandler () const
 use the call-back function at reading, if available
 
bool useUpdateHandler () override
 use the call-back function at update, if available
 
- Public Member Functions inherited from Gaudi::Details::PropertyBase
const std::string name () const
 property name
 
std::string documentation () const
 property documentation
 
std::string semantics () const
 property semantics
 
const std::type_info * type_info () const
 property type-info
 
std::string type () const
 property type
 
virtual bool load (PropertyBase &dest) const =0
 export the property value to the destination
 
virtual bool assign (const PropertyBase &source)=0
 import the property value form the source
 
virtual PropertyBasedeclareReadHandler (std::function< void(PropertyBase &)> fun)=0
 set new callback for reading
 
virtual PropertyBasedeclareUpdateHandler (std::function< void(PropertyBase &)> fun)=0
 set new callback for update
 
template<class HT>
PropertyBasedeclareReadHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
template<class HT>
PropertyBasedeclareUpdateHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
virtual ~PropertyBase ()
 virtual destructor
 
void setName (std::string value)
 set the new value for the property name
 
void setDocumentation (std::string value)
 set the documentation string
 
void setSemantics (std::string value)
 set the semantics string
 
virtual std::ostream & fillStream (std::ostream &) const
 the printout of the property value
 
void setOwnerType (const std::type_info &ownerType)
 set the type of the owner class (used for documentation)
 
template<class OWNER>
void setOwnerType ()
 set the type of the owner class (used for documentation)
 
const std::type_info * ownerType () const
 get the type of the owner class (used for documentation)
 
std::string ownerTypeName () const
 get the string for the type of the owner class (used for documentation)
 

Private Attributes

GaudiHandleBasem_pValue
 Pointer to the real property.
 

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
 
 PropertyBase (std::string name, const std::type_info &type)
 constructor from the property name and the type
 
 PropertyBase (const PropertyBase &)=default
 copy constructor
 
PropertyBaseoperator= (const PropertyBase &)=default
 assignment operator
 

Detailed Description

Definition at line 569 of file Property.h.

Constructor & Destructor Documentation

◆ GaudiHandleProperty()

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

Definition at line 94 of file Property.cpp.

95 : PropertyWithHandlers( std::move( name_ ), typeid( GaudiHandleBase ) ), m_pValue( &ref ) {
96 m_pValue->setPropertyName( name() );
97}
const std::string name() const
property name
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition Property.h:600

Member Function Documentation

◆ assign()

bool GaudiHandleProperty::assign ( const PropertyBase & source)
inlineoverride

Definition at line 582 of file Property.h.

582{ return fromString( source.toString() ).isSuccess(); }
StatusCode fromString(const std::string &s) override
string -> value
Definition Property.cpp:114
virtual std::string toString() const =0
value -> string
bool isSuccess() const
Definition StatusCode.h:314

◆ clone()

GaudiHandleProperty * GaudiHandleProperty::clone ( ) const
inlineoverridevirtual

clones the current property

Implements Gaudi::Details::PropertyBase.

Definition at line 578 of file Property.h.

578{ return new GaudiHandleProperty( *this ); }
GaudiHandleProperty(std::string name, GaudiHandleBase &ref)
Definition Property.cpp:94

◆ 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 114 of file Property.cpp.

114 {
116 if ( s.size() > 1 && ( s.front() == '\'' || s.front() == '\"' ) && s.front() == s.back() ) {
117 m_pValue->setTypeAndName( s.substr( 1, s.size() - 2 ) );
118 } else {
119 m_pValue->setTypeAndName( s );
120 }
122 return StatusCode::SUCCESS;
123}
bool useUpdateHandler() override
use the call-back function at update, if available
Definition Property.h:556
constexpr static const auto SUCCESS
Definition StatusCode.h:99

◆ load()

bool GaudiHandleProperty::load ( PropertyBase & destination) const
inlineoverride

Definition at line 580 of file Property.h.

580{ return destination.assign( *this ); }
virtual bool assign(const PropertyBase &source)=0
import the property value form the source

◆ operator=()

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

Definition at line 573 of file Property.h.

573 {
574 setValue( value );
575 return *this;
576 }
const GaudiHandleBase & value() const
Definition Property.h:590
bool setValue(const GaudiHandleBase &value)
Definition Property.cpp:99

◆ setValue()

bool GaudiHandleProperty::setValue ( const GaudiHandleBase & value)

Definition at line 99 of file Property.cpp.

99 {
100 m_pValue->setTypeAndName( value.typeAndName() );
101 return useUpdateHandler();
102}

◆ toStream()

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

value -> stream

Implements Gaudi::Details::PropertyBase.

Definition at line 109 of file Property.cpp.

109 {
111 out << m_pValue->typeAndName();
112}
void useReadHandler() const
use the call-back function at reading, if available
Definition Property.h:553

◆ toString()

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

value -> string

Implements Gaudi::Details::PropertyBase.

Definition at line 104 of file Property.cpp.

104 {
106 return m_pValue->typeAndName();
107}

◆ value()

const GaudiHandleBase & GaudiHandleProperty::value ( ) const
inline

Definition at line 590 of file Property.h.

590 {
592 return *m_pValue;
593 }

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 600 of file Property.h.


The documentation for this class was generated from the following files: