The Gaudi Framework  v40r0 (475e45c1)
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 {
33  template <class TYPE, class VERIFIER = Details::Property::NullVerifier,
34  class HANDLERS = Details::Property::UpdateHandler>
36  public:
38  using StorageType = TYPE;
40  using VerifierType = VERIFIER;
41  using HandlersType = HANDLERS;
42 
43  private:
47 
48  public:
50  template <class T = StorageType>
51  Property( std::string name, T&& value, std::string doc = "", std::string semantics = "" )
52  : Details::PropertyBase( typeid( ValueType ), std::move( name ), std::move( doc ), std::move( semantics ) )
53  , m_value( std::forward<T>( value ) ) {
55  }
58  template <std::derived_from<IProperty> OWNER, typename T = ValueType>
59  requires( std::is_default_constructible_v<T> )
60  Property( OWNER* owner, std::string name ) : Property( std::move( name ), ValueType{}, "" ) {
61  owner->declareProperty( *this );
62  setOwnerType<OWNER>();
63  }
64 
67  template <std::derived_from<IProperty> OWNER, class T = StorageType>
68  Property( OWNER* owner, std::string name, T&& value, std::string doc = "", std::string semantics = "" )
69  : Property( std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
70  owner->declareProperty( *this );
71  setOwnerType<OWNER>();
72  }
73 
76  template <std::derived_from<IProperty> OWNER, class T = StorageType>
77  Property( OWNER* owner, std::string name, T&& value, std::function<void( PropertyBase& )> handler,
78  std::string doc = "", std::string semantics = "" )
79  : Property( owner, std::move( name ), std::forward<T>( value ), std::move( doc ), std::move( semantics ) ) {
80  declareUpdateHandler( std::move( handler ) );
81  }
82 
85  template <std::derived_from<IProperty> OWNER, class T = StorageType>
86  Property( OWNER* owner, std::string name, T&& value, void ( OWNER::*handler )( PropertyBase& ),
87  std::string doc = "", std::string semantics = "" )
88  : Property(
89  owner, std::move( name ), std::forward<T>( value ),
90  [owner, handler]( PropertyBase& p ) { ( owner->*handler )( p ); }, std::move( doc ),
91  std::move( semantics ) ) {}
94  template <std::derived_from<IProperty> OWNER, class T = StorageType>
95  Property( OWNER* owner, std::string name, T&& value, void ( OWNER::*handler )(), std::string doc = "",
96  std::string semantics = "" )
97  : Property(
98  owner, std::move( name ), std::forward<T>( value ),
99  [owner, handler]( PropertyBase& ) { ( owner->*handler )(); }, std::move( doc ), std::move( semantics ) ) {
100  }
101 
104  template <std::derived_from<IProperty> OWNER, class T = StorageType>
105  Property( OWNER* owner, std::string name, T&& value, std::function<void( PropertyBase& )> handler,
106  Details::Property::ImmediatelyInvokeHandler invoke, std::string doc = "", std::string semantics = "" )
107  : Property( owner, std::move( name ), std::forward<T>( value ), std::move( handler ), std::move( doc ),
108  std::move( semantics ) ) {
109  if ( invoke ) useUpdateHandler();
110  }
111 
115  template <typename T>
116  requires( !std::is_same_v<Property, std::remove_reference_t<T>> )
117  [[deprecated( "anonymous properties are deprecated" )]] Property( T&& v )
118  : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value( std::forward<T>( v ) ) {}
119 
122  template <typename T = StorageType>
123  requires( !std::is_reference_v<T> )
124  Property() : Details::PropertyBase( typeid( ValueType ), "", "", "" ), m_value() {}
125 
128 
130  Details::PropertyBase& declareReadHandler( std::function<void( Details::PropertyBase& )> fun ) override {
131  m_handlers.setReadHandler( std::move( fun ) );
132  return *this;
133  }
135  Details::PropertyBase& declareUpdateHandler( std::function<void( Details::PropertyBase& )> fun ) override {
136  m_handlers.setUpdateHandler( std::move( fun ) );
137  return *this;
138  }
139 
141  const std::function<void( Details::PropertyBase& )> readCallBack() const override {
142  return m_handlers.getReadHandler();
143  }
145  const std::function<void( Details::PropertyBase& )> updateCallBack() const override {
146  return m_handlers.getUpdateHandler();
147  }
148 
150  bool useUpdateHandler() override {
151  m_handlers.useUpdateHandler( *this );
152  return true;
153  }
154 
156  operator const ValueType&() const {
157  m_handlers.useReadHandler( *this );
158  return m_value;
159  }
160  // /// Automatic conversion to value (reference).
161  // operator ValueType& () {
162  // useReadHandler();
163  // return m_value;
164  // }
165 
166  template <typename Dummy = TYPE>
167  requires( std::is_constructible_v<std::string_view, Dummy> )
168  operator std::string_view() const {
169  m_handlers.useReadHandler( *this );
170  return m_value;
171  }
172 
174  std::ostream& fillStream( std::ostream& stream ) const override {
175  stream << " '" << name() << "':";
176  if constexpr ( std::is_same_v<ValueType, std::string> ) {
178  toStream( value(), stream );
179  } else {
180  stream << toString();
181  }
182  return stream;
183  }
184 
185  operator std::string_view() const {
186  m_handlers.useReadHandler( *this );
187  return m_value;
188  }
189 
191  template <class T>
192  bool operator==( const T& other ) const {
193  return m_value == other;
194  }
195 
197  template <class T>
198  bool operator!=( const T& other ) const {
199  return m_value != other;
200  }
201 
203  template <class T>
204  bool operator<( const T& other ) const {
205  return m_value < other;
206  }
207 
209  template <class T>
210  decltype( auto ) operator+( const T& other ) const {
211  return m_value + other;
212  }
213 
215  template <class T = ValueType>
216  Property& operator=( T&& v ) {
217  m_verifier( v );
218  m_value = std::forward<T>( v );
219  m_handlers.useUpdateHandler( *this );
220  return *this;
221  }
222 
224  const VerifierType& verifier() const { return m_verifier; }
227 
229  const ValueType& value() const { return *this; }
230  ValueType& value() { return const_cast<ValueType&>( (const ValueType&)*this ); }
231  bool setValue( const ValueType& v ) {
232  *this = v;
233  return true;
234  }
235  bool set( const ValueType& v ) {
236  *this = v;
237  return true;
238  }
239  Details::PropertyBase* clone() const override { return new Property( *this ); }
241 
245  template <class T = const ValueType>
246  decltype( auto ) size() const {
247  return value().size();
248  }
249  template <class T = const ValueType, typename = decltype( std::declval<const T>().length() )>
250  decltype( auto ) length() const {
251  return value().length();
252  }
253  template <class T = const ValueType>
254  decltype( auto ) empty() const {
255  return value().empty();
256  }
257  template <class T = ValueType>
258  decltype( auto ) clear() {
259  value().clear();
260  }
261  template <class T = const ValueType, typename = decltype( std::declval<const T>().begin() )>
262  decltype( auto ) begin() const {
263  return value().begin();
264  }
265  template <class T = const ValueType>
266  decltype( auto ) end() const {
267  return value().end();
268  }
269  template <class T = ValueType, typename = decltype( std::declval<T>().begin() )>
270  decltype( auto ) begin() {
271  return value().begin();
272  }
273  template <class T = ValueType>
274  decltype( auto ) end() {
275  return value().end();
276  }
277  template <class ARG>
278  decltype( auto ) operator[]( const ARG& arg ) const {
279  return value()[arg];
280  }
281  template <class ARG>
282  decltype( auto ) operator[]( const ARG& arg ) {
283  return value()[arg];
284  }
285  template <class T = const ValueType>
286  decltype( auto ) find( const typename T::key_type& key ) const {
287  return value().find( key );
288  }
289  template <class T = ValueType>
290  decltype( auto ) find( const typename T::key_type& key ) {
291  return value().find( key );
292  }
293  template <class ARG, class T = ValueType>
294  decltype( auto ) erase( ARG arg ) {
295  return value().erase( arg );
296  }
297  template <class = ValueType>
299  ++value();
300  return *this;
301  }
302  template <class = ValueType>
304  return m_value++;
305  }
306  template <class = ValueType>
308  --value();
309  return *this;
310  }
311  template <class = ValueType>
313  return m_value--;
314  }
315  template <class T = ValueType>
316  Property& operator+=( const T& other ) {
317  m_value += other;
318  return *this;
319  }
320  template <class T = ValueType>
321  Property& operator-=( const T& other ) {
322  m_value -= other;
323  return *this;
324  }
326  template <class T = const ValueType>
327  decltype( auto ) key() const {
328  return value().key();
329  }
330  template <class T = const ValueType>
331  decltype( auto ) objKey() const {
332  return value().objKey();
333  }
334  template <class T = const ValueType>
335  decltype( auto ) fullKey() const {
336  return value().fullKey();
337  }
338  template <class T = ValueType>
339  decltype( auto ) initialize() {
340  return value().initialize();
341  }
342  template <class T = ValueType>
343  decltype( auto ) makeHandles() const {
344  return value().makeHandles();
345  }
346  template <class ARG, class T = ValueType>
347  decltype( auto ) makeHandles( const ARG& arg ) const {
348  return value().makeHandles( arg );
349  }
351 
352  // Delegate operator() to the value
353  template <class... Args>
354  decltype( std::declval<ValueType>()( std::declval<Args&&>()... ) ) operator()( Args&&... args ) const
355  noexcept( noexcept( std::declval<ValueType>()( std::declval<Args&&>()... ) ) ) {
356  return value()( std::forward<Args>( args )... );
357  }
358 
359  public:
361  bool assign( const Details::PropertyBase& source ) override {
362  // Check if the property is of "the same" type, except for strings
363  const Property* p =
364  ( std::is_same_v<ValueType, std::string> ) ? nullptr : dynamic_cast<const Property*>( &source );
365  if ( p ) {
366  *this = p->value();
367  } else {
368  return this->fromString( source.toString() ).isSuccess();
369  }
370  return true;
371  }
373  bool load( Details::PropertyBase& dest ) const override {
374  // delegate to the 'opposite' method
375  return dest.assign( *this );
376  }
378  StatusCode fromString( const std::string& source ) override {
379  try {
381  *this = Converter().fromString( m_value, source );
382  return StatusCode::SUCCESS;
383  } catch ( const std::exception& err ) {
386  const std::string errMsg =
387  "Cannot convert '" + source + "' for property '" + name() + "' in class '" + ownerTypeName() + "'";
388  switch ( parsingErrorPolicy() ) {
389  case ParsingErrorPolicy::Ignore:
390  break;
391  case ParsingErrorPolicy::Exception:
392  throw GaudiException( errMsg, "Property::fromString", StatusCode::FAILURE, err );
393  break;
394  case ParsingErrorPolicy::Warning:
395  std::cerr << "WARNING: " << errMsg << "': " << err.what() << '\n';
396  break;
397  case ParsingErrorPolicy::Abort:
398  std::cerr << "FATAL: " << errMsg << "': " << err.what() << '\n';
399  std::abort();
400  break;
401  }
402  return StatusCode::FAILURE;
403  }
404  }
406  std::string toString() const override {
408  return Converter().toString( *this );
409  }
411  void toStream( std::ostream& out ) const override {
412  m_handlers.useReadHandler( *this );
413  using Utils::toStream;
414  toStream( m_value, out );
415  }
416  }; // namespace Gaudi
417 
419  template <class T, class TP, class V, class H>
420  bool operator==( const T& v, const Property<TP, V, H>& p ) {
421  return p.operator==( v );
422  }
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  decltype( auto ) operator+( const T& v, const Property<TP, V, H>& p ) {
433  return v + p.value();
434  }
435 
436  template <class TYPE, class HANDLERS = Details::Property::UpdateHandler>
438 
439  template <class TYPE>
442 
443 } // namespace Gaudi
444 
445 template <class TYPE>
447 
448 template <class TYPE>
450 
451 // Typedef Properties for built-in types
467 
469 
470 // Typedef PropertyRefs for built-in types
486 
488 
489 // Typedef "Arrays" of Properties for built-in types
505 
507 
508 // Typedef "Arrays" of PropertyRefs for built-in types
524 
526 
529 template <typename Handler = typename Gaudi::Details::Property::UpdateHandler>
531  Handler m_handlers;
532 
533 public:
534  using PropertyBase::PropertyBase;
535 
537  PropertyBase& declareReadHandler( std::function<void( PropertyBase& )> fun ) override {
538  m_handlers.setReadHandler( std::move( fun ) );
539  return *this;
540  }
542  PropertyBase& declareUpdateHandler( std::function<void( PropertyBase& )> fun ) override {
543  m_handlers.setUpdateHandler( std::move( fun ) );
544  return *this;
545  }
546 
548  const std::function<void( PropertyBase& )> readCallBack() const override { return m_handlers.getReadHandler(); }
550  const std::function<void( PropertyBase& )> updateCallBack() const override { return m_handlers.getUpdateHandler(); }
551 
553  void useReadHandler() const { m_handlers.useReadHandler( *this ); }
554 
556  bool useUpdateHandler() override {
557  m_handlers.useUpdateHandler( *this );
558  return true;
559  }
560 };
561 
562 // forward-declaration is sufficient here
563 class GaudiHandleBase;
564 
565 // implementation in header file only where the GaudiHandleBase class
566 // definition is not needed. The rest goes into the .cpp file.
567 // The goal is to decouple the header files, to avoid that the whole
568 // world depends on GaudiHandle.h
570 public:
571  GaudiHandleProperty( std::string name, GaudiHandleBase& ref );
572 
574  setValue( value );
575  return *this;
576  }
577 
578  GaudiHandleProperty* clone() const override { return new GaudiHandleProperty( *this ); }
579 
580  bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
581 
582  bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
583 
584  std::string toString() const override;
585 
586  void toStream( std::ostream& out ) const override;
587 
588  StatusCode fromString( const std::string& s ) override;
589 
590  const GaudiHandleBase& value() const {
591  useReadHandler();
592  return *m_pValue;
593  }
594 
595  bool setValue( const GaudiHandleBase& value );
596 
597 private:
601 };
602 
603 // forward-declaration is sufficient here
605 
607 public:
609 
611  setValue( value );
612  return *this;
613  }
614 
615  GaudiHandleArrayProperty* clone() const override { return new GaudiHandleArrayProperty( *this ); }
616 
617  bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
618 
619  bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
620 
621  std::string toString() const override;
622 
623  void toStream( std::ostream& out ) const override;
624 
625  StatusCode fromString( const std::string& s ) override;
626 
627  const GaudiHandleArrayBase& value() const {
628  useReadHandler();
629  return *m_pValue;
630  }
631 
632  bool setValue( const GaudiHandleArrayBase& value );
633 
634 private:
638 };
639 
640 namespace Gaudi {
641  namespace Utils {
659  GAUDI_API bool hasProperty( const IProperty* p, std::string_view name );
677  GAUDI_API bool hasProperty( const IInterface* p, std::string_view name );
695  GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IProperty* p, std::string_view name );
713  GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IInterface* p, std::string_view name );
736  GAUDI_API bool hasProperty( const std::vector<const Gaudi::Details::PropertyBase*>* p, std::string_view name );
760  getProperty( const std::vector<const Gaudi::Details::PropertyBase*>* p, std::string_view name );
784  template <class TYPE>
785  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc );
808  template <class TYPE>
809  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value ) {
810  return setProperty( component, name, value, std::string() );
811  }
825  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const std::string& value,
826  const std::string& doc = "" );
840  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const char* value,
841  const std::string& doc = "" );
855  template <unsigned N>
856  StatusCode setProperty( IProperty* component, const std::string& name, const char ( &value )[N],
857  const std::string& doc = "" ) {
858  return component ? setProperty( component, name, std::string( value, value + N ), doc ) : StatusCode::FAILURE;
859  }
890  template <class TYPE>
891  StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc ) {
893  return component && hasProperty( component, name )
894  ? Gaudi::Utils::setProperty( component, name, toString( value ), doc )
896  }
918  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name,
919  const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
941  GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name,
942  const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
965  template <class TYPE>
966  StatusCode setProperty( IProperty* component, const std::string& name, const Gaudi::Property<TYPE>& value,
967  const std::string& doc = "" ) {
968  return setProperty( component, name, &value, doc );
969  }
990  template <class TYPE>
991  StatusCode setProperty( IInterface* component, const std::string& name, const TYPE& value,
992  const std::string& doc = "" ) {
993  if ( !component ) { return StatusCode::FAILURE; }
994  auto property = SmartIF<IProperty>{ component };
995  return property ? setProperty( property, name, value, doc ) : StatusCode::FAILURE;
996  }
1009  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const std::string& value,
1010  const std::string& doc = "" );
1023  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const char* value,
1024  const std::string& doc = "" );
1038  template <unsigned N>
1039  StatusCode setProperty( IInterface* component, const std::string& name, const char ( &value )[N],
1040  const std::string& doc = "" ) {
1041  if ( !component ) { return StatusCode::FAILURE; }
1042  return setProperty( component, name, std::string{ value, value + N }, doc );
1043  }
1065  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name,
1066  const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1088  GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name,
1089  const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1112  template <class TYPE>
1113  StatusCode setProperty( IInterface* component, const std::string& name, const Gaudi::Property<TYPE>& value,
1114  const std::string& doc = "" ) {
1115  return setProperty( component, name, &value, doc );
1116  }
1117  } // namespace Utils
1118 } // namespace Gaudi
Gaudi::Property::verifier
VerifierType & verifier()
Accessor to verifier.
Definition: Property.h:226
UnsignedLongPropertyRef
Gaudi::Property< unsigned long & > UnsignedLongPropertyRef
Definition: Property.h:480
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:77
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:34
Gaudi::Property::operator-=
Property & operator-=(const T &other)
Definition: Property.h:321
PropertyWithHandlers::readCallBack
const std::function< void(PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:548
Gaudi::Property::value
ValueType & value()
Definition: Property.h:230
Write.stream
stream
Definition: Write.py:32
SignedCharPropertyRef
Gaudi::Property< signed char & > SignedCharPropertyRef
Definition: Property.h:473
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:477
GaudiHandleArrayProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:617
GaudiHandleProperty::m_pValue
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition: Property.h:600
StringArrayProperty
Gaudi::Property< std::vector< std::string > > StringArrayProperty
Definition: Property.h:506
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:627
Gaudi::Details::PropertyBase::operator=
PropertyBase & operator=(const PropertyBase &)=default
assignment operator
CharArrayPropertyRef
Gaudi::Property< std::vector< char > & > CharArrayPropertyRef
Definition: Property.h:510
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
GaudiPartProp.decorators.std
std
Definition: decorators.py:32
Gaudi::Property::updateCallBack
const std::function< void(Details::PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:145
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:81
UnsignedShortArrayPropertyRef
Gaudi::Property< std::vector< unsigned short > & > UnsignedShortArrayPropertyRef
Definition: Property.h:514
Gaudi::Property::operator++
ValueType operator++(int)
Definition: Property.h:303
UnsignedLongLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long long > & > UnsignedLongLongArrayPropertyRef
Definition: Property.h:520
CharArrayProperty
Gaudi::Property< std::vector< char > > CharArrayProperty
Definition: Property.h:491
ShortPropertyRef
Gaudi::Property< short & > ShortPropertyRef
Definition: Property.h:475
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:420
Gaudi::Property::verifier
const VerifierType & verifier() const
Accessor to verifier.
Definition: Property.h:224
UnsignedLongLongPropertyRef
Gaudi::Property< unsigned long long & > UnsignedLongLongPropertyRef
Definition: Property.h:482
LongPropertyRef
Gaudi::Property< long & > LongPropertyRef
Definition: Property.h:479
UnsignedIntegerProperty
Gaudi::Property< unsigned int > UnsignedIntegerProperty
Definition: Property.h:459
PropertyBase.h
StringArrayPropertyRef
Gaudi::Property< std::vector< std::string > & > StringArrayPropertyRef
Definition: Property.h:525
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:116
GaudiException
Definition: GaudiException.h:29
UnsignedCharArrayPropertyRef
Gaudi::Property< std::vector< unsigned char > & > UnsignedCharArrayPropertyRef
Definition: Property.h:512
UnsignedIntegerPropertyRef
Gaudi::Property< unsigned int & > UnsignedIntegerPropertyRef
Definition: Property.h:478
SignedCharArrayProperty
Gaudi::Property< std::vector< signed char > > SignedCharArrayProperty
Definition: Property.h:492
LongDoublePropertyRef
Gaudi::Property< long double & > LongDoublePropertyRef
Definition: Property.h:485
Gaudi::Property::m_handlers
HandlersType m_handlers
Definition: Property.h:46
Gaudi::Property::clone
Details::PropertyBase * clone() const override
clones the current property
Definition: Property.h:239
DoubleProperty
Gaudi::Property< double > DoubleProperty
Definition: Property.h:465
DoubleArrayProperty
Gaudi::Property< std::vector< double > > DoubleArrayProperty
Definition: Property.h:503
Gaudi::Property::assign
bool assign(const Details::PropertyBase &source) override
get the value from another property
Definition: Property.h:361
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:455
UnsignedLongLongArrayProperty
Gaudi::Property< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
Definition: Property.h:501
Gaudi::Property::load
bool load(Details::PropertyBase &dest) const override
set value to another property
Definition: Property.h:373
Gaudi::Details::PropertyBase::fromString
virtual StatusCode fromString(const std::string &value)=0
string -> value
ShortProperty
Gaudi::Property< short > ShortProperty
Definition: Property.h:456
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:60
LongDoubleArrayPropertyRef
Gaudi::Property< std::vector< long double > & > LongDoubleArrayPropertyRef
Definition: Property.h:523
Gaudi::Property::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: Property.h:378
GaudiHandleBase
Definition: GaudiHandle.h:102
Gaudi::Property::setValue
bool setValue(const ValueType &v)
Definition: Property.h:231
Property.h
UnsignedIntegerArrayProperty
Gaudi::Property< std::vector< unsigned int > > UnsignedIntegerArrayProperty
Definition: Property.h:497
LongProperty
Gaudi::Property< long > LongProperty
Definition: Property.h:460
Gaudi::Property< std::vector< std::pair< int, int > > >::StorageType
std::vector< std::pair< int, int > > StorageType
Hosted type.
Definition: Property.h:38
Gaudi::Details::Property::ParsingErrorPolicy
ParsingErrorPolicy
Definition: Property.h:221
IProperty
Definition: IProperty.h:32
Gaudi::Property::requires
requires(!std::is_reference_v< T >) Property()
Construct an anonymous property with default constructed value.
Definition: Property.h:123
CharPropertyRef
Gaudi::Property< char & > CharPropertyRef
Definition: Property.h:472
Gaudi::Property::operator--
ValueType operator--(int)
Definition: Property.h:312
SmartIF.h
PropertyWithHandlers::declareReadHandler
PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:537
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:135
Gaudi::Property::operator--
Property & operator--()
Definition: Property.h:307
Gaudi::Details::PropertyBase::fillStream
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Definition: Property.cpp:45
StatusCode
Definition: StatusCode.h:64
Gaudi::tagged_bool_ns::tagged_bool
Definition: TaggedBool.h:15
TaggedBool.h
Converter
Definition: Converter.h:33
FloatPropertyRef
Gaudi::Property< float & > FloatPropertyRef
Definition: Property.h:483
Gaudi::Property::requires
requires(std::is_constructible_v< std::string_view, Dummy >) operator std
Definition: Property.h:167
LongLongProperty
Gaudi::Property< long long > LongLongProperty
Definition: Property.h:462
FloatArrayProperty
Gaudi::Property< std::vector< float > > FloatArrayProperty
Definition: Property.h:502
GaudiHandleProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:582
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:891
BooleanArrayProperty
Gaudi::Property< std::vector< bool > > BooleanArrayProperty
Definition: Property.h:490
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:191
UnsignedCharPropertyRef
Gaudi::Property< unsigned char & > UnsignedCharPropertyRef
Definition: Property.h:474
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:135
PropertyFwd.h
Gaudi::Details::Property::StringConverter
Definition: Property.h:104
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:229
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:117
Gaudi::Property::m_verifier
VerifierType m_verifier
Definition: Property.h:45
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:105
Gaudi::Property::operator+=
Property & operator+=(const T &other)
Definition: Property.h:316
LongArrayProperty
Gaudi::Property< std::vector< long > > LongArrayProperty
Definition: Property.h:498
SmartIF< IProperty >
Gaudi::Property::set
bool set(const ValueType &v)
Definition: Property.h:235
CharProperty
Gaudi::Property< char > CharProperty
Definition: Property.h:453
DoubleArrayPropertyRef
Gaudi::Property< std::vector< double > & > DoubleArrayPropertyRef
Definition: Property.h:522
GaudiHandleProperty::value
const GaudiHandleBase & value() const
Definition: Property.h:590
UnsignedShortArrayProperty
Gaudi::Property< std::vector< unsigned short > > UnsignedShortArrayProperty
Definition: Property.h:495
Gaudi::Details::PropertyBase::semantics
std::string semantics() const
property semantics
Definition: PropertyBase.h:42
PropertyWithHandlers::declareUpdateHandler
PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:542
Gaudi::Property::useUpdateHandler
bool useUpdateHandler() override
manual trigger for callback for update
Definition: Property.h:150
Gaudi::Details::Property::parsingErrorPolicy
ParsingErrorPolicy parsingErrorPolicy()
Definition: Property.cpp:476
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:334
GaudiHandleArrayProperty::clone
GaudiHandleArrayProperty * clone() const override
clones the current property
Definition: Property.h:615
ShortArrayProperty
Gaudi::Property< std::vector< short > > ShortArrayProperty
Definition: Property.h:494
UnsignedShortPropertyRef
Gaudi::Property< unsigned short & > UnsignedShortPropertyRef
Definition: Property.h:476
GaudiHandleProperty::operator=
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
Definition: Property.h:573
GaudiHandleProperty
Definition: Property.h:569
LongLongPropertyRef
Gaudi::Property< long long & > LongLongPropertyRef
Definition: Property.h:481
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:500
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:326
Gaudi::Property::toStream
void toStream(std::ostream &out) const override
value -> stream
Definition: Property.h:411
PropertyWithHandlers
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:530
gaudirun.type
type
Definition: gaudirun.py:160
Gaudi::Property::operator++
Property & operator++()
Definition: Property.h:298
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:86
FloatProperty
Gaudi::Property< float > FloatProperty
Definition: Property.h:464
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:99
Gaudi::Property::declareReadHandler
Details::PropertyBase & declareReadHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:130
Gaudi::Property::readCallBack
const std::function< void(Details::PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:141
LongLongArrayPropertyRef
Gaudi::Property< std::vector< long long > & > LongLongArrayPropertyRef
Definition: Property.h:519
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:550
Gaudi::Property::m_value
StorageType m_value
Definition: Property.h:44
Gaudi::Details::PropertyBase::toString
virtual std::string toString() const =0
value -> string
BooleanProperty
Gaudi::Property< bool > BooleanProperty
Definition: Property.h:452
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:304
UnsignedIntegerArrayPropertyRef
Gaudi::Property< std::vector< unsigned int > & > UnsignedIntegerArrayPropertyRef
Definition: Property.h:516
IInterface
Definition: IInterface.h:225
PropertyWithHandlers::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:556
GaudiHandleArrayProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:619
UnsignedShortProperty
Gaudi::Property< unsigned short > UnsignedShortProperty
Definition: Property.h:457
UnsignedLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long > & > UnsignedLongArrayPropertyRef
Definition: Property.h:518
Gaudi::Property::toString
std::string toString() const override
value -> string
Definition: Property.h:406
Gaudi::Details::Property::NullVerifier
Definition: Property.h:106
Gaudi::operator<
bool operator<(const Gaudi::Histo1DDef &left, const Gaudi::Histo1DDef &right)
Definition: HistoDef.cpp:44
FloatArrayPropertyRef
Gaudi::Property< std::vector< float > & > FloatArrayPropertyRef
Definition: Property.h:521
Properties.v
v
Definition: Properties.py:122
UnsignedLongArrayProperty
Gaudi::Property< std::vector< unsigned long > > UnsignedLongArrayProperty
Definition: Property.h:499
GaudiHandleProperty::clone
GaudiHandleProperty * clone() const override
clones the current property
Definition: Property.h:578
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:51
UnsignedLongProperty
Gaudi::Property< unsigned long > UnsignedLongProperty
Definition: Property.h:461
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:68
UnsignedCharArrayProperty
Gaudi::Property< std::vector< unsigned char > > UnsignedCharArrayProperty
Definition: Property.h:493
SignedCharProperty
Gaudi::Property< signed char > SignedCharProperty
Definition: Property.h:454
IntegerArrayProperty
Gaudi::Property< std::vector< int > > IntegerArrayProperty
Definition: Property.h:496
IOTest.end
end
Definition: IOTest.py:125
compareRootHistos.ref
ref
Definition: compareRootHistos.py:27
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
LongDoubleProperty
Gaudi::Property< long double > LongDoubleProperty
Definition: Property.h:466
Gaudi::Details::PropertyBase::ownerTypeName
std::string ownerTypeName() const
get the string for the type of the owner class (used for documentation)
Definition: PropertyBase.h:111
Gaudi::operator!=
bool operator!=(const T &v, const Property< TP, V, H > &p)
delegate (value != property) to property operator!=
Definition: Property.h:426
LongDoubleArrayProperty
Gaudi::Property< std::vector< long double > > LongDoubleArrayProperty
Definition: Property.h:504
GaudiHandleArrayProperty::operator=
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
Definition: Property.h:610
ProduceConsume.key
key
Definition: ProduceConsume.py:84
UnsignedLongLongProperty
Gaudi::Property< unsigned long long > UnsignedLongLongProperty
Definition: Property.h:463
GaudiHandleProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:580
GaudiHandleArrayProperty::m_pValue
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Definition: Property.h:637
GaudiHandleArrayProperty
Definition: Property.h:606
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:95
PropertyWithHandlers::useReadHandler
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:553
Gaudi::Property< std::vector< std::pair< int, int > > >::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: Property.h:39
LongArrayPropertyRef
Gaudi::Property< std::vector< long > & > LongArrayPropertyRef
Definition: Property.h:517
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:83
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:35
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:87
PropertyWithHandlers::m_handlers
Handler m_handlers
Definition: Property.h:531
BooleanArrayPropertyRef
Gaudi::Property< std::vector< bool > & > BooleanArrayPropertyRef
Definition: Property.h:509
IntegerArrayPropertyRef
Gaudi::Property< std::vector< int > & > IntegerArrayPropertyRef
Definition: Property.h:515
IntegerProperty
Gaudi::Property< int > IntegerProperty
Definition: Property.h:458
StringProperty
Gaudi::Property< std::string > StringProperty
Definition: Property.h:468
SignedCharArrayPropertyRef
Gaudi::Property< std::vector< signed char > & > SignedCharArrayPropertyRef
Definition: Property.h:511
Gaudi::Functional::details::out
OptOut && out
Definition: details.h:196
Gaudi::Details::Property::UpdateHandler
Definition: Property.h:198
StringPropertyRef
Gaudi::Property< std::string & > StringPropertyRef
Definition: Property.h:487
DoublePropertyRef
Gaudi::Property< double & > DoublePropertyRef
Definition: Property.h:484
BooleanPropertyRef
Gaudi::Property< bool & > BooleanPropertyRef
Definition: Property.h:471
ShortArrayPropertyRef
Gaudi::Property< std::vector< short > & > ShortArrayPropertyRef
Definition: Property.h:513