The Gaudi Framework  master (594c33fa)
GaudiHandleArrayProperty Class Reference

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

Inheritance diagram for GaudiHandleArrayProperty:
Collaboration diagram for GaudiHandleArrayProperty:

Public Member Functions

 GaudiHandleArrayProperty (std::string name, GaudiHandleArrayBase &ref)
 
GaudiHandleArrayPropertyoperator= (const GaudiHandleArrayBase &value)
 
GaudiHandleArrayPropertyclone () 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 GaudiHandleArrayBasevalue () const
 
bool setValue (const GaudiHandleArrayBase &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

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

Constructor & Destructor Documentation

◆ GaudiHandleArrayProperty()

GaudiHandleArrayProperty::GaudiHandleArrayProperty ( std::string  name,
GaudiHandleArrayBase ref 
)

Definition at line 148 of file Property.cpp.

149  : PropertyWithHandlers( std::move( name_ ), typeid( GaudiHandleArrayBase ) ), m_pValue( &ref ) {
151 }

Member Function Documentation

◆ assign()

bool GaudiHandleArrayProperty::assign ( const PropertyBase source)
inlineoverride

Definition at line 630 of file Property.h.

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

◆ clone()

GaudiHandleArrayProperty* GaudiHandleArrayProperty::clone ( ) const
inlineoverridevirtual

clones the current property

Implements Gaudi::Details::PropertyBase.

Definition at line 626 of file Property.h.

626 { return new GaudiHandleArrayProperty( *this ); }

◆ fromString()

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

string -> value

Implements Gaudi::Details::PropertyBase.

Definition at line 170 of file Property.cpp.

170  {
171  // treat as if a Gaudi::Property<std::vector<std::string>>
173  StatusCode sc = Gaudi::Parsers::parse( tmp, source );
174  if ( sc.isFailure() ) return sc;
175  if ( !m_pValue->setTypesAndNames( std::move( tmp ) ) ) return StatusCode::FAILURE;
177  return StatusCode::SUCCESS;
178 }

◆ load()

bool GaudiHandleArrayProperty::load ( PropertyBase destination) const
inlineoverride

Definition at line 628 of file Property.h.

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

◆ operator=()

GaudiHandleArrayProperty& GaudiHandleArrayProperty::operator= ( const GaudiHandleArrayBase value)
inline

Definition at line 621 of file Property.h.

621  {
622  setValue( value );
623  return *this;
624  }

◆ setValue()

bool GaudiHandleArrayProperty::setValue ( const GaudiHandleArrayBase value)

Definition at line 153 of file Property.cpp.

153  {
155  return useUpdateHandler();
156 }

◆ toStream()

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

value -> stream

Implements Gaudi::Details::PropertyBase.

Definition at line 164 of file Property.cpp.

164  {
165  // treat as if a Gaudi::Property<std::vector<std::string>>
166  useReadHandler();
168 }

◆ toString()

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

value -> string

Implements Gaudi::Details::PropertyBase.

Definition at line 158 of file Property.cpp.

158  {
159  // treat as if a Gaudi::Property<std::vector<std::string>>
160  useReadHandler();
162 }

◆ value()

const GaudiHandleArrayBase& GaudiHandleArrayProperty::value ( ) const
inline

Definition at line 638 of file Property.h.

638  {
639  useReadHandler();
640  return *m_pValue;
641  }

Member Data Documentation

◆ m_pValue

GaudiHandleArrayBase* GaudiHandleArrayProperty::m_pValue
private

Pointer to the real property.

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

Definition at line 648 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
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:638
std::move
T move(T... args)
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
GaudiHandleArrayProperty::setValue
bool setValue(const GaudiHandleArrayBase &value)
Definition: Property.cpp:153
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
std::vector< std::string >
StatusCode
Definition: StatusCode.h:65
GaudiHandleArrayProperty::GaudiHandleArrayProperty
GaudiHandleArrayProperty(std::string name, GaudiHandleArrayBase &ref)
Definition: Property.cpp:148
GaudiHandleArrayBase
Base class of array's of various gaudihandles.
Definition: GaudiHandle.h:345
GaudiHandleArrayProperty::fromString
StatusCode fromString(const std::string &s) override
string -> value
Definition: Property.cpp:170
GaudiHandleArrayBase::setTypesAndNames
bool setTypesAndNames(const std::vector< std::string > &myTypesAndNamesList)
Set the array of handles from list of "type/name" strings in <myTypesAndNamesList>.
Definition: GaudiHandle.cpp:63
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:354
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::Utils::toStream
std::ostream & toStream(ITERATOR first, ITERATOR last, std::ostream &s, const std::string &open, const std::string &close, const std::string &delim)
the helper function to print the sequence
Definition: ToStream.h:300
PropertyWithHandlers<>::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:567
GaudiHandleArrayBase::typesAndNames
const std::vector< std::string > typesAndNames() const
Return a vector with "type/name" strings of all handles in the array.
Definition: GaudiHandle.cpp:78
compareRootHistos.ref
ref
Definition: compareRootHistos.py:27
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
GaudiHandleInfo::setPropertyName
void setPropertyName(std::string propName)
set name as used in declareProperty(name,gaudiHandle).
Definition: GaudiHandle.h:63
GaudiHandleArrayProperty::m_pValue
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Definition: Property.h:648
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