The Gaudi Framework  v36r16 (ea80daf8)
Property.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2020 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 
13 #include <Gaudi/Details/Property.h>
15 #include <Gaudi/PropertyFwd.h>
16 #include <GaudiKernel/IProperty.h>
17 #include <GaudiKernel/Kernel.h>
18 #include <GaudiKernel/SmartIF.h>
19 #include <GaudiKernel/TaggedBool.h>
20 #include <GaudiKernel/ToStream.h>
21 #include <stdexcept>
22 #include <string>
23 #include <string_view>
24 #include <typeinfo>
25 #include <utility>
26 
27 namespace Gaudi {
28  // ============================================================================
36  // ============================================================================
37  template <class TYPE, class VERIFIER = Details::Property::NullVerifier,
38  class HANDLERS = Details::Property::UpdateHandler>
40  public:
41  // ==========================================================================
43  using StorageType = TYPE;
45  using VerifierType = VERIFIER;
46  using HandlersType = HANDLERS;
47  // ==========================================================================
48 
49  private:
56  template <class T>
57  static inline constexpr bool is_this_type_v = std::is_same_v<Property, std::remove_reference_t<T>>;
58  template <class T>
59  using not_copying = std::enable_if_t<!is_this_type_v<T>>;
61  public:
62  // ==========================================================================
64  template <class T = StorageType>
66  : Details::PropertyBase( typeid( ValueType ), std::move( name ), std::move( doc ), std::move( semantics ) )
67  , m_value( std::forward<T>( value ) ) {
69  }
72  template <typename OWNER, typename T = ValueType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>,
73  typename = std::enable_if_t<std::is_default_constructible_v<T>>>
74  Property( OWNER* owner, std::string name ) : Property( std::move( name ), ValueType{}, "" ) {
75  owner->declareProperty( *this );
76  setOwnerType<OWNER>();
77  }
78 
81  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
82  Property( OWNER* owner, std::string name, T&& value, std::string doc = "", std::string semantics = "" )
83  : Property( std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
84  owner->declareProperty( *this );
85  setOwnerType<OWNER>();
86  }
87 
90  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
91  Property( OWNER* owner, std::string name, T&& value, std::function<void( PropertyBase& )> handler,
92  std::string doc = "", std::string semantics = "" )
93  : Property( owner, std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
94  declareUpdateHandler( std::move( handler ) );
95  }
96 
99  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
100  Property( OWNER* owner, std::string name, T&& value, void ( OWNER::*handler )( PropertyBase& ),
101  std::string doc = "", std::string semantics = "" )
102  : Property(
103  owner, std::move( name ), std::forward<T>( value ),
104  [owner, handler]( PropertyBase& p ) { ( owner->*handler )( p ); }, std::move( doc ),
105  std::move( semantics ) ) {}
108  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
109  Property( OWNER* owner, std::string name, T&& value, void ( OWNER::*handler )(), std::string doc = "",
110  std::string semantics = "" )
111  : Property(
112  owner, std::move( name ), std::forward<T>( value ),
113  [owner, handler]( PropertyBase& ) { ( owner->*handler )(); }, std::move( doc ), std::move( semantics ) ) {
114  }
115 
118  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
119  Property( OWNER* owner, std::string name, T&& value, std::function<void( PropertyBase& )> handler,
121  : Property( owner, std::move( name ), std::forward<T>( value ), std::move( handler ), std::move( doc ),
122  std::move( semantics ) ) {
123  if ( invoke ) useUpdateHandler();
124  }
125 
129  template <typename T, typename = not_copying<T>>
130  Property( T&& v ) : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value( std::forward<T>( v ) ) {}
131 
134  template <typename T = StorageType, typename = std::enable_if_t<!std::is_reference_v<T>>>
135  Property() : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value() {}
136 
139 
142  m_handlers.setReadHandler( std::move( fun ) );
143  return *this;
144  }
147  m_handlers.setUpdateHandler( std::move( fun ) );
148  return *this;
149  }
150 
152  const std::function<void( Details::PropertyBase& )> readCallBack() const override {
153  return m_handlers.getReadHandler();
154  }
156  const std::function<void( Details::PropertyBase& )> updateCallBack() const override {
157  return m_handlers.getUpdateHandler();
158  }
159 
161  bool useUpdateHandler() override {
162  m_handlers.useUpdateHandler( *this );
163  return true;
164  }
165 
167  operator const ValueType&() const {
168  m_handlers.useReadHandler( *this );
169  return m_value;
170  }
171  // /// Automatic conversion to value (reference).
172  // operator ValueType& () {
173  // useReadHandler();
174  // return m_value;
175  // }
176 
177  template <typename Dummy = TYPE, typename = std::enable_if_t<std::is_constructible_v<std::string_view, Dummy>>>
178  operator std::string_view() const {
179  m_handlers.useReadHandler( *this );
180  return m_value;
181  }
182 
185  stream << " '" << name() << "':";
186  if constexpr ( std::is_same_v<ValueType, std::string> ) {
188  toStream( value(), stream );
189  } else {
190  stream << toString();
191  }
192  return stream;
193  }
194 
195  operator std::string_view() const {
196  m_handlers.useReadHandler( *this );
197  return m_value;
198  }
199 
201  template <class T>
202  bool operator==( const T& other ) const {
203  return m_value == other;
204  }
205 
207  template <class T>
208  bool operator!=( const T& other ) const {
209  return m_value != other;
210  }
211 
213  template <class T>
214  bool operator<( const T& other ) const {
215  return m_value < other;
216  }
217 
219  template <class T>
220  decltype( auto ) operator+( const T& other ) const {
221  return m_value + other;
222  }
223 
225  template <class T = ValueType>
226  Property& operator=( T&& v ) {
227  m_verifier( v );
228  m_value = std::forward<T>( v );
229  m_handlers.useUpdateHandler( *this );
230  return *this;
231  }
232 
234  const VerifierType& verifier() const { return m_verifier; }
237 
239  const ValueType& value() const { return *this; }
240  ValueType& value() { return const_cast<ValueType&>( (const ValueType&)*this ); }
241  bool setValue( const ValueType& v ) {
242  *this = v;
243  return true;
244  }
245  bool set( const ValueType& v ) {
246  *this = v;
247  return true;
248  }
249  Details::PropertyBase* clone() const override { return new Property( *this ); }
251 
255  template <class T = const ValueType>
256  decltype( auto ) size() const {
257  return value().size();
258  }
259  template <class T = const ValueType, typename = decltype( std::declval<const T>().length() )>
260  decltype( auto ) length() const {
261  return value().length();
262  }
263  template <class T = const ValueType>
264  decltype( auto ) empty() const {
265  return value().empty();
266  }
267  template <class T = ValueType>
268  decltype( auto ) clear() {
269  value().clear();
270  }
271  template <class T = const ValueType, typename = decltype( std::declval<const T>().begin() )>
272  decltype( auto ) begin() const {
273  return value().begin();
274  }
275  template <class T = const ValueType>
276  decltype( auto ) end() const {
277  return value().end();
278  }
279  template <class T = ValueType, typename = decltype( std::declval<T>().begin() )>
280  decltype( auto ) begin() {
281  return value().begin();
282  }
283  template <class T = ValueType>
284  decltype( auto ) end() {
285  return value().end();
286  }
287  template <class ARG>
288  decltype( auto ) operator[]( const ARG& arg ) const {
289  return value()[arg];
290  }
291  template <class ARG>
292  decltype( auto ) operator[]( const ARG& arg ) {
293  return value()[arg];
294  }
295  template <class T = const ValueType>
296  decltype( auto ) find( const typename T::key_type& key ) const {
297  return value().find( key );
298  }
299  template <class T = ValueType>
300  decltype( auto ) find( const typename T::key_type& key ) {
301  return value().find( key );
302  }
303  template <class ARG, class T = ValueType>
304  decltype( auto ) erase( ARG arg ) {
305  return value().erase( arg );
306  }
307  template <class = ValueType>
309  ++value();
310  return *this;
311  }
312  template <class = ValueType>
314  return m_value++;
315  }
316  template <class = ValueType>
318  --value();
319  return *this;
320  }
321  template <class = ValueType>
323  return m_value--;
324  }
325  template <class T = ValueType>
326  Property& operator+=( const T& other ) {
327  m_value += other;
328  return *this;
329  }
330  template <class T = ValueType>
331  Property& operator-=( const T& other ) {
332  m_value -= other;
333  return *this;
334  }
336  template <class T = const ValueType>
337  decltype( auto ) key() const {
338  return value().key();
339  }
340  template <class T = const ValueType>
341  decltype( auto ) objKey() const {
342  return value().objKey();
343  }
344  template <class T = const ValueType>
345  decltype( auto ) fullKey() const {
346  return value().fullKey();
347  }
348  template <class T = ValueType>
349  decltype( auto ) initialize() {
350  return value().initialize();
351  }
352  template <class T = ValueType>
353  decltype( auto ) makeHandles() const {
354  return value().makeHandles();
355  }
356  template <class ARG, class T = ValueType>
357  decltype( auto ) makeHandles( const ARG& arg ) const {
358  return value().makeHandles( arg );
359  }
361  // ==========================================================================
362 
363  // Delegate operator() to the value
364  template <class... Args>
365  decltype( std::declval<ValueType>()( std::declval<Args&&>()... ) ) operator()( Args&&... args ) const
366  noexcept( noexcept( std::declval<ValueType>()( std::declval<Args&&>()... ) ) ) {
367  return value()( std::forward<Args>( args )... );
368  }
369 
370  public:
372  bool assign( const Details::PropertyBase& source ) override {
373  // Check if the property is of "the same" type, except for strings
374  const Property* p =
375  ( std::is_same_v<ValueType, std::string> ) ? nullptr : dynamic_cast<const Property*>( &source );
376  if ( p ) {
377  *this = p->value();
378  } else {
379  return this->fromString( source.toString() ).isSuccess();
380  }
381  return true;
382  }
384  bool load( Details::PropertyBase& dest ) const override {
385  // delegate to the 'opposite' method
386  return dest.assign( *this );
387  }
389  StatusCode fromString( const std::string& source ) override {
390  try {
392  *this = Converter().fromString( m_value, source );
393  return StatusCode::SUCCESS;
394  } catch ( const std::exception& err ) {
397  const std::string errMsg =
398  "Cannot convert '" + source + "' for property '" + name() + "' in class '" + ownerTypeName() + "'";
399  switch ( parsingErrorPolicy() ) {
400  case ParsingErrorPolicy::Ignore:
401  break;
402  case ParsingErrorPolicy::Exception:
403  throw GaudiException( errMsg, "Property::fromString", StatusCode::FAILURE, err );
404  break;
405  case ParsingErrorPolicy::Warning:
406  std::cerr << "WARNING: " << errMsg << "': " << err.what() << '\n';
407  break;
408  case ParsingErrorPolicy::Abort:
409  std::cerr << "FATAL: " << errMsg << "': " << err.what() << '\n';
410  std::abort();
411  break;
412  }
413  return StatusCode::FAILURE;
414  }
415  }
417  std::string toString() const override {
419  return Converter().toString( *this );
420  }
422  void toStream( std::ostream& out ) const override {
423  m_handlers.useReadHandler( *this );
424  using Utils::toStream;
425  toStream( m_value, out );
426  }
427  }; // namespace Gaudi
428 
430  template <class T, class TP, class V, class H>
431  bool operator==( const T& v, const Property<TP, V, H>& p ) {
432  return p.operator==( v );
433  }
434 
436  template <class T, class TP, class V, class H>
437  bool operator!=( const T& v, const Property<TP, V, H>& p ) {
438  return p.operator!=( v );
439  }
440 
442  template <class T, class TP, class V, class H>
443  decltype( auto ) operator+( const T& v, const Property<TP, V, H>& p ) {
444  return v + p.value();
445  }
446 
447  template <class TYPE, class HANDLERS = Details::Property::UpdateHandler>
449 
450  template <class TYPE>
453 
454 } // namespace Gaudi
455 
456 template <class TYPE>
458 
459 template <class TYPE>
461 
462 // Typedef Properties for built-in types
478 
480 
481 // Typedef PropertyRefs for built-in types
497 
499 
500 // Typedef "Arrays" of Properties for built-in types
516 
518 
519 // Typedef "Arrays" of PropertyRefs for built-in types
535 
537 
540 template <typename Handler = typename Gaudi::Details::Property::UpdateHandler>
542  Handler m_handlers;
543 
544 public:
545  using PropertyBase::PropertyBase;
546 
549  m_handlers.setReadHandler( std::move( fun ) );
550  return *this;
551  }
554  m_handlers.setUpdateHandler( std::move( fun ) );
555  return *this;
556  }
557 
559  const std::function<void( PropertyBase& )> readCallBack() const override { return m_handlers.getReadHandler(); }
561  const std::function<void( PropertyBase& )> updateCallBack() const override { return m_handlers.getUpdateHandler(); }
562 
564  void useReadHandler() const { m_handlers.useReadHandler( *this ); }
565 
567  bool useUpdateHandler() override {
568  m_handlers.useUpdateHandler( *this );
569  return true;
570  }
571 };
572 
573 // forward-declaration is sufficient here
574 class GaudiHandleBase;
575 
576 // implementation in header file only where the GaudiHandleBase class
577 // definition is not needed. The rest goes into the .cpp file.
578 // The goal is to decouple the header files, to avoid that the whole
579 // world depends on GaudiHandle.h
581 public:
583 
585  setValue( value );
586  return *this;
587  }
588 
589  GaudiHandleProperty* clone() const override { return new GaudiHandleProperty( *this ); }
590 
591  bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
592 
593  bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
594 
595  std::string toString() const override;
596 
597  void toStream( std::ostream& out ) const override;
598 
599  StatusCode fromString( const std::string& s ) override;
600 
601  const GaudiHandleBase& value() const {
602  useReadHandler();
603  return *m_pValue;
604  }
605 
606  bool setValue( const GaudiHandleBase& value );
607 
608 private:
612 };
613 
614 // forward-declaration is sufficient here
616 
618 public:
620 
622  setValue( value );
623  return *this;
624  }
625 
626  GaudiHandleArrayProperty* clone() const override { return new GaudiHandleArrayProperty( *this ); }
627 
628  bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
629 
630  bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
631 
632  std::string toString() const override;
633 
634  void toStream( std::ostream& out ) const override;
635 
636  StatusCode fromString( const std::string& s ) override;
637 
638  const GaudiHandleArrayBase& value() const {
639  useReadHandler();
640  return *m_pValue;
641  }
642 
643  bool setValue( const GaudiHandleArrayBase& value );
644 
645 private:
649 };
650 
651 namespace Gaudi {
652  namespace Utils {
653  // ========================================================================
671  GAUDI_API bool hasProperty( const IProperty* p, std::string_view name );
672  // ========================================================================
690  GAUDI_API bool hasProperty( const IInterface* p, std::string_view name );
691  // ========================================================================
709  GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IProperty* p, std::string_view name );
710  // ========================================================================
728  GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IInterface* p, std::string_view name );
729  // ========================================================================
753  // ========================================================================
778  // ========================================================================
802  template <class TYPE>
803  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc );
804  // ========================================================================
827  template <class TYPE>
828  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value ) {
829  return setProperty( component, name, value, std::string() );
830  }
831  // ========================================================================
845  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const std::string& value,
846  const std::string& doc = "" );
847  // ========================================================================
861  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const char* value,
862  const std::string& doc = "" );
863  // ========================================================================
877  template <unsigned N>
878  StatusCode setProperty( IProperty* component, const std::string& name, const char ( &value )[N],
879  const std::string& doc = "" ) {
880  return component ? setProperty( component, name, std::string( value, value + N ), doc ) : StatusCode::FAILURE;
881  }
882  // ========================================================================
913  template <class TYPE>
914  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc ) {
916  return component && hasProperty( component, name )
917  ? Gaudi::Utils::setProperty( component, name, toString( value ), doc )
919  }
920  // ========================================================================
943  const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
944  // ========================================================================
967  const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
968  // ========================================================================
991  template <class TYPE>
993  const std::string& doc = "" ) {
994  return setProperty( component, name, &value, doc );
995  }
996  // ========================================================================
1017  template <class TYPE>
1018  StatusCode setProperty( IInterface* component, const std::string& name, const TYPE& value,
1019  const std::string& doc = "" ) {
1020  if ( !component ) { return StatusCode::FAILURE; }
1021  auto property = SmartIF<IProperty>{ component };
1022  return property ? setProperty( property, name, value, doc ) : StatusCode::FAILURE;
1023  }
1024  // ========================================================================
1037  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const std::string& value,
1038  const std::string& doc = "" );
1039  // ========================================================================
1052  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const char* value,
1053  const std::string& doc = "" );
1054  // ========================================================================
1068  template <unsigned N>
1069  StatusCode setProperty( IInterface* component, const std::string& name, const char ( &value )[N],
1070  const std::string& doc = "" ) {
1071  if ( 0 == component ) { return StatusCode::FAILURE; }
1072  return setProperty( component, name, std::string{ value, value + N }, doc );
1073  }
1074  // ========================================================================
1097  const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1098  // ========================================================================
1121  const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1122  // ========================================================================
1145  template <class TYPE>
1147  const std::string& doc = "" ) {
1148  return setProperty( component, name, &value, doc );
1149  }
1150  // ========================================================================
1151  } // namespace Utils
1152 } // end of namespace Gaudi
Gaudi::Property::verifier
VerifierType & verifier()
Accessor to verifier.
Definition: Property.h:236
UnsignedLongPropertyRef
Gaudi::Property< unsigned long & > UnsignedLongPropertyRef
Definition: Property.h:491
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:35
Gaudi::Property::operator-=
Property & operator-=(const T &other)
Definition: Property.h:331
PropertyWithHandlers::readCallBack
const std::function< void(PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:559
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: PropertyBase.h:39
Gaudi::Property::operator=
Property & operator=(T &&v)
Assignment from value.
Definition: Property.h:226
Gaudi::Property::value
ValueType & value()
Definition: Property.h:240
Write.stream
stream
Definition: Write.py:32
std::string
STL class.
SignedCharPropertyRef
Gaudi::Property< signed char & > SignedCharPropertyRef
Definition: Property.h:484
Gaudi::Property::operator==
bool operator==(const T &other) const
equality comparison
Definition: Property.h:202
details::size
constexpr auto size(const T &, Args &&...) noexcept
Definition: AnyDataWrapper.h:22
IOTest.N
N
Definition: IOTest.py:110
IntegerPropertyRef
Gaudi::Property< int & > IntegerPropertyRef
Definition: Property.h:488
std::exception
STL class.
GaudiHandleArrayProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:628
GaudiHandleProperty::m_pValue
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition: Property.h:611
StringArrayProperty
Gaudi::Property< std::vector< std::string > > StringArrayProperty
Definition: Property.h:517
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:638
std::move
T move(T... args)
CharArrayPropertyRef
Gaudi::Property< std::vector< char > & > CharArrayPropertyRef
Definition: Property.h:521
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
Gaudi::Property::updateCallBack
const std::function< void(Details::PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:156
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:86
UnsignedShortArrayPropertyRef
Gaudi::Property< std::vector< unsigned short > & > UnsignedShortArrayPropertyRef
Definition: Property.h:525
Gaudi::Property::operator++
ValueType operator++(int)
Definition: Property.h:313
UnsignedLongLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long long > & > UnsignedLongLongArrayPropertyRef
Definition: Property.h:531
Gaudi::Property< vector< std::string > >::not_copying
std::enable_if_t<!is_this_type_v< T > > not_copying
Definition: Property.h:59
CharArrayProperty
Gaudi::Property< std::vector< char > > CharArrayProperty
Definition: Property.h:502
ShortPropertyRef
Gaudi::Property< short & > ShortPropertyRef
Definition: Property.h:486
gaudirun.s
string s
Definition: gaudirun.py:348
GaudiPython.Bindings.GaudiHandleProperty
GaudiHandleProperty
Definition: Bindings.py:85
std::vector
STL class.
Gaudi::operator==
bool operator==(const T &v, const Property< TP, V, H > &p)
delegate (value == property) to property operator==
Definition: Property.h:431
Gaudi::Property::verifier
const VerifierType & verifier() const
Accessor to verifier.
Definition: Property.h:234
UnsignedLongLongPropertyRef
Gaudi::Property< unsigned long long & > UnsignedLongLongPropertyRef
Definition: Property.h:493
LongPropertyRef
Gaudi::Property< long & > LongPropertyRef
Definition: Property.h:490
UnsignedIntegerProperty
Gaudi::Property< unsigned int > UnsignedIntegerProperty
Definition: Property.h:470
PropertyBase.h
StringArrayPropertyRef
Gaudi::Property< std::vector< std::string > & > StringArrayPropertyRef
Definition: Property.h:536
GaudiException
Definition: GaudiException.h:31
UnsignedCharArrayPropertyRef
Gaudi::Property< std::vector< unsigned char > & > UnsignedCharArrayPropertyRef
Definition: Property.h:523
UnsignedIntegerPropertyRef
Gaudi::Property< unsigned int & > UnsignedIntegerPropertyRef
Definition: Property.h:489
Gaudi::Property::Property
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 doc...
Definition: Property.h:109
SignedCharArrayProperty
Gaudi::Property< std::vector< signed char > > SignedCharArrayProperty
Definition: Property.h:503
LongDoublePropertyRef
Gaudi::Property< long double & > LongDoublePropertyRef
Definition: Property.h:496
Gaudi::Property::m_handlers
HandlersType m_handlers
Definition: Property.h:53
Gaudi::Property::clone
Details::PropertyBase * clone() const override
clones the current property
Definition: Property.h:249
DoubleProperty
Gaudi::Property< double > DoubleProperty
Definition: Property.h:476
Gaudi::Property::Property
Property(T &&v)
Construct an anonymous property from a value.
Definition: Property.h:130
DoubleArrayProperty
Gaudi::Property< std::vector< double > > DoubleArrayProperty
Definition: Property.h:514
std::function
Gaudi::Property::assign
bool assign(const Details::PropertyBase &source) override
get the value from another property
Definition: Property.h:372
Gaudi::Details::PropertyBase::toStream
virtual void toStream(std::ostream &out) const =0
value -> stream
UnsignedCharProperty
Gaudi::Property< unsigned char > UnsignedCharProperty
Definition: Property.h:466
UnsignedLongLongArrayProperty
Gaudi::Property< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
Definition: Property.h:512
Gaudi::Property::load
bool load(Details::PropertyBase &dest) const override
set value to another property
Definition: Property.h:384
Gaudi::Details::PropertyBase::fromString
virtual StatusCode fromString(const std::string &value)=0
string -> value
ShortProperty
Gaudi::Property< short > ShortProperty
Definition: Property.h:467
ToStream.h
Gaudi::Details::PropertyBase::declareReadHandler
virtual PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for reading
LongDoubleArrayPropertyRef
Gaudi::Property< std::vector< long double > & > LongDoubleArrayPropertyRef
Definition: Property.h:534
Gaudi::Property::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: Property.h:389
GaudiHandleBase
Definition: GaudiHandle.h:99
Gaudi::Property::setValue
bool setValue(const ValueType &v)
Definition: Property.h:241
Property.h
UnsignedIntegerArrayProperty
Gaudi::Property< std::vector< unsigned int > > UnsignedIntegerArrayProperty
Definition: Property.h:508
LongProperty
Gaudi::Property< long > LongProperty
Definition: Property.h:471
Gaudi::Property< vector< std::string > >::StorageType
vector< std::string > StorageType
Hosted type.
Definition: Property.h:43
Gaudi::Details::Property::ParsingErrorPolicy
ParsingErrorPolicy
Definition: Property.h:221
IProperty
Definition: IProperty.h:33
CharPropertyRef
Gaudi::Property< char & > CharPropertyRef
Definition: Property.h:483
Gaudi::Property::operator--
ValueType operator--(int)
Definition: Property.h:322
SmartIF.h
PropertyWithHandlers::declareReadHandler
PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:548
Gaudi::Property::operator--
Property & operator--()
Definition: Property.h:317
TimingHistograms.name
name
Definition: TimingHistograms.py:25
StatusCode
Definition: StatusCode.h:65
Gaudi::tagged_bool_ns::tagged_bool
Definition: TaggedBool.h:16
TaggedBool.h
Converter
Definition: Converter.h:34
FloatPropertyRef
Gaudi::Property< float & > FloatPropertyRef
Definition: Property.h:494
std::ostream
STL class.
LongLongProperty
Gaudi::Property< long long > LongLongProperty
Definition: Property.h:473
FloatArrayProperty
Gaudi::Property< std::vector< float > > FloatArrayProperty
Definition: Property.h:513
CLHEP::begin
double * begin(CLHEP::HepVector &v)
Definition: TupleAlg.cpp:45
GaudiHandleProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:593
Gaudi::Utils::setProperty
StatusCode setProperty(IProperty *component, const std::string &name, const TYPE &value, const std::string &doc)
simple function to set the property of the given object from the value
Definition: Property.h:914
BooleanArrayProperty
Gaudi::Property< std::vector< bool > > BooleanArrayProperty
Definition: Property.h:501
Gaudi::Utils::getProperty
GAUDI_API Gaudi::Details::PropertyBase * getProperty(const IProperty *p, std::string_view name)
simple function which gets the property with given name from the component
Definition: Property.cpp:214
UnsignedCharPropertyRef
Gaudi::Property< unsigned char & > UnsignedCharPropertyRef
Definition: Property.h:485
Gaudi::Property::operator!=
bool operator!=(const T &other) const
inequality comparison
Definition: Property.h:208
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:146
PropertyFwd.h
Gaudi::Details::Property::StringConverter
Definition: Property.h:104
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:239
Gaudi::Property::Property
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.
Definition: Property.h:119
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:52
Gaudi::Property::operator+=
Property & operator+=(const T &other)
Definition: Property.h:326
LongArrayProperty
Gaudi::Property< std::vector< long > > LongArrayProperty
Definition: Property.h:509
SmartIF< IProperty >
Gaudi::Property::set
bool set(const ValueType &v)
Definition: Property.h:245
CharProperty
Gaudi::Property< char > CharProperty
Definition: Property.h:464
DoubleArrayPropertyRef
Gaudi::Property< std::vector< double > & > DoubleArrayPropertyRef
Definition: Property.h:533
GaudiHandleProperty::value
const GaudiHandleBase & value() const
Definition: Property.h:601
UnsignedShortArrayProperty
Gaudi::Property< std::vector< unsigned short > > UnsignedShortArrayProperty
Definition: Property.h:506
Gaudi::Details::PropertyBase::semantics
std::string semantics() const
property semantics
Definition: PropertyBase.h:43
PropertyWithHandlers::declareUpdateHandler
PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:553
Gaudi::Property::useUpdateHandler
bool useUpdateHandler() override
manual trigger for callback for update
Definition: Property.h:161
Gaudi::Details::Property::parsingErrorPolicy
ParsingErrorPolicy parsingErrorPolicy()
Definition: Property.cpp:522
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
GaudiHandleArrayBase
Base class of array's of various gaudihandles.
Definition: GaudiHandle.h:342
GaudiHandleArrayProperty::clone
GaudiHandleArrayProperty * clone() const override
clones the current property
Definition: Property.h:626
ShortArrayProperty
Gaudi::Property< std::vector< short > > ShortArrayProperty
Definition: Property.h:505
UnsignedShortPropertyRef
Gaudi::Property< unsigned short & > UnsignedShortPropertyRef
Definition: Property.h:487
GaudiHandleProperty::operator=
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
Definition: Property.h:584
GaudiHandleProperty
Definition: Property.h:580
LongLongPropertyRef
Gaudi::Property< long long & > LongLongPropertyRef
Definition: Property.h:492
Gaudi::Property::Property
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 doc...
Definition: Property.h:100
Gaudi::Details::PropertyBase::declareUpdateHandler
virtual PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for update
gaudirun.dest
dest
Definition: gaudirun.py:226
HistoDumpEx.v
v
Definition: HistoDumpEx.py:27
LongLongArrayProperty
Gaudi::Property< std::vector< long long > > LongLongArrayProperty
Definition: Property.h:511
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:353
Gaudi::Property::toStream
void toStream(std::ostream &out) const override
value -> stream
Definition: Property.h:422
PropertyWithHandlers
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:541
Gaudi::Property::operator++
Property & operator++()
Definition: Property.h:308
std::remove_reference
FloatProperty
Gaudi::Property< float > FloatProperty
Definition: Property.h:475
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Property::declareReadHandler
Details::PropertyBase & declareReadHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:141
Gaudi::Property::readCallBack
const std::function< void(Details::PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:152
LongLongArrayPropertyRef
Gaudi::Property< std::vector< long long > & > LongLongArrayPropertyRef
Definition: Property.h:530
gaudirun.args
args
Definition: gaudirun.py:338
PropertyWithHandlers::updateCallBack
const std::function< void(PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:561
Gaudi::Property::m_value
StorageType m_value
Storage.
Definition: Property.h:51
Gaudi::Details::PropertyBase::toString
virtual std::string toString() const =0
value -> string
std
STL namespace.
BooleanProperty
Gaudi::Property< bool > BooleanProperty
Definition: Property.h:463
Kernel.h
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
UnsignedIntegerArrayPropertyRef
Gaudi::Property< std::vector< unsigned int > & > UnsignedIntegerArrayPropertyRef
Definition: Property.h:527
IInterface
Definition: IInterface.h:237
PropertyWithHandlers::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:567
GaudiHandleArrayProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:630
UnsignedShortProperty
Gaudi::Property< unsigned short > UnsignedShortProperty
Definition: Property.h:468
UnsignedLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long > & > UnsignedLongArrayPropertyRef
Definition: Property.h:529
Gaudi::Property::Property
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.
Definition: Property.h:91
Gaudi::Property::toString
std::string toString() const override
value -> string
Definition: Property.h:417
Gaudi::Details::Property::NullVerifier
Definition: Property.h:106
FloatArrayPropertyRef
Gaudi::Property< std::vector< float > & > FloatArrayPropertyRef
Definition: Property.h:532
Gaudi::Property::operator<
bool operator<(const T &other) const
"less" comparison
Definition: Property.h:214
UnsignedLongArrayProperty
Gaudi::Property< std::vector< unsigned long > > UnsignedLongArrayProperty
Definition: Property.h:510
Gaudi::Property::is_this_type_v
static constexpr bool is_this_type_v
helper typedefs for SFINAE
Definition: Property.h:57
GaudiHandleProperty::clone
GaudiHandleProperty * clone() const override
clones the current property
Definition: Property.h:589
Gaudi::Property::Property
Property(std::string name, T &&value, std::string doc="", std::string semantics="")
the constructor with property name, value and documentation.
Definition: Property.h:65
Gaudi::Property::Property
Property(OWNER *owner, std::string name, T &&value, std::string doc="", std::string semantics="")
Autodeclaring constructor with property name, value and documentation.
Definition: Property.h:82
UnsignedLongProperty
Gaudi::Property< unsigned long > UnsignedLongProperty
Definition: Property.h:472
IProperty.h
UnsignedCharArrayProperty
Gaudi::Property< std::vector< unsigned char > > UnsignedCharArrayProperty
Definition: Property.h:504
SignedCharProperty
Gaudi::Property< signed char > SignedCharProperty
Definition: Property.h:465
IntegerArrayProperty
Gaudi::Property< std::vector< int > > IntegerArrayProperty
Definition: Property.h:507
IOTest.end
end
Definition: IOTest.py:123
compareRootHistos.ref
ref
Definition: compareRootHistos.py:28
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
LongDoubleProperty
Gaudi::Property< long double > LongDoubleProperty
Definition: Property.h:477
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::operator!=
bool operator!=(const T &v, const Property< TP, V, H > &p)
delegate (value != property) to property operator!=
Definition: Property.h:437
LongDoubleArrayProperty
Gaudi::Property< std::vector< long double > > LongDoubleArrayProperty
Definition: Property.h:515
GaudiHandleArrayProperty::operator=
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
Definition: Property.h:621
ProduceConsume.key
key
Definition: ProduceConsume.py:81
UnsignedLongLongProperty
Gaudi::Property< unsigned long long > UnsignedLongLongProperty
Definition: Property.h:474
Gaudi::Property::Property
Property(OWNER *owner, std::string name)
Autodeclaring constructor with property name, value and documentation.
Definition: Property.h:74
GaudiHandleProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:591
GaudiHandleArrayProperty::m_pValue
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Definition: Property.h:648
GaudiHandleArrayProperty
Definition: Property.h:617
PropertyWithHandlers::useReadHandler
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:564
Gaudi::Property< vector< std::string > >::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: Property.h:44
LongArrayPropertyRef
Gaudi::Property< std::vector< long > & > LongArrayPropertyRef
Definition: Property.h:528
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:39
Gaudi::Utils::hasProperty
GAUDI_API bool hasProperty(const IProperty *p, std::string_view name)
simple function which check the existence of the property with the given name.
Definition: Property.cpp:106
PropertyWithHandlers::m_handlers
Handler m_handlers
Definition: Property.h:542
BooleanArrayPropertyRef
Gaudi::Property< std::vector< bool > & > BooleanArrayPropertyRef
Definition: Property.h:520
std::abort
T abort(T... args)
std::exception::what
T what(T... args)
IntegerArrayPropertyRef
Gaudi::Property< std::vector< int > & > IntegerArrayPropertyRef
Definition: Property.h:526
Gaudi::Property::fillStream
std::ostream & fillStream(std::ostream &stream) const override
Properly quote string properties when printing them.
Definition: Property.h:184
IntegerProperty
Gaudi::Property< int > IntegerProperty
Definition: Property.h:469
StringProperty
Gaudi::Property< std::string > StringProperty
Definition: Property.h:479
SignedCharArrayPropertyRef
Gaudi::Property< std::vector< signed char > & > SignedCharArrayPropertyRef
Definition: Property.h:522
PrepareBase.out
out
Definition: PrepareBase.py:20
Gaudi::Details::Property::UpdateHandler
Definition: Property.h:198
StringPropertyRef
Gaudi::Property< std::string & > StringPropertyRef
Definition: Property.h:498
DoublePropertyRef
Gaudi::Property< double & > DoublePropertyRef
Definition: Property.h:495
BooleanPropertyRef
Gaudi::Property< bool & > BooleanPropertyRef
Definition: Property.h:482
ShortArrayPropertyRef
Gaudi::Property< std::vector< short > & > ShortArrayPropertyRef
Definition: Property.h:524
Gaudi::Property::Property
Property()
Construct an anonymous property with default constructed value.
Definition: Property.h:135