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 ()
 
virtual DataObjectHandlePropertyclone () const
 clone: "virtual constructor" More...
 
virtual bool load (Property &destination) const
 export the property value to the destination More...
 
virtual bool assign (const Property &source)
 import the property value form the source More...
 
virtual std::string toString () const
 value -> string More...
 
virtual void toStream (std::ostream &out) const
 value -> stream More...
 
virtual StatusCode fromString (const std::string &s)
 string -> value More...
 
const DataObjectHandleBasevalue () const
 
bool setValue (const DataObjectHandleBase &value)
 
const std::string pythonRepr () const
 
- Public Member Functions inherited from Property
const std::stringname () const
 property name More...
 
const std::stringdocumentation () const
 property documentation More...
 
const std::type_infotype_info () const
 property type-info More...
 
std::string type () const
 property type More...
 
const std::function< void(Property &)> & readCallBack () const
 get a reference to the readCallBack More...
 
const std::function< void(Property &)> & updateCallBack () const
 get a reference to the updateCallBack More...
 
virtual PropertydeclareReadHandler (std::function< void(Property &)> fun)
 set new callback for reading More...
 
virtual PropertydeclareUpdateHandler (std::function< void(Property &)> fun)
 set new callback for update More...
 
template<class HT >
PropertydeclareReadHandler (void(HT::*MF)(Property &), HT *instance)
 
template<class HT >
PropertydeclareUpdateHandler (void(HT::*MF)(Property &), HT *instance)
 
virtual void useReadHandler () const
 use the call-back function at reading More...
 
virtual bool useUpdateHandler ()
 use the call-back function at update More...
 
virtual ~Property ()=default
 virtual destructor More...
 
void setName (std::string value)
 set the new value for the property name More...
 
void setDocumentation (std::string documentation)
 set the documentation string More...
 
virtual std::ostreamfillStream (std::ostream &) const
 the printout of the property value More...
 

Private Attributes

DataObjectHandleBasem_pValue
 Pointer to the real property. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Property
 Property (const std::type_info &type, std::string name="")
 constructor from the property name and the type More...
 
 Property (std::string name, const std::type_info &type)
 constructor from the property name and the type More...
 
 Property (const Property &)=default
 copy constructor More...
 
Propertyoperator= (const Property &)=default
 assignment operator More...
 
- Protected Attributes inherited from Property
std::function< void(Property &)> m_readCallBack
 
std::function< void(Property &)> m_updateCallBack
 

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 106 of file DataObjectHandleProperty.cpp.

108  : Property( name, typeid( DataObjectHandleBase ) ),
109  m_pValue( &ref )
110 {}
DataObjectHandleBase * m_pValue
Pointer to the real property.
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
DataObjectHandleProperty::~DataObjectHandleProperty ( )
virtual

Definition at line 114 of file DataObjectHandleProperty.cpp.

115 {}

Member Function Documentation

bool DataObjectHandleProperty::assign ( const Property source)
virtual

import the property value form the source

Implements Property.

Definition at line 194 of file DataObjectHandleProperty.cpp.

195 {
196  return fromString( source.toString() ).isSuccess();
197 }
virtual std::string toString() const =0
value -> string
virtual StatusCode fromString(const std::string &s)
string -> value
DataObjectHandleProperty * DataObjectHandleProperty::clone ( ) const
virtual

clone: "virtual constructor"

Implements Property.

Definition at line 178 of file DataObjectHandleProperty.cpp.

179 {
180  return new DataObjectHandleProperty( *this );
181 }
DataObjectHandleProperty(const std::string &name, DataObjectHandleBase &ref)
StatusCode DataObjectHandleProperty::fromString ( const std::string value)
virtual

string -> value

Implements Property.

Definition at line 120 of file DataObjectHandleProperty.cpp.

121 {
122  if (!Gaudi::Parsers::parse(*m_pValue, s).isSuccess()) {
123  return StatusCode::FAILURE;
124  }
125  return useUpdateHandler()
128 }
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.
virtual bool useUpdateHandler()
use the call-back function at update
Definition: Property.cpp:92
string s
Definition: gaudirun.py:245
bool DataObjectHandleProperty::load ( Property dest) const
virtual

export the property value to the destination

Implements Property.

Definition at line 186 of file DataObjectHandleProperty.cpp.

187 {
188  return destination.assign( *this );
189 }
DataObjectHandleProperty & DataObjectHandleProperty::operator= ( const DataObjectHandleBase value)

Definition at line 169 of file DataObjectHandleProperty.cpp.

170 {
171  setValue( value );
172  return *this;
173 }
bool setValue(const DataObjectHandleBase &value)
const std::string DataObjectHandleProperty::pythonRepr ( ) const

Definition at line 132 of file DataObjectHandleProperty.cpp.

132  {
133  // std::cerr << "DataObjectHandleProperty::pythonRepr() " << std::endl;
134  return "DataObjectHandleBase(\"" + toString() + "\")";
135 }
virtual std::string toString() const
value -> string
bool DataObjectHandleProperty::setValue ( const DataObjectHandleBase value)

Definition at line 141 of file DataObjectHandleProperty.cpp.

142 {
143  m_pValue->operator=(value);
144  return useUpdateHandler();
145 }
DataObjectHandleBase * m_pValue
Pointer to the real property.
virtual bool useUpdateHandler()
use the call-back function at update
Definition: Property.cpp:92
const DataObjectHandleBase & value() const
void DataObjectHandleProperty::toStream ( std::ostream out) const
virtual

value -> stream

Implements Property.

Definition at line 160 of file DataObjectHandleProperty.cpp.

161 {
162  useReadHandler();
163  out << this->toString();
164 }
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
virtual std::string toString() const
value -> string
std::string DataObjectHandleProperty::toString ( ) const
virtual

value -> string

Implements Property.

Definition at line 150 of file DataObjectHandleProperty.cpp.

151 {
152  useReadHandler();
155  return o.str();
156 }
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
DataObjectHandleBase * m_pValue
Pointer to the real property.
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:319
const DataObjectHandleBase & DataObjectHandleProperty::value ( ) const

Definition at line 202 of file DataObjectHandleProperty.cpp.

203 {
204  useReadHandler();
205  return *m_pValue;
206 }
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
DataObjectHandleBase * m_pValue
Pointer to the real property.

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: