DataObjectHandleProperty Class Reference

DataObjectHandleProperty.h GaudiKernel/DataObjectHandleProperty.h. More...

#include <GaudiKernel/DataObjectHandleProperty.h>

Inheritance diagram for DataObjectHandleProperty:
Collaboration diagram for DataObjectHandleProperty:

Public Member Functions

 DataObjectHandleProperty (const std::string &name, DataObjectHandleBase &ref)
 
DataObjectHandlePropertyoperator= (const DataObjectHandleBase &value)
 
virtual ~DataObjectHandleProperty ()
 
DataObjectHandlePropertyclone () const override
 clones the current property More...
 
bool load (Property &destination) const override
 
bool assign (const Property &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 DataObjectHandleBasevalue () const
 
bool setValue (const DataObjectHandleBase &value)
 
const std::string pythonRepr () const
 
- 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...
 
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...
 
template<class HT >
PropertyBasedeclareReadHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
template<class HT >
PropertyBasedeclareUpdateHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
virtual ~PropertyBase ()=default
 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...
 
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

DataObjectHandleBasem_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="")
 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

DataObjectHandleProperty.h GaudiKernel/DataObjectHandleProperty.h.

Helper class to manage DataObjectHandles and DataObjectHandleColls as properties

Author
Charles Leggett
Date
2015-09-01

Definition at line 23 of file DataObjectHandleProperty.h.

Constructor & Destructor Documentation

DataObjectHandleProperty::DataObjectHandleProperty ( const std::string name,
DataObjectHandleBase ref 
)

Definition at line 98 of file DataObjectHandleProperty.cpp.

99  : PropertyWithHandlers( name, typeid( DataObjectHandleBase ) ), m_pValue( &ref )
100 {
101 }
DataObjectHandleBase * m_pValue
Pointer to the real property.
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:736
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
DataObjectHandleProperty::~DataObjectHandleProperty ( )
virtual

Definition at line 105 of file DataObjectHandleProperty.cpp.

105 {}

Member Function Documentation

bool DataObjectHandleProperty::assign ( const Property source)
override

Definition at line 169 of file DataObjectHandleProperty.cpp.

170 {
171  return fromString( source.toString() ).isSuccess();
172 }
StatusCode fromString(const std::string &s) override
string -> value
DataObjectHandleProperty * DataObjectHandleProperty::clone ( ) const
overridevirtual

clones the current property

Implements Gaudi::Details::PropertyBase.

Definition at line 158 of file DataObjectHandleProperty.cpp.

158 { return new DataObjectHandleProperty( *this ); }
DataObjectHandleProperty(const std::string &name, DataObjectHandleBase &ref)
StatusCode DataObjectHandleProperty::fromString ( const std::string value)
overridevirtual

string -> value

Implements Gaudi::Details::PropertyBase.

Definition at line 109 of file DataObjectHandleProperty.cpp.

110 {
111  if ( !Gaudi::Parsers::parse( *m_pValue, s ).isSuccess() ) {
112  return StatusCode::FAILURE;
113  }
115 }
DataObjectHandleBase * m_pValue
Pointer to the real property.
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:765
string s
Definition: gaudirun.py:245
bool DataObjectHandleProperty::load ( Property destination) const
override

Definition at line 162 of file DataObjectHandleProperty.cpp.

163 {
164  return destination.assign( *this );
165 }
DataObjectHandleProperty & DataObjectHandleProperty::operator= ( const DataObjectHandleBase value)

Definition at line 150 of file DataObjectHandleProperty.cpp.

151 {
152  setValue( value );
153  return *this;
154 }
bool setValue(const DataObjectHandleBase &value)
const std::string DataObjectHandleProperty::pythonRepr ( ) const

Definition at line 117 of file DataObjectHandleProperty.cpp.

118 {
119  // std::cerr << "DataObjectHandleProperty::pythonRepr() " << std::endl;
120  return "DataObjectHandleBase(\"" + toString() + "\")";
121 }
std::string toString() const override
value -> string
bool DataObjectHandleProperty::setValue ( const DataObjectHandleBase value)

Definition at line 125 of file DataObjectHandleProperty.cpp.

126 {
127  m_pValue->operator=( value );
128  return useUpdateHandler();
129 }
DataObjectHandleBase * m_pValue
Pointer to the real property.
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:765
const DataObjectHandleBase & value() const
void DataObjectHandleProperty::toStream ( std::ostream out) const
overridevirtual

value -> stream

Implements Gaudi::Details::PropertyBase.

Definition at line 142 of file DataObjectHandleProperty.cpp.

143 {
144  useReadHandler();
145  out << this->toString();
146 }
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:762
std::string toString() const override
value -> string
std::string DataObjectHandleProperty::toString ( ) const
overridevirtual

value -> string

Implements Gaudi::Details::PropertyBase.

Definition at line 133 of file DataObjectHandleProperty.cpp.

134 {
135  useReadHandler();
138  return o.str();
139 }
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:315
DataObjectHandleBase * m_pValue
Pointer to the real property.
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:762
const DataObjectHandleBase & DataObjectHandleProperty::value ( ) const

Definition at line 176 of file DataObjectHandleProperty.cpp.

177 {
178  useReadHandler();
179  return *m_pValue;
180 }
DataObjectHandleBase * m_pValue
Pointer to the real property.
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:762

Member Data Documentation

DataObjectHandleBase* DataObjectHandleProperty::m_pValue
private

Pointer to the real property.

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

Definition at line 45 of file DataObjectHandleProperty.h.


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