The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
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
 
bool load (Gaudi::Details::PropertyBase &destination) const override
 export the property value to the destination
 
bool assign (const Gaudi::Details::PropertyBase &source) override
 import the property value form the source
 
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 Gaudi::DataHandlevalue () const
 
bool setValue (const Gaudi::DataHandle &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 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)
 

Protected Attributes

Gaudi::DataHandlem_pValue = nullptr
 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

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 ) {}
Gaudi::DataHandle * m_pValue
Pointer to the real property.
const std::string name() const
property name

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}
StatusCode fromString(const std::string &s) override
string -> value
virtual std::string toString() const =0
value -> string
bool isSuccess() const
Definition StatusCode.h:314

◆ 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 ); }
DataHandleProperty(const std::string &name, Gaudi::DataHandle &ref)

◆ 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}
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
constexpr static const auto FAILURE
Definition StatusCode.h:100
StatusCode parse(GaudiUtils::HashMap< K, V > &result, std::string_view input)
Basic parser for the types of HashMap used in DODBasicMapper.

◆ 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}
const Gaudi::DataHandle & value() const
bool setValue(const Gaudi::DataHandle &value)

◆ 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}
std::string toString() const override
value -> string

◆ 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}
void useReadHandler() const
use the call-back function at reading, if available
Definition Property.h:553

◆ 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: