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