The Gaudi Framework  v39r2 (37c0b60a)
Property.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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 <string>
22 #include <string_view>
23 #include <utility>
24 
25 namespace Gaudi {
26  // ============================================================================
34  // ============================================================================
35  template <class TYPE, class VERIFIER = Details::Property::NullVerifier,
36  class HANDLERS = Details::Property::UpdateHandler>
38  public:
39  // ==========================================================================
41  using StorageType = TYPE;
43  using VerifierType = VERIFIER;
44  using HandlersType = HANDLERS;
45  // ==========================================================================
46 
47  private:
54  template <class T>
55  static inline constexpr bool is_this_type_v = std::is_same_v<Property, std::remove_reference_t<T>>;
56  template <class T>
57  using not_copying = std::enable_if_t<!is_this_type_v<T>>;
59  public:
60  // ==========================================================================
62  template <class T = StorageType>
64  : Details::PropertyBase( typeid( ValueType ), std::move( name ), std::move( doc ), std::move( semantics ) )
65  , m_value( std::forward<T>( value ) ) {
67  }
70  template <typename OWNER, typename T = ValueType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>,
71  typename = std::enable_if_t<std::is_default_constructible_v<T>>>
72  Property( OWNER* owner, std::string name ) : Property( std::move( name ), ValueType{}, "" ) {
73  owner->declareProperty( *this );
74  setOwnerType<OWNER>();
75  }
76 
79  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
80  Property( OWNER* owner, std::string name, T&& value, std::string doc = "", std::string semantics = "" )
81  : Property( std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
82  owner->declareProperty( *this );
83  setOwnerType<OWNER>();
84  }
85 
88  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
89  Property( OWNER* owner, std::string name, T&& value, std::function<void( PropertyBase& )> handler,
90  std::string doc = "", std::string semantics = "" )
91  : Property( owner, std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
92  declareUpdateHandler( std::move( handler ) );
93  }
94 
97  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
98  Property( OWNER* owner, std::string name, T&& value, void ( OWNER::*handler )( PropertyBase& ),
99  std::string doc = "", std::string semantics = "" )
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 ) ) {}
106  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
107  Property( OWNER* owner, std::string name, T&& value, void ( OWNER::*handler )(), std::string doc = "",
108  std::string semantics = "" )
109  : Property(
110  owner, std::move( name ), std::forward<T>( value ),
111  [owner, handler]( PropertyBase& ) { ( owner->*handler )(); }, std::move( doc ), std::move( semantics ) ) {
112  }
113 
116  template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
117  Property( OWNER* owner, std::string name, T&& value, std::function<void( PropertyBase& )> handler,
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  }
123 
127  template <typename T, typename = not_copying<T>>
128  Property( T&& v ) : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value( std::forward<T>( v ) ) {}
129 
132  template <typename T = StorageType, typename = std::enable_if_t<!std::is_reference_v<T>>>
133  Property() : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value() {}
134 
137 
140  m_handlers.setReadHandler( std::move( fun ) );
141  return *this;
142  }
145  m_handlers.setUpdateHandler( std::move( fun ) );
146  return *this;
147  }
148 
150  const std::function<void( Details::PropertyBase& )> readCallBack() const override {
151  return m_handlers.getReadHandler();
152  }
154  const std::function<void( Details::PropertyBase& )> updateCallBack() const override {
155  return m_handlers.getUpdateHandler();
156  }
157 
159  bool useUpdateHandler() override {
160  m_handlers.useUpdateHandler( *this );
161  return true;
162  }
163 
165  operator const ValueType&() const {
166  m_handlers.useReadHandler( *this );
167  return m_value;
168  }
169  // /// Automatic conversion to value (reference).
170  // operator ValueType& () {
171  // useReadHandler();
172  // return m_value;
173  // }
174 
175  template <typename Dummy = TYPE, typename = std::enable_if_t<std::is_constructible_v<std::string_view, Dummy>>>
176  operator std::string_view() const {
177  m_handlers.useReadHandler( *this );
178  return m_value;
179  }
180 
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  }
192 
193  operator std::string_view() const {
194  m_handlers.useReadHandler( *this );
195  return m_value;
196  }
197 
199  template <class T>
200  bool operator==( const T& other ) const {
201  return m_value == other;
202  }
203 
205  template <class T>
206  bool operator!=( const T& other ) const {
207  return m_value != other;
208  }
209 
211  template <class T>
212  bool operator<( const T& other ) const {
213  return m_value < other;
214  }
215 
217  template <class T>
218  decltype( auto ) operator+( const T& other ) const {
219  return m_value + other;
220  }
221 
223  template <class T = ValueType>
224  Property& operator=( T&& v ) {
225  m_verifier( v );
226  m_value = std::forward<T>( v );
227  m_handlers.useUpdateHandler( *this );
228  return *this;
229  }
230 
232  const VerifierType& verifier() const { return m_verifier; }
235 
237  const ValueType& value() const { return *this; }
238  ValueType& value() { return const_cast<ValueType&>( (const ValueType&)*this ); }
239  bool setValue( const ValueType& v ) {
240  *this = v;
241  return true;
242  }
243  bool set( const ValueType& v ) {
244  *this = v;
245  return true;
246  }
247  Details::PropertyBase* clone() const override { return new Property( *this ); }
249 
253  template <class T = const ValueType>
254  decltype( auto ) size() const {
255  return value().size();
256  }
257  template <class T = const ValueType, typename = decltype( std::declval<const T>().length() )>
258  decltype( auto ) length() const {
259  return value().length();
260  }
261  template <class T = const ValueType>
262  decltype( auto ) empty() const {
263  return value().empty();
264  }
265  template <class T = ValueType>
266  decltype( auto ) clear() {
267  value().clear();
268  }
269  template <class T = const ValueType, typename = decltype( std::declval<const T>().begin() )>
270  decltype( auto ) begin() const {
271  return value().begin();
272  }
273  template <class T = const ValueType>
274  decltype( auto ) end() const {
275  return value().end();
276  }
277  template <class T = ValueType, typename = decltype( std::declval<T>().begin() )>
278  decltype( auto ) begin() {
279  return value().begin();
280  }
281  template <class T = ValueType>
282  decltype( auto ) end() {
283  return value().end();
284  }
285  template <class ARG>
286  decltype( auto ) operator[]( const ARG& arg ) const {
287  return value()[arg];
288  }
289  template <class ARG>
290  decltype( auto ) operator[]( const ARG& arg ) {
291  return value()[arg];
292  }
293  template <class T = const ValueType>
294  decltype( auto ) find( const typename T::key_type& key ) const {
295  return value().find( key );
296  }
297  template <class T = ValueType>
298  decltype( auto ) find( const typename T::key_type& key ) {
299  return value().find( key );
300  }
301  template <class ARG, class T = ValueType>
302  decltype( auto ) erase( ARG arg ) {
303  return value().erase( arg );
304  }
305  template <class = ValueType>
307  ++value();
308  return *this;
309  }
310  template <class = ValueType>
312  return m_value++;
313  }
314  template <class = ValueType>
316  --value();
317  return *this;
318  }
319  template <class = ValueType>
321  return m_value--;
322  }
323  template <class T = ValueType>
324  Property& operator+=( const T& other ) {
325  m_value += other;
326  return *this;
327  }
328  template <class T = ValueType>
329  Property& operator-=( const T& other ) {
330  m_value -= other;
331  return *this;
332  }
334  template <class T = const ValueType>
335  decltype( auto ) key() const {
336  return value().key();
337  }
338  template <class T = const ValueType>
339  decltype( auto ) objKey() const {
340  return value().objKey();
341  }
342  template <class T = const ValueType>
343  decltype( auto ) fullKey() const {
344  return value().fullKey();
345  }
346  template <class T = ValueType>
347  decltype( auto ) initialize() {
348  return value().initialize();
349  }
350  template <class T = ValueType>
351  decltype( auto ) makeHandles() const {
352  return value().makeHandles();
353  }
354  template <class ARG, class T = ValueType>
355  decltype( auto ) makeHandles( const ARG& arg ) const {
356  return value().makeHandles( arg );
357  }
359  // ==========================================================================
360 
361  // Delegate operator() to the value
362  template <class... Args>
363  decltype( std::declval<ValueType>()( std::declval<Args&&>()... ) ) operator()( Args&&... args ) const
364  noexcept( noexcept( std::declval<ValueType>()( std::declval<Args&&>()... ) ) ) {
365  return value()( std::forward<Args>( args )... );
366  }
367 
368  public:
370  bool assign( const Details::PropertyBase& source ) override {
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  }
382  bool load( Details::PropertyBase& dest ) const override {
383  // delegate to the 'opposite' method
384  return dest.assign( *this );
385  }
387  StatusCode fromString( const std::string& source ) override {
388  try {
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  }
415  std::string toString() const override {
417  return Converter().toString( *this );
418  }
420  void toStream( std::ostream& out ) const override {
421  m_handlers.useReadHandler( *this );
422  using Utils::toStream;
423  toStream( m_value, out );
424  }
425  }; // namespace Gaudi
426 
428  template <class T, class TP, class V, class H>
429  bool operator==( const T& v, const Property<TP, V, H>& p ) {
430  return p.operator==( v );
431  }
432 
434  template <class T, class TP, class V, class H>
435  bool operator!=( const T& v, const Property<TP, V, H>& p ) {
436  return p.operator!=( v );
437  }
438 
440  template <class T, class TP, class V, class H>
441  decltype( auto ) operator+( const T& v, const Property<TP, V, H>& p ) {
442  return v + p.value();
443  }
444 
445  template <class TYPE, class HANDLERS = Details::Property::UpdateHandler>
447 
448  template <class TYPE>
451 
452 } // namespace Gaudi
453 
454 template <class TYPE>
456 
457 template <class TYPE>
459 
460 // Typedef Properties for built-in types
476 
478 
479 // Typedef PropertyRefs for built-in types
495 
497 
498 // Typedef "Arrays" of Properties for built-in types
514 
516 
517 // Typedef "Arrays" of PropertyRefs for built-in types
533 
535 
538 template <typename Handler = typename Gaudi::Details::Property::UpdateHandler>
540  Handler m_handlers;
541 
542 public:
543  using PropertyBase::PropertyBase;
544 
547  m_handlers.setReadHandler( std::move( fun ) );
548  return *this;
549  }
552  m_handlers.setUpdateHandler( std::move( fun ) );
553  return *this;
554  }
555 
557  const std::function<void( PropertyBase& )> readCallBack() const override { return m_handlers.getReadHandler(); }
559  const std::function<void( PropertyBase& )> updateCallBack() const override { return m_handlers.getUpdateHandler(); }
560 
562  void useReadHandler() const { m_handlers.useReadHandler( *this ); }
563 
565  bool useUpdateHandler() override {
566  m_handlers.useUpdateHandler( *this );
567  return true;
568  }
569 };
570 
571 // forward-declaration is sufficient here
572 class GaudiHandleBase;
573 
574 // implementation in header file only where the GaudiHandleBase class
575 // definition is not needed. The rest goes into the .cpp file.
576 // The goal is to decouple the header files, to avoid that the whole
577 // world depends on GaudiHandle.h
579 public:
581 
583  setValue( value );
584  return *this;
585  }
586 
587  GaudiHandleProperty* clone() const override { return new GaudiHandleProperty( *this ); }
588 
589  bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
590 
591  bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
592 
593  std::string toString() const override;
594 
595  void toStream( std::ostream& out ) const override;
596 
597  StatusCode fromString( const std::string& s ) override;
598 
599  const GaudiHandleBase& value() const {
600  useReadHandler();
601  return *m_pValue;
602  }
603 
604  bool setValue( const GaudiHandleBase& value );
605 
606 private:
610 };
611 
612 // forward-declaration is sufficient here
614 
616 public:
618 
620  setValue( value );
621  return *this;
622  }
623 
624  GaudiHandleArrayProperty* clone() const override { return new GaudiHandleArrayProperty( *this ); }
625 
626  bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
627 
628  bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
629 
630  std::string toString() const override;
631 
632  void toStream( std::ostream& out ) const override;
633 
634  StatusCode fromString( const std::string& s ) override;
635 
636  const GaudiHandleArrayBase& value() const {
637  useReadHandler();
638  return *m_pValue;
639  }
640 
641  bool setValue( const GaudiHandleArrayBase& value );
642 
643 private:
647 };
648 
649 namespace Gaudi {
650  namespace Utils {
651  // ========================================================================
669  GAUDI_API bool hasProperty( const IProperty* p, std::string_view name );
670  // ========================================================================
688  GAUDI_API bool hasProperty( const IInterface* p, std::string_view name );
689  // ========================================================================
707  GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IProperty* p, std::string_view name );
708  // ========================================================================
726  GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IInterface* p, std::string_view name );
727  // ========================================================================
751  // ========================================================================
776  // ========================================================================
800  template <class TYPE>
801  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc );
802  // ========================================================================
825  template <class TYPE>
826  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value ) {
827  return setProperty( component, name, value, std::string() );
828  }
829  // ========================================================================
843  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const std::string& value,
844  const std::string& doc = "" );
845  // ========================================================================
859  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const char* value,
860  const std::string& doc = "" );
861  // ========================================================================
875  template <unsigned N>
876  StatusCode setProperty( IProperty* component, const std::string& name, const char ( &value )[N],
877  const std::string& doc = "" ) {
878  return component ? setProperty( component, name, std::string( value, value + N ), doc ) : StatusCode::FAILURE;
879  }
880  // ========================================================================
911  template <class TYPE>
912  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc ) {
914  return component && hasProperty( component, name )
915  ? Gaudi::Utils::setProperty( component, name, toString( value ), doc )
917  }
918  // ========================================================================
941  const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
942  // ========================================================================
965  const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
966  // ========================================================================
989  template <class TYPE>
991  const std::string& doc = "" ) {
992  return setProperty( component, name, &value, doc );
993  }
994  // ========================================================================
1015  template <class TYPE>
1016  StatusCode setProperty( IInterface* component, const std::string& name, const TYPE& value,
1017  const std::string& doc = "" ) {
1018  if ( !component ) { return StatusCode::FAILURE; }
1019  auto property = SmartIF<IProperty>{ component };
1020  return property ? setProperty( property, name, value, doc ) : StatusCode::FAILURE;
1021  }
1022  // ========================================================================
1035  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const std::string& value,
1036  const std::string& doc = "" );
1037  // ========================================================================
1050  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const char* value,
1051  const std::string& doc = "" );
1052  // ========================================================================
1066  template <unsigned N>
1067  StatusCode setProperty( IInterface* component, const std::string& name, const char ( &value )[N],
1068  const std::string& doc = "" ) {
1069  if ( !component ) { return StatusCode::FAILURE; }
1070  return setProperty( component, name, std::string{ value, value + N }, doc );
1071  }
1072  // ========================================================================
1095  const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1096  // ========================================================================
1119  const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1120  // ========================================================================
1143  template <class TYPE>
1145  const std::string& doc = "" ) {
1146  return setProperty( component, name, &value, doc );
1147  }
1148  // ========================================================================
1149  } // namespace Utils
1150 } // end of namespace Gaudi
Gaudi::Property::verifier
VerifierType & verifier()
Accessor to verifier.
Definition: Property.h:234
UnsignedLongPropertyRef
Gaudi::Property< unsigned long & > UnsignedLongPropertyRef
Definition: Property.h:489
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:329
PropertyWithHandlers::readCallBack
const std::function< void(PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:557
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:224
Gaudi::Property::value
ValueType & value()
Definition: Property.h:238
Write.stream
stream
Definition: Write.py:32
std::string
STL class.
SignedCharPropertyRef
Gaudi::Property< signed char & > SignedCharPropertyRef
Definition: Property.h:482
Gaudi::Property::operator==
bool operator==(const T &other) const
equality comparison
Definition: Property.h:200
details::size
constexpr auto size(const T &, Args &&...) noexcept
Definition: AnyDataWrapper.h:23
IOTest.N
N
Definition: IOTest.py:112
IntegerPropertyRef
Gaudi::Property< int & > IntegerPropertyRef
Definition: Property.h:486
std::exception
STL class.
GaudiHandleArrayProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:626
GaudiHandleProperty::m_pValue
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition: Property.h:609
StringArrayProperty
Gaudi::Property< std::vector< std::string > > StringArrayProperty
Definition: Property.h:515
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:636
std::move
T move(T... args)
CharArrayPropertyRef
Gaudi::Property< std::vector< char > & > CharArrayPropertyRef
Definition: Property.h:519
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:154
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:81
UnsignedShortArrayPropertyRef
Gaudi::Property< std::vector< unsigned short > & > UnsignedShortArrayPropertyRef
Definition: Property.h:523
Gaudi::Property::operator++
ValueType operator++(int)
Definition: Property.h:311
UnsignedLongLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long long > & > UnsignedLongLongArrayPropertyRef
Definition: Property.h:529
Gaudi::Property< std::vector< std::pair< int, int > > >::not_copying
std::enable_if_t<!is_this_type_v< T > > not_copying
Definition: Property.h:57
CharArrayProperty
Gaudi::Property< std::vector< char > > CharArrayProperty
Definition: Property.h:500
ShortPropertyRef
Gaudi::Property< short & > ShortPropertyRef
Definition: Property.h:484
gaudirun.s
string s
Definition: gaudirun.py:346
GaudiPython.Bindings.GaudiHandleProperty
GaudiHandleProperty
Definition: Bindings.py:80
Gaudi::operator==
bool operator==(const T &v, const Property< TP, V, H > &p)
delegate (value == property) to property operator==
Definition: Property.h:429
std::vector< std::pair< int, int > >
Gaudi::Property::verifier
const VerifierType & verifier() const
Accessor to verifier.
Definition: Property.h:232
UnsignedLongLongPropertyRef
Gaudi::Property< unsigned long long & > UnsignedLongLongPropertyRef
Definition: Property.h:491
LongPropertyRef
Gaudi::Property< long & > LongPropertyRef
Definition: Property.h:488
UnsignedIntegerProperty
Gaudi::Property< unsigned int > UnsignedIntegerProperty
Definition: Property.h:468
PropertyBase.h
StringArrayPropertyRef
Gaudi::Property< std::vector< std::string > & > StringArrayPropertyRef
Definition: Property.h:534
GaudiException
Definition: GaudiException.h:31
UnsignedCharArrayPropertyRef
Gaudi::Property< std::vector< unsigned char > & > UnsignedCharArrayPropertyRef
Definition: Property.h:521
UnsignedIntegerPropertyRef
Gaudi::Property< unsigned int & > UnsignedIntegerPropertyRef
Definition: Property.h:487
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:107
SignedCharArrayProperty
Gaudi::Property< std::vector< signed char > > SignedCharArrayProperty
Definition: Property.h:501
LongDoublePropertyRef
Gaudi::Property< long double & > LongDoublePropertyRef
Definition: Property.h:494
Gaudi::Property::m_handlers
HandlersType m_handlers
Definition: Property.h:51
Gaudi::Property::clone
Details::PropertyBase * clone() const override
clones the current property
Definition: Property.h:247
DoubleProperty
Gaudi::Property< double > DoubleProperty
Definition: Property.h:474
Gaudi::Property::Property
Property(T &&v)
Construct an anonymous property from a value.
Definition: Property.h:128
DoubleArrayProperty
Gaudi::Property< std::vector< double > > DoubleArrayProperty
Definition: Property.h:512
std::function
Gaudi::Property::assign
bool assign(const Details::PropertyBase &source) override
get the value from another property
Definition: Property.h:370
Gaudi::Details::PropertyBase::toStream
virtual void toStream(std::ostream &out) const =0
value -> stream
UnsignedCharProperty
Gaudi::Property< unsigned char > UnsignedCharProperty
Definition: Property.h:464
UnsignedLongLongArrayProperty
Gaudi::Property< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
Definition: Property.h:510
Gaudi::Property::load
bool load(Details::PropertyBase &dest) const override
set value to another property
Definition: Property.h:382
Gaudi::Details::PropertyBase::fromString
virtual StatusCode fromString(const std::string &value)=0
string -> value
ShortProperty
Gaudi::Property< short > ShortProperty
Definition: Property.h:465
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:532
Gaudi::Property::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: Property.h:387
GaudiHandleBase
Definition: GaudiHandle.h:105
Gaudi::Property::setValue
bool setValue(const ValueType &v)
Definition: Property.h:239
Property.h
UnsignedIntegerArrayProperty
Gaudi::Property< std::vector< unsigned int > > UnsignedIntegerArrayProperty
Definition: Property.h:506
LongProperty
Gaudi::Property< long > LongProperty
Definition: Property.h:469
Gaudi::Details::Property::ParsingErrorPolicy
ParsingErrorPolicy
Definition: Property.h:221
IProperty
Definition: IProperty.h:33
CharPropertyRef
Gaudi::Property< char & > CharPropertyRef
Definition: Property.h:481
Gaudi::Property::operator--
ValueType operator--(int)
Definition: Property.h:320
SmartIF.h
PropertyWithHandlers::declareReadHandler
PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:546
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:136
Gaudi::Property::operator--
Property & operator--()
Definition: Property.h:315
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:492
std::ostream
STL class.
LongLongProperty
Gaudi::Property< long long > LongLongProperty
Definition: Property.h:471
FloatArrayProperty
Gaudi::Property< std::vector< float > > FloatArrayProperty
Definition: Property.h:511
GaudiHandleProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:591
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:912
BooleanArrayProperty
Gaudi::Property< std::vector< bool > > BooleanArrayProperty
Definition: Property.h:499
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:483
Gaudi::Property::operator!=
bool operator!=(const T &other) const
inequality comparison
Definition: Property.h:206
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:144
PropertyFwd.h
Gaudi::Details::Property::StringConverter
Definition: Property.h:104
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:237
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:117
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::Property::operator+=
Property & operator+=(const T &other)
Definition: Property.h:324
LongArrayProperty
Gaudi::Property< std::vector< long > > LongArrayProperty
Definition: Property.h:507
SmartIF< IProperty >
Gaudi::Property::set
bool set(const ValueType &v)
Definition: Property.h:243
CharProperty
Gaudi::Property< char > CharProperty
Definition: Property.h:462
DoubleArrayPropertyRef
Gaudi::Property< std::vector< double > & > DoubleArrayPropertyRef
Definition: Property.h:531
GaudiHandleProperty::value
const GaudiHandleBase & value() const
Definition: Property.h:599
UnsignedShortArrayProperty
Gaudi::Property< std::vector< unsigned short > > UnsignedShortArrayProperty
Definition: Property.h:504
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:551
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
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
GaudiHandleArrayBase
Base class of array's of various gaudihandles.
Definition: GaudiHandle.h:348
GaudiHandleArrayProperty::clone
GaudiHandleArrayProperty * clone() const override
clones the current property
Definition: Property.h:624
ShortArrayProperty
Gaudi::Property< std::vector< short > > ShortArrayProperty
Definition: Property.h:503
UnsignedShortPropertyRef
Gaudi::Property< unsigned short & > UnsignedShortPropertyRef
Definition: Property.h:485
GaudiHandleProperty::operator=
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
Definition: Property.h:582
GaudiHandleProperty
Definition: Property.h:578
LongLongPropertyRef
Gaudi::Property< long long & > LongLongPropertyRef
Definition: Property.h:490
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:98
Gaudi::Details::PropertyBase::declareUpdateHandler
virtual PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for update
gaudirun.dest
dest
Definition: gaudirun.py:224
LongLongArrayProperty
Gaudi::Property< std::vector< long long > > LongLongArrayProperty
Definition: Property.h:509
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:420
PropertyWithHandlers
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:539
Gaudi::Property::operator++
Property & operator++()
Definition: Property.h:306
std::remove_reference
FloatProperty
Gaudi::Property< float > FloatProperty
Definition: Property.h:473
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
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:139
Gaudi::Property::readCallBack
const std::function< void(Details::PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:150
LongLongArrayPropertyRef
Gaudi::Property< std::vector< long long > & > LongLongArrayPropertyRef
Definition: Property.h:528
gaudirun.args
args
Definition: gaudirun.py:336
PropertyWithHandlers::updateCallBack
const std::function< void(PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:559
Gaudi::Property::m_value
StorageType m_value
Storage.
Definition: Property.h:49
Gaudi::Details::PropertyBase::toString
virtual std::string toString() const =0
value -> string
std
STL namespace.
BooleanProperty
Gaudi::Property< bool > BooleanProperty
Definition: Property.h:461
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:525
IInterface
Definition: IInterface.h:239
PropertyWithHandlers::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:565
GaudiHandleArrayProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:628
UnsignedShortProperty
Gaudi::Property< unsigned short > UnsignedShortProperty
Definition: Property.h:466
UnsignedLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long > & > UnsignedLongArrayPropertyRef
Definition: Property.h:527
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:89
Gaudi::Property::toString
std::string toString() const override
value -> string
Definition: Property.h:415
Gaudi::Details::Property::NullVerifier
Definition: Property.h:106
FloatArrayPropertyRef
Gaudi::Property< std::vector< float > & > FloatArrayPropertyRef
Definition: Property.h:530
Properties.v
v
Definition: Properties.py:122
Gaudi::Property::operator<
bool operator<(const T &other) const
"less" comparison
Definition: Property.h:212
UnsignedLongArrayProperty
Gaudi::Property< std::vector< unsigned long > > UnsignedLongArrayProperty
Definition: Property.h:508
Gaudi::Property::is_this_type_v
static constexpr bool is_this_type_v
helper typedefs for SFINAE
Definition: Property.h:55
GaudiHandleProperty::clone
GaudiHandleProperty * clone() const override
clones the current property
Definition: Property.h:587
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:63
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:80
UnsignedLongProperty
Gaudi::Property< unsigned long > UnsignedLongProperty
Definition: Property.h:470
IProperty.h
UnsignedCharArrayProperty
Gaudi::Property< std::vector< unsigned char > > UnsignedCharArrayProperty
Definition: Property.h:502
SignedCharProperty
Gaudi::Property< signed char > SignedCharProperty
Definition: Property.h:463
IntegerArrayProperty
Gaudi::Property< std::vector< int > > IntegerArrayProperty
Definition: Property.h:505
IOTest.end
end
Definition: IOTest.py:125
compareRootHistos.ref
ref
Definition: compareRootHistos.py:27
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
LongDoubleProperty
Gaudi::Property< long double > LongDoubleProperty
Definition: Property.h:475
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:435
LongDoubleArrayProperty
Gaudi::Property< std::vector< long double > > LongDoubleArrayProperty
Definition: Property.h:513
GaudiHandleArrayProperty::operator=
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
Definition: Property.h:619
ProduceConsume.key
key
Definition: ProduceConsume.py:84
UnsignedLongLongProperty
Gaudi::Property< unsigned long long > UnsignedLongLongProperty
Definition: Property.h:472
Gaudi::Property::Property
Property(OWNER *owner, std::string name)
Autodeclaring constructor with property name, value and documentation.
Definition: Property.h:72
GaudiHandleProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:589
GaudiHandleArrayProperty::m_pValue
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Definition: Property.h:646
GaudiHandleArrayProperty
Definition: Property.h:615
PropertyWithHandlers::useReadHandler
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:562
Gaudi::Property< std::vector< std::pair< int, int > > >::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: Property.h:42
LongArrayPropertyRef
Gaudi::Property< std::vector< long > & > LongArrayPropertyRef
Definition: Property.h:526
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:37
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:540
BooleanArrayPropertyRef
Gaudi::Property< std::vector< bool > & > BooleanArrayPropertyRef
Definition: Property.h:518
std::abort
T abort(T... args)
std::exception::what
T what(T... args)
IntegerArrayPropertyRef
Gaudi::Property< std::vector< int > & > IntegerArrayPropertyRef
Definition: Property.h:524
Gaudi::Property::fillStream
std::ostream & fillStream(std::ostream &stream) const override
Properly quote string properties when printing them.
Definition: Property.h:182
IntegerProperty
Gaudi::Property< int > IntegerProperty
Definition: Property.h:467
StringProperty
Gaudi::Property< std::string > StringProperty
Definition: Property.h:477
SignedCharArrayPropertyRef
Gaudi::Property< std::vector< signed char > & > SignedCharArrayPropertyRef
Definition: Property.h:520
PrepareBase.out
out
Definition: PrepareBase.py:20
Gaudi::Details::Property::UpdateHandler
Definition: Property.h:198
StringPropertyRef
Gaudi::Property< std::string & > StringPropertyRef
Definition: Property.h:496
DoublePropertyRef
Gaudi::Property< double & > DoublePropertyRef
Definition: Property.h:493
BooleanPropertyRef
Gaudi::Property< bool & > BooleanPropertyRef
Definition: Property.h:480
ShortArrayPropertyRef
Gaudi::Property< std::vector< short > & > ShortArrayPropertyRef
Definition: Property.h:522
Gaudi::Property::Property
Property()
Construct an anonymous property with default constructed value.
Definition: Property.h:133