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