The Gaudi Framework  master (37c0b60a)
Gaudi::Property< TYPE, VERIFIER, HANDLERS > Class Template Reference

Implementation of property with value of concrete type. More...

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

Inheritance diagram for Gaudi::Property< TYPE, VERIFIER, HANDLERS >:
Collaboration diagram for Gaudi::Property< TYPE, VERIFIER, HANDLERS >:

Public Types

using StorageType = TYPE
 Hosted type. More...
 
using ValueType = typename std::remove_reference< StorageType >::type
 
using VerifierType = VERIFIER
 
using HandlersType = HANDLERS
 

Public Member Functions

template<class T = StorageType>
 Property (std::string name, T &&value, std::string doc="", std::string semantics="")
 the constructor with property name, value and documentation. More...
 
template<typename OWNER , typename T = ValueType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>, typename = std::enable_if_t<std::is_default_constructible_v<T>>>
 Property (OWNER *owner, std::string name)
 Autodeclaring constructor with property name, value and documentation. More...
 
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
 Property (OWNER *owner, std::string name, T &&value, std::string doc="", std::string semantics="")
 Autodeclaring constructor with property name, value and documentation. More...
 
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
 Property (OWNER *owner, std::string name, T &&value, std::function< void(PropertyBase &)> handler, std::string doc="", std::string semantics="")
 Autodeclaring constructor with property name, value, updateHandler and documentation. More...
 
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
 Property (OWNER *owner, std::string name, T &&value, void(OWNER::*handler)(PropertyBase &), std::string doc="", std::string semantics="")
 Autodeclaring constructor with property name, value, pointer to member function updateHandler and documentation. More...
 
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
 Property (OWNER *owner, std::string name, T &&value, void(OWNER::*handler)(), std::string doc="", std::string semantics="")
 Autodeclaring constructor with property name, value, pointer to member function updateHandler and documentation. More...
 
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
 Property (OWNER *owner, std::string name, T &&value, std::function< void(PropertyBase &)> handler, Details::Property::ImmediatelyInvokeHandler invoke, std::string doc="", std::string semantics="")
 Autodeclaring constructor with property name, value, updateHandler and documentation. More...
 
template<typename T , typename = not_copying<T>>
 Property (T &&v)
 Construct an anonymous property from a value. More...
 
template<typename T = StorageType, typename = std::enable_if_t<!std::is_reference_v<T>>>
 Property ()
 Construct an anonymous property with default constructed value. More...
 
Details::PropertyBasedeclareReadHandler (std::function< void(Details::PropertyBase &)> fun) override
 set new callback for reading More...
 
Details::PropertyBasedeclareUpdateHandler (std::function< void(Details::PropertyBase &)> fun) override
 set new callback for update More...
 
const std::function< void(Details::PropertyBase &)> readCallBack () const override
 get a reference to the readCallBack More...
 
const std::function< void(Details::PropertyBase &)> updateCallBack () const override
 get a reference to the updateCallBack More...
 
bool useUpdateHandler () override
 manual trigger for callback for update More...
 
 operator const ValueType & () const
 Automatic conversion to value (const reference). More...
 
template<typename Dummy = TYPE, typename = std::enable_if_t<std::is_constructible_v<std::string_view, Dummy>>>
 operator std::string_view () const
 
std::ostreamfillStream (std::ostream &stream) const override
 Properly quote string properties when printing them. More...
 
 operator std::string_view () const
 
template<class T >
bool operator== (const T &other) const
 equality comparison More...
 
template<class T >
bool operator!= (const T &other) const
 inequality comparison More...
 
template<class T >
bool operator< (const T &other) const
 "less" comparison More...
 
template<class T = ValueType>
Propertyoperator= (T &&v)
 Assignment from value. More...
 
const VerifierTypeverifier () const
 Accessor to verifier. More...
 
VerifierTypeverifier ()
 Accessor to verifier. More...
 
template<class... Args>
decltype( operator() (Args &&... args) const noexcept(noexcept(std::declval< ValueType >()(std::declval< Args && >()...))) std::declval< ValueType >()(std::declval< Args && >()...))
 
bool assign (const Details::PropertyBase &source) override
 get the value from another property More...
 
bool load (Details::PropertyBase &dest) const override
 set value to another property More...
 
StatusCode fromString (const std::string &source) override
 string -> value More...
 
std::string toString () const override
 value -> string More...
 
void toStream (std::ostream &out) const override
 value -> stream More...
 
const ValueTypevalue () const
 
ValueTypevalue ()
 
bool setValue (const ValueType &v)
 
bool set (const ValueType &v)
 
Details::PropertyBaseclone () const override
 clones the current property More...
 
Helpers for easy use of string and vector properties.

They are instantiated only if they are implemented in the wrapped class.

template<class = ValueType>
Propertyoperator++ ()
 
template<class = ValueType>
ValueType operator++ (int)
 
template<class = ValueType>
Propertyoperator-- ()
 
template<class = ValueType>
ValueType operator-- (int)
 
template<class T = ValueType>
Propertyoperator+= (const T &other)
 
template<class T = ValueType>
Propertyoperator-= (const T &other)
 
- 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...
 
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...
 
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

StorageType m_value
 Storage. More...
 
VerifierType m_verifier
 
HandlersType m_handlers
 
template<class T >
using not_copying = std::enable_if_t<!is_this_type_v< T > >
 
template<class T >
static constexpr bool is_this_type_v = std::is_same_v<Property, std::remove_reference_t<T>>
 helper typedefs for SFINAE 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

template<class TYPE, class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
class Gaudi::Property< TYPE, VERIFIER, HANDLERS >

Implementation of property with value of concrete type.

Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2006-02-27
Author
Marco Clemencic
Date
2016-06-16

Definition at line 37 of file Property.h.

Member Typedef Documentation

◆ HandlersType

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
using Gaudi::Property< TYPE, VERIFIER, HANDLERS >::HandlersType = HANDLERS

Definition at line 44 of file Property.h.

◆ not_copying

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class T >
using Gaudi::Property< TYPE, VERIFIER, HANDLERS >::not_copying = std::enable_if_t<!is_this_type_v<T> >
private

Definition at line 57 of file Property.h.

◆ StorageType

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
using Gaudi::Property< TYPE, VERIFIER, HANDLERS >::StorageType = TYPE

Hosted type.

Definition at line 41 of file Property.h.

◆ ValueType

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
using Gaudi::Property< TYPE, VERIFIER, HANDLERS >::ValueType = typename std::remove_reference<StorageType>::type

Definition at line 42 of file Property.h.

◆ VerifierType

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
using Gaudi::Property< TYPE, VERIFIER, HANDLERS >::VerifierType = VERIFIER

Definition at line 43 of file Property.h.

Constructor & Destructor Documentation

◆ Property() [1/9]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class T = StorageType>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::Property ( std::string  name,
T &&  value,
std::string  doc = "",
std::string  semantics = "" 
)
inline

the constructor with property name, value and documentation.

Definition at line 63 of file Property.h.

64  : Details::PropertyBase( typeid( ValueType ), std::move( name ), std::move( doc ), std::move( semantics ) )
65  , m_value( std::forward<T>( value ) ) {
67  }

◆ Property() [2/9]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<typename OWNER , typename T = ValueType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>, typename = std::enable_if_t<std::is_default_constructible_v<T>>>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::Property ( OWNER *  owner,
std::string  name 
)
inline

Autodeclaring constructor with property name, value and documentation.

Note
the use std::enable_if is required to avoid ambiguities

Definition at line 72 of file Property.h.

72  : Property( std::move( name ), ValueType{}, "" ) {
73  owner->declareProperty( *this );
74  setOwnerType<OWNER>();
75  }

◆ Property() [3/9]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::Property ( OWNER *  owner,
std::string  name,
T &&  value,
std::string  doc = "",
std::string  semantics = "" 
)
inline

Autodeclaring constructor with property name, value and documentation.

Note
the use std::enable_if is required to avoid ambiguities

Definition at line 80 of file Property.h.

81  : Property( std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
82  owner->declareProperty( *this );
83  setOwnerType<OWNER>();
84  }

◆ Property() [4/9]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::Property ( OWNER *  owner,
std::string  name,
T &&  value,
std::function< void(PropertyBase &)>  handler,
std::string  doc = "",
std::string  semantics = "" 
)
inline

Autodeclaring constructor with property name, value, updateHandler and documentation.

Note
the use std::enable_if is required to avoid ambiguities

Definition at line 89 of file Property.h.

91  : Property( owner, std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
92  declareUpdateHandler( std::move( handler ) );
93  }

◆ Property() [5/9]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::Property ( OWNER *  owner,
std::string  name,
T &&  value,
void(OWNER::*)(PropertyBase &)  handler,
std::string  doc = "",
std::string  semantics = "" 
)
inline

Autodeclaring constructor with property name, value, pointer to member function updateHandler and documentation.

Note
the use std::enable_if is required to avoid ambiguities

Definition at line 98 of file Property.h.

100  : Property(
101  owner, std::move( name ), std::forward<T>( value ),
102  [owner, handler]( PropertyBase& p ) { ( owner->*handler )( p ); }, std::move( doc ),
103  std::move( semantics ) ) {}

◆ Property() [6/9]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::Property ( OWNER *  owner,
std::string  name,
T &&  value,
void(OWNER::*)()  handler,
std::string  doc = "",
std::string  semantics = "" 
)
inline

Autodeclaring constructor with property name, value, pointer to member function updateHandler and documentation.

Note
the use std::enable_if is required to avoid ambiguities

Definition at line 107 of file Property.h.

109  : Property(
110  owner, std::move( name ), std::forward<T>( value ),
111  [owner, handler]( PropertyBase& ) { ( owner->*handler )(); }, std::move( doc ), std::move( semantics ) ) {
112  }

◆ Property() [7/9]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class OWNER , class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::Property ( OWNER *  owner,
std::string  name,
T &&  value,
std::function< void(PropertyBase &)>  handler,
Details::Property< TYPE, VERIFIER, HANDLERS >::ImmediatelyInvokeHandler  invoke,
std::string  doc = "",
std::string  semantics = "" 
)
inline

Autodeclaring constructor with property name, value, updateHandler and documentation.

Note
the use std::enable_if is required to avoid ambiguities

Definition at line 117 of file Property.h.

119  : Property( owner, std::move( name ), std::forward<T>( value ), std::move( handler ), std::move( doc ),
120  std::move( semantics ) ) {
121  if ( invoke ) useUpdateHandler();
122  }

◆ Property() [8/9]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<typename T , typename = not_copying<T>>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::Property ( T &&  v)
inline

Construct an anonymous property from a value.

This constructor is not generated if T is the current type, so that the compiler picks up the copy constructor instead of this one.

Definition at line 128 of file Property.h.

128 : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value( std::forward<T>( v ) ) {}

◆ Property() [9/9]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<typename T = StorageType, typename = std::enable_if_t<!std::is_reference_v<T>>>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::Property ( )
inline

Construct an anonymous property with default constructed value.

Can be used only if StorageType is default constructible.

Definition at line 133 of file Property.h.

133 : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value() {}

Member Function Documentation

◆ assign()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
bool Gaudi::Property< TYPE, VERIFIER, HANDLERS >::assign ( const Details::PropertyBase source)
inlineoverridevirtual

get the value from another property

Implements Gaudi::Details::PropertyBase.

Definition at line 370 of file Property.h.

370  {
371  // Check if the property is of "the same" type, except for strings
372  const Property* p =
373  ( std::is_same_v<ValueType, std::string> ) ? nullptr : dynamic_cast<const Property*>( &source );
374  if ( p ) {
375  *this = p->value();
376  } else {
377  return this->fromString( source.toString() ).isSuccess();
378  }
379  return true;
380  }

◆ clone()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
Details::PropertyBase* Gaudi::Property< TYPE, VERIFIER, HANDLERS >::clone ( ) const
inlineoverridevirtual

clones the current property

Implements Gaudi::Details::PropertyBase.

Definition at line 247 of file Property.h.

247 { return new Property( *this ); }

◆ declareReadHandler()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
Details::PropertyBase& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::declareReadHandler ( std::function< void(Details::PropertyBase &)>  fun)
inlineoverridevirtual

set new callback for reading

Implements Gaudi::Details::PropertyBase.

Definition at line 139 of file Property.h.

139  {
140  m_handlers.setReadHandler( std::move( fun ) );
141  return *this;
142  }

◆ declareUpdateHandler()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
Details::PropertyBase& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::declareUpdateHandler ( std::function< void(Details::PropertyBase &)>  fun)
inlineoverridevirtual

set new callback for update

Implements Gaudi::Details::PropertyBase.

Definition at line 144 of file Property.h.

144  {
145  m_handlers.setUpdateHandler( std::move( fun ) );
146  return *this;
147  }

◆ fillStream()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
std::ostream& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::fillStream ( std::ostream stream) const
inlineoverridevirtual

Properly quote string properties when printing them.

Reimplemented from Gaudi::Details::PropertyBase.

Definition at line 182 of file Property.h.

182  {
183  stream << " '" << name() << "':";
184  if constexpr ( std::is_same_v<ValueType, std::string> ) {
186  toStream( value(), stream );
187  } else {
188  stream << toString();
189  }
190  return stream;
191  }

◆ fromString()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
StatusCode Gaudi::Property< TYPE, VERIFIER, HANDLERS >::fromString ( const std::string source)
inlineoverridevirtual

string -> value

Implements Gaudi::Details::PropertyBase.

Definition at line 387 of file Property.h.

387  {
388  try {
389  using Converter = Details::Property::StringConverter<ValueType>;
390  *this = Converter().fromString( m_value, source );
391  return StatusCode::SUCCESS;
392  } catch ( const std::exception& err ) {
395  const std::string errMsg =
396  "Cannot convert '" + source + "' for property '" + name() + "' in class '" + ownerTypeName() + "'";
397  switch ( parsingErrorPolicy() ) {
398  case ParsingErrorPolicy::Ignore:
399  break;
400  case ParsingErrorPolicy::Exception:
401  throw GaudiException( errMsg, "Property::fromString", StatusCode::FAILURE, err );
402  break;
403  case ParsingErrorPolicy::Warning:
404  std::cerr << "WARNING: " << errMsg << "': " << err.what() << '\n';
405  break;
406  case ParsingErrorPolicy::Abort:
407  std::cerr << "FATAL: " << errMsg << "': " << err.what() << '\n';
408  std::abort();
409  break;
410  }
411  return StatusCode::FAILURE;
412  }
413  }

◆ load()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
bool Gaudi::Property< TYPE, VERIFIER, HANDLERS >::load ( Details::PropertyBase dest) const
inlineoverridevirtual

set value to another property

Implements Gaudi::Details::PropertyBase.

Definition at line 382 of file Property.h.

382  {
383  // delegate to the 'opposite' method
384  return dest.assign( *this );
385  }

◆ operator const ValueType &()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator const ValueType & ( ) const
inline

Automatic conversion to value (const reference).

Definition at line 165 of file Property.h.

165  {
166  m_handlers.useReadHandler( *this );
167  return m_value;
168  }

◆ operator std::string_view() [1/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<typename Dummy = TYPE, typename = std::enable_if_t<std::is_constructible_v<std::string_view, Dummy>>>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator std::string_view ( ) const
inline

Definition at line 176 of file Property.h.

176  {
177  m_handlers.useReadHandler( *this );
178  return m_value;
179  }

◆ operator std::string_view() [2/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator std::string_view ( ) const
inline

Definition at line 193 of file Property.h.

193  {
194  m_handlers.useReadHandler( *this );
195  return m_value;
196  }

◆ operator!=()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class T >
bool Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator!= ( const T &  other) const
inline

inequality comparison

Definition at line 206 of file Property.h.

206  {
207  return m_value != other;
208  }

◆ operator()()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class... Args>
decltype( Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator() ( Args &&...  args) const
inlinenoexcept

Definition at line 363 of file Property.h.

364  {
365  return value()( std::forward<Args>( args )... );
366  }

◆ operator++() [1/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class = ValueType>
Property& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator++ ( )
inline

Definition at line 306 of file Property.h.

306  {
307  ++value();
308  return *this;
309  }

◆ operator++() [2/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class = ValueType>
ValueType Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator++ ( int  )
inline

Definition at line 311 of file Property.h.

311  {
312  return m_value++;
313  }

◆ operator+=()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class T = ValueType>
Property& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator+= ( const T &  other)
inline

Definition at line 324 of file Property.h.

324  {
325  m_value += other;
326  return *this;
327  }

◆ operator--() [1/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class = ValueType>
Property& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator-- ( )
inline

Definition at line 315 of file Property.h.

315  {
316  --value();
317  return *this;
318  }

◆ operator--() [2/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class = ValueType>
ValueType Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator-- ( int  )
inline

Definition at line 320 of file Property.h.

320  {
321  return m_value--;
322  }

◆ operator-=()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class T = ValueType>
Property& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator-= ( const T &  other)
inline

Definition at line 329 of file Property.h.

329  {
330  m_value -= other;
331  return *this;
332  }

◆ operator<()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class T >
bool Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator< ( const T &  other) const
inline

"less" comparison

Definition at line 212 of file Property.h.

212  {
213  return m_value < other;
214  }

◆ operator=()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class T = ValueType>
Property& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator= ( T &&  v)
inline

Assignment from value.

Definition at line 224 of file Property.h.

224  {
225  m_verifier( v );
226  m_value = std::forward<T>( v );
227  m_handlers.useUpdateHandler( *this );
228  return *this;
229  }

◆ operator==()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class T >
bool Gaudi::Property< TYPE, VERIFIER, HANDLERS >::operator== ( const T &  other) const
inline

equality comparison

Definition at line 200 of file Property.h.

200  {
201  return m_value == other;
202  }

◆ readCallBack()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
const std::function<void( Details::PropertyBase& )> Gaudi::Property< TYPE, VERIFIER, HANDLERS >::readCallBack ( ) const
inlineoverridevirtual

get a reference to the readCallBack

Implements Gaudi::Details::PropertyBase.

Definition at line 150 of file Property.h.

150  {
151  return m_handlers.getReadHandler();
152  }

◆ set()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
bool Gaudi::Property< TYPE, VERIFIER, HANDLERS >::set ( const ValueType v)
inline

Definition at line 243 of file Property.h.

243  {
244  *this = v;
245  return true;
246  }

◆ setValue()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
bool Gaudi::Property< TYPE, VERIFIER, HANDLERS >::setValue ( const ValueType v)
inline

Definition at line 239 of file Property.h.

239  {
240  *this = v;
241  return true;
242  }

◆ toStream()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
void Gaudi::Property< TYPE, VERIFIER, HANDLERS >::toStream ( std::ostream out) const
inlineoverridevirtual

value -> stream

Implements Gaudi::Details::PropertyBase.

Definition at line 420 of file Property.h.

420  {
421  m_handlers.useReadHandler( *this );
422  using Utils::toStream;
423  toStream( m_value, out );
424  }

◆ toString()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
std::string Gaudi::Property< TYPE, VERIFIER, HANDLERS >::toString ( ) const
inlineoverridevirtual

value -> string

Implements Gaudi::Details::PropertyBase.

Definition at line 415 of file Property.h.

415  {
416  using Converter = Details::Property::StringConverter<ValueType>;
417  return Converter().toString( *this );
418  }

◆ updateCallBack()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
const std::function<void( Details::PropertyBase& )> Gaudi::Property< TYPE, VERIFIER, HANDLERS >::updateCallBack ( ) const
inlineoverridevirtual

get a reference to the updateCallBack

Implements Gaudi::Details::PropertyBase.

Definition at line 154 of file Property.h.

154  {
155  return m_handlers.getUpdateHandler();
156  }

◆ useUpdateHandler()

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
bool Gaudi::Property< TYPE, VERIFIER, HANDLERS >::useUpdateHandler ( )
inlineoverridevirtual

manual trigger for callback for update

Implements Gaudi::Details::PropertyBase.

Definition at line 159 of file Property.h.

159  {
160  m_handlers.useUpdateHandler( *this );
161  return true;
162  }

◆ value() [1/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
ValueType& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::value ( )
inline

Definition at line 238 of file Property.h.

238 { return const_cast<ValueType&>( (const ValueType&)*this ); }

◆ value() [2/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
const ValueType& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::value ( ) const
inline

Definition at line 237 of file Property.h.

237 { return *this; }

◆ verifier() [1/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
VerifierType& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::verifier ( )
inline

Accessor to verifier.

Definition at line 234 of file Property.h.

234 { return m_verifier; }

◆ verifier() [2/2]

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
const VerifierType& Gaudi::Property< TYPE, VERIFIER, HANDLERS >::verifier ( ) const
inline

Accessor to verifier.

Definition at line 232 of file Property.h.

232 { return m_verifier; }

Member Data Documentation

◆ is_this_type_v

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
template<class T >
constexpr bool Gaudi::Property< TYPE, VERIFIER, HANDLERS >::is_this_type_v = std::is_same_v<Property, std::remove_reference_t<T>>
inlinestaticconstexprprivate

helper typedefs for SFINAE

Definition at line 55 of file Property.h.

◆ m_handlers

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
HandlersType Gaudi::Property< TYPE, VERIFIER, HANDLERS >::m_handlers
private

Definition at line 51 of file Property.h.

◆ m_value

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
StorageType Gaudi::Property< TYPE, VERIFIER, HANDLERS >::m_value
private

Storage.

Definition at line 49 of file Property.h.

◆ m_verifier

template<class TYPE , class VERIFIER = Details::Property::NullVerifier, class HANDLERS = Details::Property::UpdateHandler>
VerifierType Gaudi::Property< TYPE, VERIFIER, HANDLERS >::m_verifier
private

Definition at line 50 of file Property.h.


The documentation for this class was generated from the following file:
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: PropertyBase.h:39
Write.stream
stream
Definition: Write.py:32
std::string
STL class.
std::exception
STL class.
std::move
T move(T... args)
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
GaudiException
Definition: GaudiException.h:31
Gaudi::Property::m_handlers
HandlersType m_handlers
Definition: Property.h:51
Gaudi::Property::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: Property.h:387
Gaudi::Details::Property::ParsingErrorPolicy
ParsingErrorPolicy
Definition: Property.h:221
Converter
Definition: Converter.h:34
std::cerr
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:144
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:237
Gaudi::Details::PropertyBase::PropertyBase
PropertyBase(const std::type_info &type, std::string name="", std::string doc="", std::string semantics="")
constructor from the property name and the type
Definition: PropertyBase.h:118
Gaudi::Property::m_verifier
VerifierType m_verifier
Definition: Property.h:50
Gaudi::Details::PropertyBase::semantics
std::string semantics() const
property semantics
Definition: PropertyBase.h:43
Gaudi::Property::useUpdateHandler
bool useUpdateHandler() override
manual trigger for callback for update
Definition: Property.h:159
Gaudi::Details::Property::parsingErrorPolicy
ParsingErrorPolicy parsingErrorPolicy()
Definition: Property.cpp:522
gaudirun.dest
dest
Definition: gaudirun.py:224
Gaudi::Property::toStream
void toStream(std::ostream &out) const override
value -> stream
Definition: Property.h:420
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
gaudirun.args
args
Definition: gaudirun.py:336
Gaudi::Property::m_value
StorageType m_value
Storage.
Definition: Property.h:49
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:299
Gaudi::Property::toString
std::string toString() const override
value -> string
Definition: Property.h:415
Properties.v
v
Definition: Properties.py:122
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Gaudi::Details::PropertyBase::ownerTypeName
std::string ownerTypeName() const
get the string for the type of the owner class (used for documentation)
Definition: PropertyBase.h:112
Gaudi::Property::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: Property.h:42
std::abort
T abort(T... args)
std::exception::what
T what(T... args)
PrepareBase.out
out
Definition: PrepareBase.py:20
Gaudi::Property::Property
Property()
Construct an anonymous property with default constructed value.
Definition: Property.h:133