The Gaudi Framework  v39r4 (77e7e51e)
Property.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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:
52 
53  public:
54  // ==========================================================================
56  template <class T = StorageType>
58  : Details::PropertyBase( typeid( ValueType ), std::move( name ), std::move( doc ), std::move( semantics ) )
59  , m_value( std::forward<T>( value ) ) {
61  }
64  template <std::derived_from<IProperty> OWNER, typename T = ValueType>
65  requires( std::is_default_constructible_v<T> )
66  Property( OWNER* owner, std::string name ) : Property( std::move( name ), ValueType{}, "" ) {
67  owner->declareProperty( *this );
68  setOwnerType<OWNER>();
69  }
70 
73  template <std::derived_from<IProperty> OWNER, class T = StorageType>
74  Property( OWNER* owner, std::string name, T&& value, std::string doc = "", std::string semantics = "" )
75  : Property( std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
76  owner->declareProperty( *this );
77  setOwnerType<OWNER>();
78  }
79 
82  template <std::derived_from<IProperty> OWNER, class T = StorageType>
83  Property( OWNER* owner, std::string name, T&& value, std::function<void( PropertyBase& )> handler,
84  std::string doc = "", std::string semantics = "" )
85  : Property( owner, std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
86  declareUpdateHandler( std::move( handler ) );
87  }
88 
91  template <std::derived_from<IProperty> OWNER, class T = StorageType>
92  Property( OWNER* owner, std::string name, T&& value, void ( OWNER::*handler )( PropertyBase& ),
93  std::string doc = "", std::string semantics = "" )
94  : Property(
95  owner, std::move( name ), std::forward<T>( value ),
96  [owner, handler]( PropertyBase& p ) { ( owner->*handler )( p ); }, std::move( doc ),
97  std::move( semantics ) ) {}
100  template <std::derived_from<IProperty> OWNER, class T = StorageType>
101  Property( OWNER* owner, std::string name, T&& value, void ( OWNER::*handler )(), std::string doc = "",
102  std::string semantics = "" )
103  : Property(
104  owner, std::move( name ), std::forward<T>( value ),
105  [owner, handler]( PropertyBase& ) { ( owner->*handler )(); }, std::move( doc ), std::move( semantics ) ) {
106  }
107 
110  template <std::derived_from<IProperty> OWNER, class T = StorageType>
111  Property( OWNER* owner, std::string name, T&& value, std::function<void( PropertyBase& )> handler,
113  : Property( owner, std::move( name ), std::forward<T>( value ), std::move( handler ), std::move( doc ),
114  std::move( semantics ) ) {
115  if ( invoke ) useUpdateHandler();
116  }
117 
121  template <typename T>
122  requires( !std::is_same_v<Property, std::remove_reference_t<T>> )
123  Property( T&& v ) : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value( std::forward<T>( v ) ) {}
124 
127  template <typename T = StorageType>
128  requires( !std::is_reference_v<T> )
129  Property() : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value() {}
130 
133 
136  m_handlers.setReadHandler( std::move( fun ) );
137  return *this;
138  }
141  m_handlers.setUpdateHandler( std::move( fun ) );
142  return *this;
143  }
144 
146  const std::function<void( Details::PropertyBase& )> readCallBack() const override {
147  return m_handlers.getReadHandler();
148  }
150  const std::function<void( Details::PropertyBase& )> updateCallBack() const override {
151  return m_handlers.getUpdateHandler();
152  }
153 
155  bool useUpdateHandler() override {
156  m_handlers.useUpdateHandler( *this );
157  return true;
158  }
159 
161  operator const ValueType&() const {
162  m_handlers.useReadHandler( *this );
163  return m_value;
164  }
165  // /// Automatic conversion to value (reference).
166  // operator ValueType& () {
167  // useReadHandler();
168  // return m_value;
169  // }
170 
171  template <typename Dummy = TYPE>
172  requires( std::is_constructible_v<std::string_view, Dummy> )
173  operator std::string_view() const {
174  m_handlers.useReadHandler( *this );
175  return m_value;
176  }
177 
179  std::ostream& fillStream( std::ostream& stream ) const override {
180  stream << " '" << name() << "':";
181  if constexpr ( std::is_same_v<ValueType, std::string> ) {
183  toStream( value(), stream );
184  } else {
185  stream << toString();
186  }
187  return stream;
188  }
189 
190  operator std::string_view() const {
191  m_handlers.useReadHandler( *this );
192  return m_value;
193  }
194 
196  template <class T>
197  bool operator==( const T& other ) const {
198  return m_value == other;
199  }
200 
202  template <class T>
203  bool operator!=( const T& other ) const {
204  return m_value != other;
205  }
206 
208  template <class T>
209  bool operator<( const T& other ) const {
210  return m_value < other;
211  }
212 
214  template <class T>
215  decltype( auto ) operator+( const T& other ) const {
216  return m_value + other;
217  }
218 
220  template <class T = ValueType>
221  Property& operator=( T&& v ) {
222  m_verifier( v );
223  m_value = std::forward<T>( v );
224  m_handlers.useUpdateHandler( *this );
225  return *this;
226  }
227 
229  const VerifierType& verifier() const { return m_verifier; }
232 
234  const ValueType& value() const { return *this; }
235  ValueType& value() { return const_cast<ValueType&>( (const ValueType&)*this ); }
236  bool setValue( const ValueType& v ) {
237  *this = v;
238  return true;
239  }
240  bool set( const ValueType& v ) {
241  *this = v;
242  return true;
243  }
244  Details::PropertyBase* clone() const override { return new Property( *this ); }
246 
250  template <class T = const ValueType>
251  decltype( auto ) size() const {
252  return value().size();
253  }
254  template <class T = const ValueType, typename = decltype( std::declval<const T>().length() )>
255  decltype( auto ) length() const {
256  return value().length();
257  }
258  template <class T = const ValueType>
259  decltype( auto ) empty() const {
260  return value().empty();
261  }
262  template <class T = ValueType>
263  decltype( auto ) clear() {
264  value().clear();
265  }
266  template <class T = const ValueType, typename = decltype( std::declval<const T>().begin() )>
267  decltype( auto ) begin() const {
268  return value().begin();
269  }
270  template <class T = const ValueType>
271  decltype( auto ) end() const {
272  return value().end();
273  }
274  template <class T = ValueType, typename = decltype( std::declval<T>().begin() )>
275  decltype( auto ) begin() {
276  return value().begin();
277  }
278  template <class T = ValueType>
279  decltype( auto ) end() {
280  return value().end();
281  }
282  template <class ARG>
283  decltype( auto ) operator[]( const ARG& arg ) const {
284  return value()[arg];
285  }
286  template <class ARG>
287  decltype( auto ) operator[]( const ARG& arg ) {
288  return value()[arg];
289  }
290  template <class T = const ValueType>
291  decltype( auto ) find( const typename T::key_type& key ) const {
292  return value().find( key );
293  }
294  template <class T = ValueType>
295  decltype( auto ) find( const typename T::key_type& key ) {
296  return value().find( key );
297  }
298  template <class ARG, class T = ValueType>
299  decltype( auto ) erase( ARG arg ) {
300  return value().erase( arg );
301  }
302  template <class = ValueType>
304  ++value();
305  return *this;
306  }
307  template <class = ValueType>
309  return m_value++;
310  }
311  template <class = ValueType>
313  --value();
314  return *this;
315  }
316  template <class = ValueType>
318  return m_value--;
319  }
320  template <class T = ValueType>
321  Property& operator+=( const T& other ) {
322  m_value += other;
323  return *this;
324  }
325  template <class T = ValueType>
326  Property& operator-=( const T& other ) {
327  m_value -= other;
328  return *this;
329  }
331  template <class T = const ValueType>
332  decltype( auto ) key() const {
333  return value().key();
334  }
335  template <class T = const ValueType>
336  decltype( auto ) objKey() const {
337  return value().objKey();
338  }
339  template <class T = const ValueType>
340  decltype( auto ) fullKey() const {
341  return value().fullKey();
342  }
343  template <class T = ValueType>
344  decltype( auto ) initialize() {
345  return value().initialize();
346  }
347  template <class T = ValueType>
348  decltype( auto ) makeHandles() const {
349  return value().makeHandles();
350  }
351  template <class ARG, class T = ValueType>
352  decltype( auto ) makeHandles( const ARG& arg ) const {
353  return value().makeHandles( arg );
354  }
356  // ==========================================================================
357 
358  // Delegate operator() to the value
359  template <class... Args>
360  decltype( std::declval<ValueType>()( std::declval<Args&&>()... ) ) operator()( Args&&... args ) const
361  noexcept( noexcept( std::declval<ValueType>()( std::declval<Args&&>()... ) ) ) {
362  return value()( std::forward<Args>( args )... );
363  }
364 
365  public:
367  bool assign( const Details::PropertyBase& source ) override {
368  // Check if the property is of "the same" type, except for strings
369  const Property* p =
370  ( std::is_same_v<ValueType, std::string> ) ? nullptr : dynamic_cast<const Property*>( &source );
371  if ( p ) {
372  *this = p->value();
373  } else {
374  return this->fromString( source.toString() ).isSuccess();
375  }
376  return true;
377  }
379  bool load( Details::PropertyBase& dest ) const override {
380  // delegate to the 'opposite' method
381  return dest.assign( *this );
382  }
384  StatusCode fromString( const std::string& source ) override {
385  try {
387  *this = Converter().fromString( m_value, source );
388  return StatusCode::SUCCESS;
389  } catch ( const std::exception& err ) {
392  const std::string errMsg =
393  "Cannot convert '" + source + "' for property '" + name() + "' in class '" + ownerTypeName() + "'";
394  switch ( parsingErrorPolicy() ) {
395  case ParsingErrorPolicy::Ignore:
396  break;
397  case ParsingErrorPolicy::Exception:
398  throw GaudiException( errMsg, "Property::fromString", StatusCode::FAILURE, err );
399  break;
400  case ParsingErrorPolicy::Warning:
401  std::cerr << "WARNING: " << errMsg << "': " << err.what() << '\n';
402  break;
403  case ParsingErrorPolicy::Abort:
404  std::cerr << "FATAL: " << errMsg << "': " << err.what() << '\n';
405  std::abort();
406  break;
407  }
408  return StatusCode::FAILURE;
409  }
410  }
412  std::string toString() const override {
414  return Converter().toString( *this );
415  }
417  void toStream( std::ostream& out ) const override {
418  m_handlers.useReadHandler( *this );
419  using Utils::toStream;
420  toStream( m_value, out );
421  }
422  }; // namespace Gaudi
423 
425  template <class T, class TP, class V, class H>
426  bool operator==( const T& v, const Property<TP, V, H>& p ) {
427  return p.operator==( v );
428  }
429 
431  template <class T, class TP, class V, class H>
432  bool operator!=( const T& v, const Property<TP, V, H>& p ) {
433  return p.operator!=( v );
434  }
435 
437  template <class T, class TP, class V, class H>
438  decltype( auto ) operator+( const T& v, const Property<TP, V, H>& p ) {
439  return v + p.value();
440  }
441 
442  template <class TYPE, class HANDLERS = Details::Property::UpdateHandler>
444 
445  template <class TYPE>
448 
449 } // namespace Gaudi
450 
451 template <class TYPE>
453 
454 template <class TYPE>
456 
457 // Typedef Properties for built-in types
473 
475 
476 // Typedef PropertyRefs for built-in types
492 
494 
495 // Typedef "Arrays" of Properties for built-in types
511 
513 
514 // Typedef "Arrays" of PropertyRefs for built-in types
530 
532 
535 template <typename Handler = typename Gaudi::Details::Property::UpdateHandler>
537  Handler m_handlers;
538 
539 public:
540  using PropertyBase::PropertyBase;
541 
544  m_handlers.setReadHandler( std::move( fun ) );
545  return *this;
546  }
549  m_handlers.setUpdateHandler( std::move( fun ) );
550  return *this;
551  }
552 
554  const std::function<void( PropertyBase& )> readCallBack() const override { return m_handlers.getReadHandler(); }
556  const std::function<void( PropertyBase& )> updateCallBack() const override { return m_handlers.getUpdateHandler(); }
557 
559  void useReadHandler() const { m_handlers.useReadHandler( *this ); }
560 
562  bool useUpdateHandler() override {
563  m_handlers.useUpdateHandler( *this );
564  return true;
565  }
566 };
567 
568 // forward-declaration is sufficient here
569 class GaudiHandleBase;
570 
571 // implementation in header file only where the GaudiHandleBase class
572 // definition is not needed. The rest goes into the .cpp file.
573 // The goal is to decouple the header files, to avoid that the whole
574 // world depends on GaudiHandle.h
576 public:
578 
580  setValue( value );
581  return *this;
582  }
583 
584  GaudiHandleProperty* clone() const override { return new GaudiHandleProperty( *this ); }
585 
586  bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
587 
588  bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
589 
590  std::string toString() const override;
591 
592  void toStream( std::ostream& out ) const override;
593 
594  StatusCode fromString( const std::string& s ) override;
595 
596  const GaudiHandleBase& value() const {
597  useReadHandler();
598  return *m_pValue;
599  }
600 
601  bool setValue( const GaudiHandleBase& value );
602 
603 private:
607 };
608 
609 // forward-declaration is sufficient here
611 
613 public:
615 
617  setValue( value );
618  return *this;
619  }
620 
621  GaudiHandleArrayProperty* clone() const override { return new GaudiHandleArrayProperty( *this ); }
622 
623  bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
624 
625  bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
626 
627  std::string toString() const override;
628 
629  void toStream( std::ostream& out ) const override;
630 
631  StatusCode fromString( const std::string& s ) override;
632 
633  const GaudiHandleArrayBase& value() const {
634  useReadHandler();
635  return *m_pValue;
636  }
637 
638  bool setValue( const GaudiHandleArrayBase& value );
639 
640 private:
644 };
645 
646 namespace Gaudi {
647  namespace Utils {
648  // ========================================================================
666  GAUDI_API bool hasProperty( const IProperty* p, std::string_view name );
667  // ========================================================================
685  GAUDI_API bool hasProperty( const IInterface* p, std::string_view name );
686  // ========================================================================
704  GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IProperty* p, std::string_view name );
705  // ========================================================================
723  GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IInterface* p, std::string_view name );
724  // ========================================================================
748  // ========================================================================
773  // ========================================================================
797  template <class TYPE>
798  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc );
799  // ========================================================================
822  template <class TYPE>
823  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value ) {
824  return setProperty( component, name, value, std::string() );
825  }
826  // ========================================================================
840  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const std::string& value,
841  const std::string& doc = "" );
842  // ========================================================================
856  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const char* value,
857  const std::string& doc = "" );
858  // ========================================================================
872  template <unsigned N>
873  StatusCode setProperty( IProperty* component, const std::string& name, const char ( &value )[N],
874  const std::string& doc = "" ) {
875  return component ? setProperty( component, name, std::string( value, value + N ), doc ) : StatusCode::FAILURE;
876  }
877  // ========================================================================
908  template <class TYPE>
909  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc ) {
911  return component && hasProperty( component, name )
912  ? Gaudi::Utils::setProperty( component, name, toString( value ), doc )
914  }
915  // ========================================================================
938  const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
939  // ========================================================================
962  const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
963  // ========================================================================
986  template <class TYPE>
988  const std::string& doc = "" ) {
989  return setProperty( component, name, &value, doc );
990  }
991  // ========================================================================
1012  template <class TYPE>
1013  StatusCode setProperty( IInterface* component, const std::string& name, const TYPE& value,
1014  const std::string& doc = "" ) {
1015  if ( !component ) { return StatusCode::FAILURE; }
1016  auto property = SmartIF<IProperty>{ component };
1017  return property ? setProperty( property, name, value, doc ) : StatusCode::FAILURE;
1018  }
1019  // ========================================================================
1032  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const std::string& value,
1033  const std::string& doc = "" );
1034  // ========================================================================
1047  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const char* value,
1048  const std::string& doc = "" );
1049  // ========================================================================
1063  template <unsigned N>
1064  StatusCode setProperty( IInterface* component, const std::string& name, const char ( &value )[N],
1065  const std::string& doc = "" ) {
1066  if ( !component ) { return StatusCode::FAILURE; }
1067  return setProperty( component, name, std::string{ value, value + N }, doc );
1068  }
1069  // ========================================================================
1092  const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1093  // ========================================================================
1116  const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1117  // ========================================================================
1140  template <class TYPE>
1142  const std::string& doc = "" ) {
1143  return setProperty( component, name, &value, doc );
1144  }
1145  // ========================================================================
1146  } // namespace Utils
1147 } // end of namespace Gaudi
Gaudi::Property::verifier
VerifierType & verifier()
Accessor to verifier.
Definition: Property.h:231
UnsignedLongPropertyRef
Gaudi::Property< unsigned long & > UnsignedLongPropertyRef
Definition: Property.h:486
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:83
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:326
PropertyWithHandlers::readCallBack
const std::function< void(PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:554
Gaudi::Property::value
ValueType & value()
Definition: Property.h:235
Write.stream
stream
Definition: Write.py:32
std::string
STL class.
SignedCharPropertyRef
Gaudi::Property< signed char & > SignedCharPropertyRef
Definition: Property.h:479
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:483
std::exception
STL class.
GaudiHandleArrayProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:623
GaudiHandleProperty::m_pValue
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition: Property.h:606
StringArrayProperty
Gaudi::Property< std::vector< std::string > > StringArrayProperty
Definition: Property.h:512
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:633
std::move
T move(T... args)
Gaudi::Details::PropertyBase::operator=
PropertyBase & operator=(const PropertyBase &)=default
assignment operator
CharArrayPropertyRef
Gaudi::Property< std::vector< char > & > CharArrayPropertyRef
Definition: Property.h:516
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:315
Gaudi::Property::updateCallBack
const std::function< void(Details::PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:150
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:81
UnsignedShortArrayPropertyRef
Gaudi::Property< std::vector< unsigned short > & > UnsignedShortArrayPropertyRef
Definition: Property.h:520
Gaudi::Property::operator++
ValueType operator++(int)
Definition: Property.h:308
UnsignedLongLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long long > & > UnsignedLongLongArrayPropertyRef
Definition: Property.h:526
CharArrayProperty
Gaudi::Property< std::vector< char > > CharArrayProperty
Definition: Property.h:497
ShortPropertyRef
Gaudi::Property< short & > ShortPropertyRef
Definition: Property.h:481
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:426
std::vector< std::pair< int, int > >
Gaudi::Property::verifier
const VerifierType & verifier() const
Accessor to verifier.
Definition: Property.h:229
UnsignedLongLongPropertyRef
Gaudi::Property< unsigned long long & > UnsignedLongLongPropertyRef
Definition: Property.h:488
LongPropertyRef
Gaudi::Property< long & > LongPropertyRef
Definition: Property.h:485
UnsignedIntegerProperty
Gaudi::Property< unsigned int > UnsignedIntegerProperty
Definition: Property.h:465
PropertyBase.h
StringArrayPropertyRef
Gaudi::Property< std::vector< std::string > & > StringArrayPropertyRef
Definition: Property.h:531
Gaudi::Property::requires
requires(!std::is_same_v< Property, std::remove_reference_t< T >>) Property(T &&v)
Construct an anonymous property from a value.
Definition: Property.h:122
GaudiException
Definition: GaudiException.h:31
UnsignedCharArrayPropertyRef
Gaudi::Property< std::vector< unsigned char > & > UnsignedCharArrayPropertyRef
Definition: Property.h:518
UnsignedIntegerPropertyRef
Gaudi::Property< unsigned int & > UnsignedIntegerPropertyRef
Definition: Property.h:484
SignedCharArrayProperty
Gaudi::Property< std::vector< signed char > > SignedCharArrayProperty
Definition: Property.h:498
LongDoublePropertyRef
Gaudi::Property< long double & > LongDoublePropertyRef
Definition: Property.h:491
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:244
DoubleProperty
Gaudi::Property< double > DoubleProperty
Definition: Property.h:471
DoubleArrayProperty
Gaudi::Property< std::vector< double > > DoubleArrayProperty
Definition: Property.h:509
std::function
Gaudi::Property::assign
bool assign(const Details::PropertyBase &source) override
get the value from another property
Definition: Property.h:367
Gaudi::Property::requires
requires(std::is_default_constructible_v< T >) Property(OWNER *owner
Autodeclaring constructor with property name, value and documentation.
Gaudi::Details::PropertyBase::toStream
virtual void toStream(std::ostream &out) const =0
value -> stream
UnsignedCharProperty
Gaudi::Property< unsigned char > UnsignedCharProperty
Definition: Property.h:461
UnsignedLongLongArrayProperty
Gaudi::Property< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
Definition: Property.h:507
Gaudi::Property::load
bool load(Details::PropertyBase &dest) const override
set value to another property
Definition: Property.h:379
Gaudi::Details::PropertyBase::fromString
virtual StatusCode fromString(const std::string &value)=0
string -> value
ShortProperty
Gaudi::Property< short > ShortProperty
Definition: Property.h:462
ToStream.h
Gaudi::Details::PropertyBase::declareReadHandler
virtual PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for reading
Gaudi::Property::name
std::string name
Definition: Property.h:66
LongDoubleArrayPropertyRef
Gaudi::Property< std::vector< long double > & > LongDoubleArrayPropertyRef
Definition: Property.h:529
Gaudi::Property::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: Property.h:384
GaudiHandleBase
Definition: GaudiHandle.h:105
Gaudi::Property::setValue
bool setValue(const ValueType &v)
Definition: Property.h:236
Property.h
UnsignedIntegerArrayProperty
Gaudi::Property< std::vector< unsigned int > > UnsignedIntegerArrayProperty
Definition: Property.h:503
LongProperty
Gaudi::Property< long > LongProperty
Definition: Property.h:466
Gaudi::Details::Property::ParsingErrorPolicy
ParsingErrorPolicy
Definition: Property.h:221
IProperty
Definition: IProperty.h:33
Gaudi::Property::requires
requires(!std::is_reference_v< T >) Property()
Construct an anonymous property with default constructed value.
Definition: Property.h:128
CharPropertyRef
Gaudi::Property< char & > CharPropertyRef
Definition: Property.h:478
Gaudi::Property::operator--
ValueType operator--(int)
Definition: Property.h:317
SmartIF.h
PropertyWithHandlers::declareReadHandler
PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:543
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:136
Gaudi::Property::operator--
Property & operator--()
Definition: Property.h:312
Gaudi::Details::PropertyBase::fillStream
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Definition: Property.cpp:60
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:489
Gaudi::Property::requires
requires(std::is_constructible_v< std::string_view, Dummy >) operator std
Definition: Property.h:172
std::ostream
STL class.
LongLongProperty
Gaudi::Property< long long > LongLongProperty
Definition: Property.h:468
FloatArrayProperty
Gaudi::Property< std::vector< float > > FloatArrayProperty
Definition: Property.h:508
GaudiHandleProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:588
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:909
BooleanArrayProperty
Gaudi::Property< std::vector< bool > > BooleanArrayProperty
Definition: Property.h:496
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:480
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:140
PropertyFwd.h
Gaudi::Details::Property::StringConverter
Definition: Property.h:104
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:234
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::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:111
Gaudi::Property::operator+=
Property & operator+=(const T &other)
Definition: Property.h:321
LongArrayProperty
Gaudi::Property< std::vector< long > > LongArrayProperty
Definition: Property.h:504
SmartIF< IProperty >
Gaudi::Property::set
bool set(const ValueType &v)
Definition: Property.h:240
CharProperty
Gaudi::Property< char > CharProperty
Definition: Property.h:459
DoubleArrayPropertyRef
Gaudi::Property< std::vector< double > & > DoubleArrayPropertyRef
Definition: Property.h:528
GaudiHandleProperty::value
const GaudiHandleBase & value() const
Definition: Property.h:596
UnsignedShortArrayProperty
Gaudi::Property< std::vector< unsigned short > > UnsignedShortArrayProperty
Definition: Property.h:501
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:548
Gaudi::Property::useUpdateHandler
bool useUpdateHandler() override
manual trigger for callback for update
Definition: Property.h:155
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:621
ShortArrayProperty
Gaudi::Property< std::vector< short > > ShortArrayProperty
Definition: Property.h:500
UnsignedShortPropertyRef
Gaudi::Property< unsigned short & > UnsignedShortPropertyRef
Definition: Property.h:482
GaudiHandleProperty::operator=
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
Definition: Property.h:579
GaudiHandleProperty
Definition: Property.h:575
LongLongPropertyRef
Gaudi::Property< long long & > LongLongPropertyRef
Definition: Property.h:487
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:506
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:357
Gaudi::Property::toStream
void toStream(std::ostream &out) const override
value -> stream
Definition: Property.h:417
PropertyWithHandlers
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:536
Gaudi::Property::operator++
Property & operator++()
Definition: Property.h:303
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:92
std::remove_reference
FloatProperty
Gaudi::Property< float > FloatProperty
Definition: Property.h:470
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:135
Gaudi::Property::readCallBack
const std::function< void(Details::PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:146
LongLongArrayPropertyRef
Gaudi::Property< std::vector< long long > & > LongLongArrayPropertyRef
Definition: Property.h:525
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:556
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:458
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:334
UnsignedIntegerArrayPropertyRef
Gaudi::Property< std::vector< unsigned int > & > UnsignedIntegerArrayPropertyRef
Definition: Property.h:522
IInterface
Definition: IInterface.h:239
PropertyWithHandlers::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:562
GaudiHandleArrayProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:625
UnsignedShortProperty
Gaudi::Property< unsigned short > UnsignedShortProperty
Definition: Property.h:463
UnsignedLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long > & > UnsignedLongArrayPropertyRef
Definition: Property.h:524
Gaudi::Property::toString
std::string toString() const override
value -> string
Definition: Property.h:412
Gaudi::Details::Property::NullVerifier
Definition: Property.h:106
Gaudi::operator<
bool operator<(const Gaudi::Histo1DDef &left, const Gaudi::Histo1DDef &right)
Definition: HistoDef.cpp:59
FloatArrayPropertyRef
Gaudi::Property< std::vector< float > & > FloatArrayPropertyRef
Definition: Property.h:527
Properties.v
v
Definition: Properties.py:122
UnsignedLongArrayProperty
Gaudi::Property< std::vector< unsigned long > > UnsignedLongArrayProperty
Definition: Property.h:505
GaudiHandleProperty::clone
GaudiHandleProperty * clone() const override
clones the current property
Definition: Property.h:584
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:57
UnsignedLongProperty
Gaudi::Property< unsigned long > UnsignedLongProperty
Definition: Property.h:467
IProperty.h
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:74
UnsignedCharArrayProperty
Gaudi::Property< std::vector< unsigned char > > UnsignedCharArrayProperty
Definition: Property.h:499
SignedCharProperty
Gaudi::Property< signed char > SignedCharProperty
Definition: Property.h:460
IntegerArrayProperty
Gaudi::Property< std::vector< int > > IntegerArrayProperty
Definition: Property.h:502
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:472
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:432
LongDoubleArrayProperty
Gaudi::Property< std::vector< long double > > LongDoubleArrayProperty
Definition: Property.h:510
GaudiHandleArrayProperty::operator=
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
Definition: Property.h:616
ProduceConsume.key
key
Definition: ProduceConsume.py:84
UnsignedLongLongProperty
Gaudi::Property< unsigned long long > UnsignedLongLongProperty
Definition: Property.h:469
GaudiHandleProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:586
GaudiHandleArrayProperty::m_pValue
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Definition: Property.h:643
GaudiHandleArrayProperty
Definition: Property.h:612
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:101
PropertyWithHandlers::useReadHandler
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:559
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:523
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:537
BooleanArrayPropertyRef
Gaudi::Property< std::vector< bool > & > BooleanArrayPropertyRef
Definition: Property.h:515
std::abort
T abort(T... args)
std::exception::what
T what(T... args)
IntegerArrayPropertyRef
Gaudi::Property< std::vector< int > & > IntegerArrayPropertyRef
Definition: Property.h:521
IntegerProperty
Gaudi::Property< int > IntegerProperty
Definition: Property.h:464
StringProperty
Gaudi::Property< std::string > StringProperty
Definition: Property.h:474
SignedCharArrayPropertyRef
Gaudi::Property< std::vector< signed char > & > SignedCharArrayPropertyRef
Definition: Property.h:517
Gaudi::Functional::details::out
OptOut && out
Definition: details.h:174
Gaudi::Details::Property::UpdateHandler
Definition: Property.h:198
StringPropertyRef
Gaudi::Property< std::string & > StringPropertyRef
Definition: Property.h:493
DoublePropertyRef
Gaudi::Property< double & > DoublePropertyRef
Definition: Property.h:490
BooleanPropertyRef
Gaudi::Property< bool & > BooleanPropertyRef
Definition: Property.h:477
ShortArrayPropertyRef
Gaudi::Property< std::vector< short > & > ShortArrayPropertyRef
Definition: Property.h:519