| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Property.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_PROPERTY_H
2 #define GAUDIKERNEL_PROPERTY_H
3 // ============================================================================
4 // STD & STL
5 // ============================================================================
6 #include <boost/utility/string_ref.hpp>
7 #include <stdexcept>
8 #include <string>
9 #include <typeinfo>
10 // ============================================================================
11 // Application C++ Class Headers
12 // ============================================================================
13 #include "GaudiKernel/IProperty.h"
14 #include "GaudiKernel/Kernel.h"
15 #include "GaudiKernel/Parsers.h"
16 #include "GaudiKernel/PropertyFwd.h"
17 #include "GaudiKernel/SmartIF.h"
18 #include "GaudiKernel/ToStream.h"
19
20 namespace Gaudi
21 {
22 namespace Details
23 {
24 // ============================================================================
32 class GAUDI_API PropertyBase
33 {
34 private:
35 // the default constructor is disabled
36 PropertyBase() = delete;
37
38 public:
40 const std::string name() const { return m_name.to_string(); }
42 std::string documentation() const { return m_documentation.to_string(); }
44 const std::type_info* type_info() const { return m_typeinfo; }
46 std::string type() const { return m_typeinfo->name(); }
48 virtual bool load( PropertyBase& dest ) const = 0;
50 virtual bool assign( const PropertyBase& source ) = 0;
51
52 public:
54 virtual std::string toString() const = 0;
56 virtual void toStream( std::ostream& out ) const = 0;
58 virtual StatusCode fromString( const std::string& value ) = 0;
59
60 public:
62 virtual PropertyBase& declareReadHandler( std::function<void( PropertyBase& )> fun ) = 0;
64 virtual PropertyBase& declareUpdateHandler( std::function<void( PropertyBase& )> fun ) = 0;
65
67 virtual const std::function<void( PropertyBase& )> readCallBack() const = 0;
69 virtual const std::function<void( PropertyBase& )> updateCallBack() const = 0;
70
72 virtual bool useUpdateHandler() = 0;
73
74 template <class HT>
75 inline PropertyBase& declareReadHandler( void ( HT::*MF )( PropertyBase& ), HT* instance )
76 {
77 return declareReadHandler( [=]( PropertyBase& p ) { ( instance->*MF )( p ); } );
78 }
79
80 template <class HT>
81 inline PropertyBase& declareUpdateHandler( void ( HT::*MF )( PropertyBase& ), HT* instance )
82 {
83 return declareUpdateHandler( [=]( PropertyBase& p ) { ( instance->*MF )( p ); } );
84 }
85
86 public:
88 virtual ~PropertyBase() = default;
90 void setName( std::string value ) { m_name = to_view( std::move( value ) ); }
92 void setDocumentation( std::string value ) { m_documentation = to_view( std::move( value ) ); }
94 virtual std::ostream& fillStream( std::ostream& ) const;
96 virtual PropertyBase* clone() const = 0;
97
99 void setOwnerType( const std::type_info& ownerType ) { m_ownerType = &ownerType; }
100
102 template <class OWNER>
103 void setOwnerType()
104 {
105 setOwnerType( typeid( OWNER ) );
106 }
107
109 const std::type_info* ownerType() const { return m_ownerType; }
110
112 std::string ownerTypeName() const
113 {
114 return m_ownerType ? System::typeinfoName( *m_ownerType ) : std::string( "unknown owner type" );
115 }
116
117 protected:
119 PropertyBase( const std::type_info& type, std::string name = "", std::string doc = "" )
120 : m_name( to_view( std::move( name ) ) ), m_documentation( to_view( std::move( doc ) ) ), m_typeinfo( &type )
121 {
122 }
124 PropertyBase( std::string name, const std::type_info& type )
125 : m_name( to_view( std::move( name ) ) ), m_documentation( m_name ), m_typeinfo( &type )
126 {
127 }
129 PropertyBase( const PropertyBase& ) = default;
131 PropertyBase& operator=( const PropertyBase& ) = default;
132
133 private:
135 static boost::string_ref to_view( std::string str );
137 boost::string_ref m_name;
139 boost::string_ref m_documentation;
141 const std::type_info* m_typeinfo;
143 const std::type_info* m_ownerType = nullptr;
144 };
145
146 inline std::ostream& operator<<( std::ostream& stream, const PropertyBase& prop )
147 {
148 return prop.fillStream( stream );
149 }
150
151 namespace Property
152 {
153 template <class TYPE>
154 struct StringConverter {
155 inline std::string toString( const TYPE& v )
156 {
157 using Gaudi::Utils::toString;
158 return toString( v );
159 }
160 inline TYPE fromString( const std::string& s )
161 {
162 TYPE tmp{};
163 using Gaudi::Parsers::parse;
164 if ( !parse( tmp, s ).isSuccess() ) {
165 throw std::invalid_argument( "cannot parse '" + s + "' to " + System::typeinfoName( typeid( TYPE ) ) );
166 }
167 return tmp;
168 }
169 };
170 template <>
171 inline std::string StringConverter<std::string>::toString( const std::string& v )
172 {
173 return v;
174 }
175 struct NullVerifier {
176 template <class TYPE>
177 void operator()( const TYPE& ) const
178 {
179 }
180 };
181 template <class TYPE>
182 struct BoundedVerifier {
183 void operator()( const TYPE& value ) const
184 {
185 using Gaudi::Utils::toString;
186 // throw the exception if the limit is defined and value is outside
187 if ( ( m_hasLowerBound && ( value < m_lowerBound ) ) || ( m_hasUpperBound && ( m_upperBound < value ) ) )
188 throw std::out_of_range( "value " + toString( value ) + " outside range" );
189 }
190
192 bool hasLower() const { return m_hasLowerBound; }
194 bool hasUpper() const { return m_hasUpperBound; }
196 const TYPE& lower() const { return m_lowerBound; }
198 const TYPE& upper() const { return m_upperBound; }
199
201 void setLower( const TYPE& value )
202 {
203 m_hasLowerBound = true;
204 m_lowerBound = value;
205 }
207 void setUpper( const TYPE& value )
208 {
209 m_hasUpperBound = true;
210 m_upperBound = value;
211 }
213 void clearLower()
214 {
215 m_hasLowerBound = false;
216 m_lowerBound = TYPE();
217 }
219 void clearUpper()
220 {
221 m_hasUpperBound = false;
222 m_upperBound = TYPE();
223 }
224
226 void setBounds( const TYPE& lower, const TYPE& upper )
227 {
228 setLower( lower );
229 setUpper( upper );
230 }
231
233 void clearBounds()
234 {
235 clearLower();
236 clearUpper();
237 }
238
239 private:
241 bool m_hasLowerBound{false};
242 bool m_hasUpperBound{false};
243 TYPE m_lowerBound{};
244 TYPE m_upperBound{};
245 };
246
248 struct SwapCall {
249 using callback_t = std::function<void( PropertyBase& )>;
250 callback_t tmp, &orig;
251 SwapCall( callback_t& input ) : orig( input ) { tmp.swap( orig ); }
252 ~SwapCall() { orig.swap( tmp ); }
253 void operator()( PropertyBase& p ) const { tmp( p ); }
254 };
255
256 struct NoHandler {
257 void useReadHandler( const PropertyBase& ) const {}
258 void setReadHandler( std::function<void( PropertyBase& )> )
259 {
260 throw std::logic_error( "setReadHandler not implemented for this class" );
261 }
262 std::function<void( PropertyBase& )> getReadHandler() const { return nullptr; }
263 void useUpdateHandler( const PropertyBase& ) const {}
264 void setUpdateHandler( std::function<void( PropertyBase& )> )
265 {
266 throw std::logic_error( "setUpdateHandler not implemented for this class" );
267 }
268 std::function<void( PropertyBase& )> getUpdateHandler() const { return nullptr; }
269 };
270 struct ReadHandler : NoHandler {
271 mutable std::function<void( PropertyBase& )> m_readCallBack;
272 void useReadHandler( const PropertyBase& p ) const
273 {
274 if ( m_readCallBack ) {
275 SwapCall{m_readCallBack}( const_cast<PropertyBase&>( p ) );
276 }
277 }
278 void setReadHandler( std::function<void( PropertyBase& )> fun ) { m_readCallBack = std::move( fun ); }
279 std::function<void( PropertyBase& )> getReadHandler() const { return m_readCallBack; }
280 };
281 struct UpdateHandler : NoHandler {
282 std::function<void( PropertyBase& )> m_updateCallBack;
283 void useUpdateHandler( PropertyBase& p )
284 {
285 if ( m_updateCallBack ) {
286 try {
287 SwapCall{m_updateCallBack}( p );
288 } catch ( const std::exception& x ) {
289 throw std::invalid_argument( "failure in update handler of '" + p.name() + "': " + x.what() );
290 }
291 }
292 }
293 void setUpdateHandler( std::function<void( PropertyBase& )> fun ) { m_updateCallBack = std::move( fun ); }
294 std::function<void( PropertyBase& )> getUpdateHandler() const { return m_updateCallBack; }
295 };
296 struct ReadUpdateHandler : ReadHandler, UpdateHandler {
297 using ReadHandler::useReadHandler;
298 using ReadHandler::setReadHandler;
299 using ReadHandler::getReadHandler;
300 using UpdateHandler::useUpdateHandler;
301 using UpdateHandler::setUpdateHandler;
302 using UpdateHandler::getUpdateHandler;
303 };
304 }
305
306 } // namespace Details
307
308 // ============================================================================
316 // ============================================================================
317 template <class TYPE, class VERIFIER = Details::Property::NullVerifier,
318 class HANDLERS = Details::Property::UpdateHandler>
319 class Property : public Details::PropertyBase
320 {
321 public:
322 // ==========================================================================
324 using StorageType = TYPE;
325 using ValueType = typename std::remove_reference<StorageType>::type;
326 using VerifierType = VERIFIER;
327 using HandlersType = HANDLERS;
328
329 private:
331 StorageType m_value;
332 VerifierType m_verifier;
333 HandlersType m_handlers;
336 template <class T>
337 using is_this_type = std::is_same<Property, std::remove_reference_t<T>>;
338 template <class T>
339 using not_copying = std::enable_if_t<!is_this_type<T>::value>;
341 public:
342 // ==========================================================================
344 template <class T = StorageType>
345 inline Property( std::string name, T&& value, std::string doc = "" )
346 : Details::PropertyBase( typeid( ValueType ), std::move( name ), std::move( doc ) )
347 , m_value( std::forward<T>( value ) )
348 {
349 m_verifier( m_value );
350 }
353 template <typename OWNER, typename T = ValueType,
354 typename = std::enable_if_t<std::is_base_of<IProperty, OWNER>::value>,
355 typename = std::enable_if_t<std::is_default_constructible<T>::value>>
356 inline Property( OWNER* owner, std::string name ) : Property( std::move( name ), ValueType{}, "" )
357 {
358 owner->declareProperty( *this );
359 setOwnerType<OWNER>();
360 }
361
364 template <class OWNER, class T = StorageType, typename = std::enable_if_t<std::is_base_of<IProperty, OWNER>::value>>
365 inline Property( OWNER* owner, std::string name, T&& value, std::string doc = "" )
366 : Property( std::move( name ), std::forward<T>( value ), std::move( doc ) )
367 {
368 owner->declareProperty( *this );
369 setOwnerType<OWNER>();
370 }
371
375 template <typename T, typename = not_copying<T>>
376 Property( T&& v ) : Details::PropertyBase( typeid( ValueType ), "", "" ), m_value( std::forward<T>( v ) )
377 {
378 }
379
382 template <typename T = StorageType, typename = std::enable_if_t<!std::is_reference<T>::value>>
383 Property() : Details::PropertyBase( typeid( ValueType ), "", "" ), m_value()
384 {
385 }
386
387 using Details::PropertyBase::declareReadHandler;
388 using Details::PropertyBase::declareUpdateHandler;
389
391 Details::PropertyBase& declareReadHandler( std::function<void( Details::PropertyBase& )> fun ) override
392 {
393 m_handlers.setReadHandler( std::move( fun ) );
394 return *this;
395 }
397 Details::PropertyBase& declareUpdateHandler( std::function<void( Details::PropertyBase& )> fun ) override
398 {
399 m_handlers.setUpdateHandler( std::move( fun ) );
400 return *this;
401 }
402
404 const std::function<void( Details::PropertyBase& )> readCallBack() const override
405 {
406 return m_handlers.getReadHandler();
407 }
409 const std::function<void( Details::PropertyBase& )> updateCallBack() const override
410 {
411 return m_handlers.getUpdateHandler();
412 }
413
415 bool useUpdateHandler() override
416 {
417 m_handlers.useUpdateHandler( *this );
418 return true;
419 }
420
422 operator const ValueType&() const
423 {
424 m_handlers.useReadHandler( *this );
425 return m_value;
426 }
427 // /// Automatic conversion to value (reference).
428 // operator ValueType& () {
429 // useReadHandler();
430 // return m_value;
431 // }
432
434 template <class T>
435 inline bool operator==( const T& other ) const
436 {
437 return m_value == other;
438 }
439
441 template <class T>
442 inline bool operator!=( const T& other ) const
443 {
444 return m_value != other;
445 }
446
448 template <class T>
449 inline bool operator<( const T& other ) const
450 {
451 return m_value < other;
452 }
453
455 template <class T>
456 decltype( std::declval<ValueType>() + std::declval<T>() ) operator+( const T& other ) const
457 {
458 return m_value + other;
459 }
460
462 template <class T = ValueType>
463 Property& operator=( T&& v )
464 {
465 m_verifier( v );
466 m_value = std::forward<T>( v );
467 m_handlers.useUpdateHandler( *this );
468 return *this;
469 }
470
472 const VerifierType& verifier() const { return m_verifier; }
474 VerifierType& verifier() { return m_verifier; }
475
478 const ValueType& value() const { return *this; }
479 ValueType& value() { return const_cast<ValueType&>( (const ValueType&)*this ); }
480 bool setValue( const ValueType& v )
481 {
482 *this = v;
483 return true;
484 }
485 bool set( const ValueType& v )
486 {
487 *this = v;
488 return true;
489 }
490 Details::PropertyBase* clone() const override { return new Property( *this ); }
492
496 template <class T = const ValueType>
497 inline decltype( std::declval<T>().size() ) size() const
498 {
499 return value().size();
500 }
501 template <class T = const ValueType>
502 inline decltype( std::declval<T>().length() ) length() const
503 {
504 return value().length();
505 }
506 template <class T = const ValueType>
507 inline decltype( std::declval<T>().empty() ) empty() const
508 {
509 return value().empty();
510 }
511 template <class T = ValueType>
512 inline decltype( std::declval<T>().clear() ) clear()
513 {
514 value().clear();
515 }
516 template <class T = const ValueType>
517 inline decltype( std::declval<T>().begin() ) begin() const
518 {
519 return value().begin();
520 }
521 template <class T = const ValueType>
522 inline decltype( std::declval<T>().end() ) end() const
523 {
524 return value().end();
525 }
526 template <class T = ValueType>
527 inline decltype( std::declval<T>().begin() ) begin()
528 {
529 return value().begin();
530 }
531 template <class T = ValueType>
532 inline decltype( std::declval<T>().end() ) end()
533 {
534 return value().end();
535 }
536 template <class ARG, class T = const ValueType>
537 inline decltype( std::declval<T>()[ARG{}] ) operator[]( const ARG& arg ) const
538 {
539 return value()[arg];
540 }
541 template <class ARG, class T = ValueType>
542 inline decltype( std::declval<T>()[ARG{}] ) operator[]( const ARG& arg )
543 {
544 return value()[arg];
545 }
546 template <class T = const ValueType>
547 inline decltype( std::declval<T>().find( typename T::key_type{} ) ) find( const typename T::key_type& key ) const
548 {
549 return value().find( key );
550 }
551 template <class T = ValueType>
552 inline decltype( std::declval<T>().find( typename T::key_type{} ) ) find( const typename T::key_type& key )
553 {
554 return value().find( key );
555 }
556 template <class ARG, class T = ValueType>
557 inline decltype( std::declval<T>().erase( ARG{} ) ) erase( ARG arg )
558 {
559 return value().erase( arg );
560 }
561 template <class = ValueType>
562 inline Property& operator++()
563 {
564 ++value();
565 return *this;
566 }
567 template <class = ValueType>
568 inline ValueType operator++( int )
569 {
570 return m_value++;
571 }
572 template <class = ValueType>
573 inline Property& operator--()
574 {
575 --value();
576 return *this;
577 }
578 template <class = ValueType>
579 inline ValueType operator--( int )
580 {
581 return m_value--;
582 }
583 template <class T = ValueType>
584 inline Property& operator+=( const T& other )
585 {
586 m_value += other;
587 return *this;
588 }
589 template <class T = ValueType>
590 inline Property& operator-=( const T& other )
591 {
592 m_value -= other;
593 return *this;
594 }
596 template <class T = const ValueType>
597 inline decltype( std::declval<T>().key() ) key() const
598 {
599 return value().key();
600 }
601 template <class T = const ValueType>
602 inline decltype( std::declval<T>().objKey() ) objKey() const
603 {
604 return value().objKey();
605 }
606 template <class T = const ValueType>
607 inline decltype( std::declval<T>().fullKey() ) fullKey() const
608 {
609 return value().fullKey();
610 }
611 template <class T = ValueType>
612 inline decltype( std::declval<T>().initialize() ) initialize()
613 {
614 return value().initialize();
615 }
616 template <class T = ValueType>
617 inline decltype( std::declval<T>().makeHandles() ) makeHandles() const
618 {
619 return value().makeHandles();
620 }
621 template <class ARG, class T = ValueType>
622 inline decltype( std::declval<T>().makeHandles( std::declval<ARG>() ) ) makeHandles( const ARG& arg ) const
623 {
624 return value().makeHandles( arg );
625 }
627 // ==========================================================================
628 public:
630 bool assign( const Details::PropertyBase& source ) override
631 {
632 // Check if the property of is of "the same" type, except for strings
633 const Property* p =
634 ( std::is_same<ValueType, std::string>::value ) ? nullptr : dynamic_cast<const Property*>( &source );
635 if ( p ) {
636 *this = p->value();
637 } else {
638 this->fromString( source.toString() ).ignore();
639 }
640 return true;
641 }
643 bool load( Details::PropertyBase& dest ) const override
644 {
645 // delegate to the 'opposite' method
646 return dest.assign( *this );
647 }
649 StatusCode fromString( const std::string& source ) override
650 {
651 using Converter = Details::Property::StringConverter<ValueType>;
652 *this = Converter().fromString( source );
653 return StatusCode::SUCCESS;
654 }
656 std::string toString() const override
657 {
658 using Converter = Details::Property::StringConverter<ValueType>;
659 return Converter().toString( *this );
660 }
662 void toStream( std::ostream& out ) const override
663 {
664 m_handlers.useReadHandler( *this );
665 using Utils::toStream;
666 toStream( m_value, out );
667 }
668 };
669
671 template <class T, class TP, class V, class H>
672 bool operator==( const T& v, const Property<TP, V, H>& p )
673 {
674 return p == v;
675 }
676
678 template <class T, class TP, class V, class H>
679 bool operator!=( const T& v, const Property<TP, V, H>& p )
680 {
681 return p != v;
682 }
683
685 template <class T, class TP, class V, class H>
686 decltype( std::declval<TP>() + std::declval<T>() ) operator+( const T& v, const Property<TP, V, H>& p )
687 {
688 return v + p.value();
689 }
690
691 template <class TYPE, class HANDLERS = Details::Property::UpdateHandler>
692 using CheckedProperty = Property<TYPE, Details::Property::BoundedVerifier<TYPE>, HANDLERS>;
693
694 template <class TYPE>
695 using PropertyWithReadHandler =
696 Property<TYPE, Details::Property::NullVerifier, Gaudi::Details::Property::ReadUpdateHandler>;
697
698 } // namespace Gaudi
699
700 template <class TYPE>
701 using SimpleProperty = Gaudi::Property<TYPE>;
702
703 template <class TYPE>
704 using SimplePropertyRef = Gaudi::Property<TYPE&>;
705
706 // Typedef Properties for built-in types
707 typedef Gaudi::Property<bool> BooleanProperty;
708 typedef Gaudi::Property<char> CharProperty;
709 typedef Gaudi::Property<signed char> SignedCharProperty;
710 typedef Gaudi::Property<unsigned char> UnsignedCharProperty;
711 typedef Gaudi::Property<short> ShortProperty;
712 typedef Gaudi::Property<unsigned short> UnsignedShortProperty;
713 typedef Gaudi::Property<int> IntegerProperty;
714 typedef Gaudi::Property<unsigned int> UnsignedIntegerProperty;
715 typedef Gaudi::Property<long> LongProperty;
716 typedef Gaudi::Property<unsigned long> UnsignedLongProperty;
717 typedef Gaudi::Property<long long> LongLongProperty;
718 typedef Gaudi::Property<unsigned long long> UnsignedLongLongProperty;
719 typedef Gaudi::Property<float> FloatProperty;
720 typedef Gaudi::Property<double> DoubleProperty;
721 typedef Gaudi::Property<long double> LongDoubleProperty;
722
723 typedef Gaudi::Property<std::string> StringProperty;
724
725 // Typedef PropertyRefs for built-in types
726 typedef Gaudi::Property<bool&> BooleanPropertyRef;
727 typedef Gaudi::Property<char&> CharPropertyRef;
728 typedef Gaudi::Property<signed char&> SignedCharPropertyRef;
729 typedef Gaudi::Property<unsigned char&> UnsignedCharPropertyRef;
730 typedef Gaudi::Property<short&> ShortPropertyRef;
731 typedef Gaudi::Property<unsigned short&> UnsignedShortPropertyRef;
732 typedef Gaudi::Property<int&> IntegerPropertyRef;
733 typedef Gaudi::Property<unsigned int&> UnsignedIntegerPropertyRef;
734 typedef Gaudi::Property<long&> LongPropertyRef;
735 typedef Gaudi::Property<unsigned long&> UnsignedLongPropertyRef;
736 typedef Gaudi::Property<long long&> LongLongPropertyRef;
737 typedef Gaudi::Property<unsigned long long&> UnsignedLongLongPropertyRef;
738 typedef Gaudi::Property<float&> FloatPropertyRef;
739 typedef Gaudi::Property<double&> DoublePropertyRef;
740 typedef Gaudi::Property<long double&> LongDoublePropertyRef;
741
742 typedef Gaudi::Property<std::string&> StringPropertyRef;
743
744 // Typedef "Arrays" of Properties for built-in types
745 typedef Gaudi::Property<std::vector<bool>> BooleanArrayProperty;
746 typedef Gaudi::Property<std::vector<char>> CharArrayProperty;
747 typedef Gaudi::Property<std::vector<signed char>> SignedCharArrayProperty;
748 typedef Gaudi::Property<std::vector<unsigned char>> UnsignedCharArrayProperty;
749 typedef Gaudi::Property<std::vector<short>> ShortArrayProperty;
750 typedef Gaudi::Property<std::vector<unsigned short>> UnsignedShortArrayProperty;
751 typedef Gaudi::Property<std::vector<int>> IntegerArrayProperty;
752 typedef Gaudi::Property<std::vector<unsigned int>> UnsignedIntegerArrayProperty;
753 typedef Gaudi::Property<std::vector<long>> LongArrayProperty;
754 typedef Gaudi::Property<std::vector<unsigned long>> UnsignedLongArrayProperty;
755 typedef Gaudi::Property<std::vector<long long>> LongLongArrayProperty;
756 typedef Gaudi::Property<std::vector<unsigned long long>> UnsignedLongLongArrayProperty;
757 typedef Gaudi::Property<std::vector<float>> FloatArrayProperty;
758 typedef Gaudi::Property<std::vector<double>> DoubleArrayProperty;
759 typedef Gaudi::Property<std::vector<long double>> LongDoubleArrayProperty;
760
761 typedef Gaudi::Property<std::vector<std::string>> StringArrayProperty;
762
763 // Typedef "Arrays" of PropertyRefs for built-in types
764 typedef Gaudi::Property<std::vector<bool>&> BooleanArrayPropertyRef;
765 typedef Gaudi::Property<std::vector<char>&> CharArrayPropertyRef;
766 typedef Gaudi::Property<std::vector<signed char>&> SignedCharArrayPropertyRef;
767 typedef Gaudi::Property<std::vector<unsigned char>&> UnsignedCharArrayPropertyRef;
768 typedef Gaudi::Property<std::vector<short>&> ShortArrayPropertyRef;
769 typedef Gaudi::Property<std::vector<unsigned short>&> UnsignedShortArrayPropertyRef;
770 typedef Gaudi::Property<std::vector<int>&> IntegerArrayPropertyRef;
771 typedef Gaudi::Property<std::vector<unsigned int>&> UnsignedIntegerArrayPropertyRef;
772 typedef Gaudi::Property<std::vector<long>&> LongArrayPropertyRef;
773 typedef Gaudi::Property<std::vector<unsigned long>&> UnsignedLongArrayPropertyRef;
774 typedef Gaudi::Property<std::vector<long long>&> LongLongArrayPropertyRef;
775 typedef Gaudi::Property<std::vector<unsigned long long>&> UnsignedLongLongArrayPropertyRef;
776 typedef Gaudi::Property<std::vector<float>&> FloatArrayPropertyRef;
777 typedef Gaudi::Property<std::vector<double>&> DoubleArrayPropertyRef;
778 typedef Gaudi::Property<std::vector<long double>&> LongDoubleArrayPropertyRef;
779
780 typedef Gaudi::Property<std::vector<std::string>&> StringArrayPropertyRef;
781
784 template <typename Handler = typename Gaudi::Details::Property::UpdateHandler>
785 class PropertyWithHandlers : public Gaudi::Details::PropertyBase
786 {
787 Handler m_handlers;
788
789 public:
790 using PropertyBase::PropertyBase;
791
793 PropertyBase& declareReadHandler( std::function<void( PropertyBase& )> fun ) override
794 {
795 m_handlers.setReadHandler( std::move( fun ) );
796 return *this;
797 }
799 PropertyBase& declareUpdateHandler( std::function<void( PropertyBase& )> fun ) override
800 {
801 m_handlers.setUpdateHandler( std::move( fun ) );
802 return *this;
803 }
804
806 const std::function<void( PropertyBase& )> readCallBack() const override { return m_handlers.getReadHandler(); }
808 const std::function<void( PropertyBase& )> updateCallBack() const override { return m_handlers.getUpdateHandler(); }
809
811 void useReadHandler() const { m_handlers.useReadHandler( *this ); }
812
814 bool useUpdateHandler() override
815 {
816 m_handlers.useUpdateHandler( *this );
817 return true;
818 }
819 };
820
821 // forward-declaration is sufficient here
822 class GaudiHandleBase;
823
824 // implementation in header file only where the GaudiHandleBase class
825 // definition is not needed. The rest goes into the .cpp file.
826 // The goal is to decouple the header files, to avoid that the whole
827 // world depends on GaudiHandle.h
828 class GAUDI_API GaudiHandleProperty : public PropertyWithHandlers<>
829 {
830 public:
831 GaudiHandleProperty( std::string name, GaudiHandleBase& ref );
832
833 GaudiHandleProperty& operator=( const GaudiHandleBase& value )
834 {
835 setValue( value );
836 return *this;
837 }
838
839 GaudiHandleProperty* clone() const override { return new GaudiHandleProperty( *this ); }
840
841 bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
842
843 bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
844
845 std::string toString() const override;
846
847 void toStream( std::ostream& out ) const override;
848
849 StatusCode fromString( const std::string& s ) override;
850
851 const GaudiHandleBase& value() const
852 {
853 useReadHandler();
854 return *m_pValue;
855 }
856
857 bool setValue( const GaudiHandleBase& value );
858
859 private:
862 GaudiHandleBase* m_pValue;
863 };
864
865 // forward-declaration is sufficient here
866 class GaudiHandleArrayBase;
867
868 class GAUDI_API GaudiHandleArrayProperty : public PropertyWithHandlers<>
869 {
870 public:
871 GaudiHandleArrayProperty( std::string name, GaudiHandleArrayBase& ref );
872
873 GaudiHandleArrayProperty& operator=( const GaudiHandleArrayBase& value )
874 {
875 setValue( value );
876 return *this;
877 }
878
879 GaudiHandleArrayProperty* clone() const override { return new GaudiHandleArrayProperty( *this ); }
880
881 bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
882
883 bool assign( const PropertyBase& source ) override { return fromString( source.toString() ).isSuccess(); }
884
885 std::string toString() const override;
886
887 void toStream( std::ostream& out ) const override;
888
889 StatusCode fromString( const std::string& s ) override;
890
891 const GaudiHandleArrayBase& value() const
892 {
893 useReadHandler();
894 return *m_pValue;
895 }
896
897 bool setValue( const GaudiHandleArrayBase& value );
898
899 private:
902 GaudiHandleArrayBase* m_pValue;
903 };
904
905 namespace Gaudi
906 {
907 namespace Utils
908 {
909 // ========================================================================
927 GAUDI_API bool hasProperty( const IProperty* p, const std::string& name );
928 // ========================================================================
946 GAUDI_API bool hasProperty( const IInterface* p, const std::string& name );
947 // ========================================================================
965 GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IProperty* p, const std::string& name );
966 // ========================================================================
984 GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IInterface* p, const std::string& name );
985 // ========================================================================
1008 GAUDI_API bool hasProperty( const std::vector<const Gaudi::Details::PropertyBase*>* p, const std::string& name );
1009 // ========================================================================
1032 GAUDI_API const Gaudi::Details::PropertyBase*
1033 getProperty( const std::vector<const Gaudi::Details::PropertyBase*>* p, const std::string& name );
1034 // ========================================================================
1058 template <class TYPE>
1059 StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc );
1060 // ========================================================================
1083 template <class TYPE>
1084 StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value )
1085 {
1086 return setProperty( component, name, value, std::string() );
1087 }
1088 // ========================================================================
1102 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const std::string& value,
1103 const std::string& doc = "" );
1104 // ========================================================================
1118 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const char* value,
1119 const std::string& doc = "" );
1120 // ========================================================================
1134 template <unsigned N>
1135 StatusCode setProperty( IProperty* component, const std::string& name, const char ( &value )[N],
1136 const std::string& doc = "" )
1137 {
1138 return component ? setProperty( component, name, std::string( value, value + N ), doc ) : StatusCode::FAILURE;
1139 }
1140 // ========================================================================
1171 template <class TYPE>
1172 StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc )
1173 {
1174 using Gaudi::Utils::toString;
1175 return component && hasProperty( component, name )
1176 ? Gaudi::Utils::setProperty( component, name, toString( value ), doc )
1177 : StatusCode::FAILURE;
1178 }
1179 // ========================================================================
1201 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name,
1202 const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1203 // ========================================================================
1225 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name,
1226 const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1227 // ========================================================================
1250 template <class TYPE>
1251 StatusCode setProperty( IProperty* component, const std::string& name, const Gaudi::Property<TYPE>& value,
1252 const std::string& doc = "" )
1253 {
1254 return setProperty( component, name, &value, doc );
1255 }
1256 // ========================================================================
1277 template <class TYPE>
1278 StatusCode setProperty( IInterface* component, const std::string& name, const TYPE& value,
1279 const std::string& doc = "" )
1280 {
1281 if ( !component ) {
1282 return StatusCode::FAILURE;
1283 }
1284 auto property = SmartIF<IProperty>{component};
1285 return property ? setProperty( property, name, value, doc ) : StatusCode::FAILURE;
1286 }
1287 // ========================================================================
1300 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const std::string& value,
1301 const std::string& doc = "" );
1302 // ========================================================================
1315 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const char* value,
1316 const std::string& doc = "" );
1317 // ========================================================================
1331 template <unsigned N>
1332 StatusCode setProperty( IInterface* component, const std::string& name, const char ( &value )[N],
1333 const std::string& doc = "" )
1334 {
1335 if ( 0 == component ) {
1336 return StatusCode::FAILURE;
1337 }
1338 return setProperty( component, name, std::string{value, value + N}, doc );
1339 }
1340 // ========================================================================
1362 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name,
1363 const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1364 // ========================================================================
1386 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name,
1387 const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1388 // ========================================================================
1411 template <class TYPE>
1412 StatusCode setProperty( IInterface* component, const std::string& name, const Gaudi::Property<TYPE>& value,
1413 const std::string& doc = "" )
1414 {
1415 return setProperty( component, name, &value, doc );
1416 }
1417 // ========================================================================
1418 } // end of namespace Gaudi::Utils
1419 } // end of namespace Gaudi
1420 // ============================================================================
1421 // The END
1422 // ============================================================================
1423 #endif // GAUDIKERNEL_PROPERTY_H
1424 // ============================================================================
FloatArrayPropertyRef
Gaudi::Property< std::vector< float > & > FloatArrayPropertyRef
Definition: Property.h:776
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:1172
SignedCharPropertyRef
Gaudi::Property< signed char & > SignedCharPropertyRef
Definition: Property.h:728
Gaudi::Property< vector< std::string > >::VerifierType
Details::Property::NullVerifier VerifierType
Definition: Property.h:326
SignedCharArrayPropertyRef
Gaudi::Property< std::vector< signed char > & > SignedCharArrayPropertyRef
Definition: Property.h:766
Gaudi::Details::Property::SwapCall::~SwapCall
~SwapCall()
Definition: Property.h:252
std::out_of_range
STL class.
StatusCode::SUCCESS
Definition: StatusCode.h:29
Gaudi::Property::Property
Property(OWNER *owner, std::string name)
Autodeclaring constructor with property name, value and documentation.
Definition: Property.h:356
Gaudi::Details::Property::ReadHandler::m_readCallBack
std::function< void(PropertyBase &)> m_readCallBack
Definition: Property.h:271
Gaudi::Details::Property::StringConverter::toString
std::string toString(const TYPE &v)
Definition: Property.h:155
SmartIF< IProperty >
UnsignedIntegerPropertyRef
Gaudi::Property< unsigned int & > UnsignedIntegerPropertyRef
Definition: Property.h:733
Kernel.h
std::string::empty
T empty(T...args)
Gaudi::operator!=
bool operator!=(const T &v, const Property< TP, V, H > &p)
delegate (value != property) to property operator!=
Definition: Property.h:679
GaudiHandleProperty::clone
GaudiHandleProperty * clone() const override
clones the current property
Definition: Property.h:839
Gaudi::Property::setValue
bool setValue(const ValueType &v)
Definition: Property.h:480
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:293
Gaudi::Details::Property::NoHandler::getReadHandler
std::function< void(PropertyBase &)> getReadHandler() const
Definition: Property.h:262
Gaudi::Details::Property::NoHandler::useUpdateHandler
void useUpdateHandler(const PropertyBase &) const
Definition: Property.h:263
UnsignedShortArrayProperty
Gaudi::Property< std::vector< unsigned short > > UnsignedShortArrayProperty
Definition: Property.h:750
Gaudi::Details::Property::BoundedVerifier
Definition: Property.h:182
SimpleProperty
Gaudi::Property< TYPE > SimpleProperty
Definition: Property.h:701
LongLongPropertyRef
Gaudi::Property< long long & > LongLongPropertyRef
Definition: Property.h:736
Gaudi::Details::PropertyBase::declareReadHandler
PropertyBase & declareReadHandler(void(HT::*MF)(PropertyBase &), HT *instance)
Definition: Property.h:75
IntegerArrayProperty
Gaudi::Property< std::vector< int > > IntegerArrayProperty
Definition: Property.h:751
Gaudi::Details::operator<<
std::ostream & operator<<(std::ostream &stream, const PropertyBase &prop)
Definition: Property.h:146
Gaudi::operator==
bool operator==(const T &v, const Property< TP, V, H > &p)
delegate (value == property) to property operator==
Definition: Property.h:672
Gaudi::Property::useUpdateHandler
bool useUpdateHandler() override
manual trigger for callback for update
Definition: Property.h:415
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
Gaudi::Details::PropertyBase::setDocumentation
void setDocumentation(std::string value)
set the documentation string
Definition: Property.h:92
LongLongProperty
Gaudi::Property< long long > LongLongProperty
Definition: Property.h:717
Gaudi::Details::Property::ReadHandler
Definition: Property.h:270
PropertyWithHandlers::readCallBack
const std::function< void(PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:806
std::function
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
LongPropertyRef
Gaudi::Property< long & > LongPropertyRef
Definition: Property.h:734
Gaudi::Details::Property::UpdateHandler::m_updateCallBack
std::function< void(PropertyBase &)> m_updateCallBack
Definition: Property.h:282
Gaudi::Details::PropertyBase::declareUpdateHandler
virtual PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for update
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:336
DoubleArrayPropertyRef
Gaudi::Property< std::vector< double > & > DoubleArrayPropertyRef
Definition: Property.h:777
Gaudi::Details::PropertyBase::assign
virtual bool assign(const PropertyBase &source)=0
import the property value form the source
std::function::swap
T swap(T...args)
Gaudi::Details::Property::SwapCall::tmp
callback_t tmp
Definition: Property.h:250
Parsers.h
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
GaudiHandleProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:841
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:40
Gaudi::Property::operator=
Property & operator=(T &&v)
Assignment from value.
Definition: Property.h:463
FloatProperty
Gaudi::Property< float > FloatProperty
Definition: Property.h:719
IntegerProperty
Gaudi::Property< int > IntegerProperty
Definition: Property.h:713
UnsignedLongLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long long > & > UnsignedLongLongArrayPropertyRef
Definition: Property.h:775
Gaudi::Details::PropertyBase::setOwnerType
void setOwnerType()
set the type of the owner class (used for documentation)
Definition: Property.h:103
Gaudi::Details::Property::BoundedVerifier::clearUpper
void clearUpper()
Clear upper bound value.
Definition: Property.h:219
Gaudi::Details::Property::BoundedVerifier::upper
const TYPE & upper() const
Return the upper bound value.
Definition: Property.h:198
GaudiHandleArrayProperty::clone
GaudiHandleArrayProperty * clone() const override
clones the current property
Definition: Property.h:879
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:346
UnsignedLongLongProperty
Gaudi::Property< unsigned long long > UnsignedLongLongProperty
Definition: Property.h:718
std::is_same
FloatPropertyRef
Gaudi::Property< float & > FloatPropertyRef
Definition: Property.h:738
Gaudi::Property< vector< std::string > >::StorageType
vector< std::string > StorageType
Hosted type.
Definition: Property.h:324
property
Gaudi::Details::PropertyBase * property(const std::string &name) const
Gaudi::Details::PropertyBase::ownerTypeName
std::string ownerTypeName() const
get the string for the type of the owner class (used for documentation)
Definition: Property.h:112
std
STL namespace.
GaudiHandleProperty
Definition: Property.h:828
Gaudi::Property::toString
std::string toString() const override
value -> string
Definition: Property.h:656
StringArrayProperty
Gaudi::Property< std::vector< std::string > > StringArrayProperty
Definition: Property.h:761
UnsignedShortArrayPropertyRef
Gaudi::Property< std::vector< unsigned short > & > UnsignedShortArrayPropertyRef
Definition: Property.h:769
Gaudi::Parsers::parse
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
Definition: DODBasicMapper.cpp:13
UnsignedCharArrayProperty
Gaudi::Property< std::vector< unsigned char > > UnsignedCharArrayProperty
Definition: Property.h:748
Gaudi::Details::Property::BoundedVerifier::setLower
void setLower(const TYPE &value)
Set lower bound value.
Definition: Property.h:201
Gaudi::Property::m_handlers
HandlersType m_handlers
Definition: Property.h:333
UnsignedShortProperty
Gaudi::Property< unsigned short > UnsignedShortProperty
Definition: Property.h:712
Gaudi::Property::updateCallBack
const std::function< void(Details::PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:409
Gaudi::Details::Property::NoHandler
Definition: Property.h:256
std::string::end
T end(T...args)
UnsignedLongProperty
Gaudi::Property< unsigned long > UnsignedLongProperty
Definition: Property.h:716
StringPropertyRef
Gaudi::Property< std::string & > StringPropertyRef
Definition: Property.h:742
Gaudi::Property::m_value
StorageType m_value
Storage.
Definition: Property.h:331
CharPropertyRef
Gaudi::Property< char & > CharPropertyRef
Definition: Property.h:727
BooleanArrayPropertyRef
Gaudi::Property< std::vector< bool > & > BooleanArrayPropertyRef
Definition: Property.h:764
LongDoubleArrayProperty
Gaudi::Property< std::vector< long double > > LongDoubleArrayProperty
Definition: Property.h:759
LongLongArrayProperty
Gaudi::Property< std::vector< long long > > LongLongArrayProperty
Definition: Property.h:755
DoubleArrayProperty
Gaudi::Property< std::vector< double > > DoubleArrayProperty
Definition: Property.h:758
Gaudi::Property::operator<
bool operator<(const T &other) const
"less" comparison
Definition: Property.h:449
Gaudi::Details::PropertyBase::setOwnerType
void setOwnerType(const std::type_info &ownerType)
set the type of the owner class (used for documentation)
Definition: Property.h:99
Gaudi::Details::PropertyBase::toString
virtual std::string toString() const =0
value -> string
ShortArrayProperty
Gaudi::Property< std::vector< short > > ShortArrayProperty
Definition: Property.h:749
Property
Gaudi::Details::PropertyBase Property
backward compatibility hack for old Property base class
Definition: PropertyFwd.h:28
UnsignedLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long > & > UnsignedLongArrayPropertyRef
Definition: Property.h:773
UnsignedIntegerArrayProperty
Gaudi::Property< std::vector< unsigned int > > UnsignedIntegerArrayProperty
Definition: Property.h:752
Gaudi::Details::PropertyBase::PropertyBase
PropertyBase(const std::type_info &type, std::string name="", std::string doc="")
constructor from the property name and the type
Definition: Property.h:119
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:397
Gaudi::Property::Property
Property()
Construct an anonymous property with default constructed value.
Definition: Property.h:383
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:58
PropertyWithHandlers
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:785
std::type_info
operator=
PropertyMgr & operator=(const PropertyMgr &)=delete
Gaudi::Details::PropertyBase::PropertyBase
PropertyBase()=delete
std::string
STL class.
compareRootHistos.ref
string ref
Definition: compareRootHistos.py:14
PropertyFwd.h
Gaudi::Property::operator+=
Property & operator+=(const T &other)
Definition: Property.h:584
LongArrayProperty
Gaudi::Property< std::vector< long > > LongArrayProperty
Definition: Property.h:753
Gaudi::Property< vector< std::string > >::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: Property.h:325
LongArrayPropertyRef
Gaudi::Property< std::vector< long > & > LongArrayPropertyRef
Definition: Property.h:772
Gaudi::Details::Property::SwapCall::operator()
void operator()(PropertyBase &p) const
Definition: Property.h:253
Gaudi::Details::Property::BoundedVerifier::operator()
void operator()(const TYPE &value) const
Definition: Property.h:183
SignedCharProperty
Gaudi::Property< signed char > SignedCharProperty
Definition: Property.h:709
GaudiMath::Interpolation::toStream
std::ostream & toStream(const Type &, std::ostream &)
Definition: Interpolation.cpp:47
CharProperty
Gaudi::Property< char > CharProperty
Definition: Property.h:708
IOTest.N
int N
Definition: IOTest.py:101
Gaudi::Property::operator-=
Property & operator-=(const T &other)
Definition: Property.h:590
Gaudi::Property::verifier
const VerifierType & verifier() const
Accessor to verifier.
Definition: Property.h:472
IntegerPropertyRef
Gaudi::Property< int & > IntegerPropertyRef
Definition: Property.h:732
GaudiHandleProperty::m_pValue
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition: Property.h:862
UnsignedLongPropertyRef
Gaudi::Property< unsigned long & > UnsignedLongPropertyRef
Definition: Property.h:735
Gaudi::Details::PropertyBase::ownerType
const std::type_info * ownerType() const
get the type of the owner class (used for documentation)
Definition: Property.h:109
Gaudi::Details::PropertyBase::m_name
boost::string_ref m_name
property name
Definition: Property.h:137
Gaudi::Property::operator++
Property & operator++()
Definition: Property.h:562
std::exception::what
T what(T...args)
Gaudi::Details::PropertyBase::PropertyBase
PropertyBase(std::string name, const std::type_info &type)
constructor from the property name and the type
Definition: Property.h:124
hasProperty
bool hasProperty(const std::string &name) const override
Return true if we have a property with the given name.
Gaudi::Details::Property::BoundedVerifier::setBounds
void setBounds(const TYPE &lower, const TYPE &upper)
Set both bounds (lower and upper) at the same time.
Definition: Property.h:226
LongDoubleArrayPropertyRef
Gaudi::Property< std::vector< long double > & > LongDoubleArrayPropertyRef
Definition: Property.h:778
gaudirun.dest
dest
Definition: gaudirun.py:170
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::Property::Property
Property(std::string name, T &&value, std::string doc="")
the constructor with property name, value and documentation.
Definition: Property.h:345
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
gaudirun.type
type
Definition: gaudirun.py:133
Gaudi::Details::PropertyBase::m_typeinfo
const std::type_info * m_typeinfo
property type
Definition: Property.h:141
UnsignedIntegerProperty
Gaudi::Property< unsigned int > UnsignedIntegerProperty
Definition: Property.h:714
SmartIF.h
Gaudi::Details::Property::StringConverter::fromString
TYPE fromString(const std::string &s)
Definition: Property.h:160
Gaudi::Details::Property::BoundedVerifier::lower
const TYPE & lower() const
Return the lower bound value.
Definition: Property.h:196
std::string::erase
T erase(T...args)
CharArrayProperty
Gaudi::Property< std::vector< char > > CharArrayProperty
Definition: Property.h:746
Gaudi::Details::PropertyBase::declareReadHandler
virtual PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for reading
GaudiHandleProperty::value
const GaudiHandleBase & value() const
Definition: Property.h:851
BooleanProperty
Gaudi::Property< bool > BooleanProperty
Definition: Property.h:707
PropertyWithHandlers::declareUpdateHandler
PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:799
UnsignedLongLongArrayProperty
Gaudi::Property< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
Definition: Property.h:756
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:54
Gaudi::Property::verifier
VerifierType & verifier()
Accessor to verifier.
Definition: Property.h:474
PropertyWithHandlers::declareReadHandler
PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:793
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:891
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
Gaudi::Details::PropertyBase::fillStream
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Definition: Property.cpp:52
Gaudi::Details::PropertyBase::declareUpdateHandler
PropertyBase & declareUpdateHandler(void(HT::*MF)(PropertyBase &), HT *instance)
Definition: Property.h:81
std::string::clear
T clear(T...args)
Gaudi::Details::Property::BoundedVerifier::hasLower
bool hasLower() const
Return if it has a lower bound.
Definition: Property.h:192
DoubleProperty
Gaudi::Property< double > DoubleProperty
Definition: Property.h:720
Converter
Converter base class.
Definition: Converter.h:24
std::exception
STL class.
Gaudi::Details::PropertyBase::setName
void setName(std::string value)
set the new value for the property name
Definition: Property.h:90
IntegerArrayPropertyRef
Gaudi::Property< std::vector< int > & > IntegerArrayPropertyRef
Definition: Property.h:770
std::move
T move(T...args)
GaudiHandleArrayProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:883
Gaudi::Property::operator--
Property & operator--()
Definition: Property.h:573
Gaudi::Details::Property::NullVerifier::operator()
void operator()(const TYPE &) const
Definition: Property.h:177
LongLongArrayPropertyRef
Gaudi::Property< std::vector< long long > & > LongLongArrayPropertyRef
Definition: Property.h:774
Gaudi::Property< vector< std::string > >::not_copying
std::enable_if_t<!is_this_type< T >::value > not_copying
Definition: Property.h:339
DoublePropertyRef
Gaudi::Property< double & > DoublePropertyRef
Definition: Property.h:739
Gaudi::Details::Property::NoHandler::getUpdateHandler
std::function< void(PropertyBase &)> getUpdateHandler() const
Definition: Property.h:268
Gaudi::Property::operator==
bool operator==(const T &other) const
equality comparison
Definition: Property.h:435
UnsignedCharArrayPropertyRef
Gaudi::Property< std::vector< unsigned char > & > UnsignedCharArrayPropertyRef
Definition: Property.h:767
Gaudi::Details::Property::ReadHandler::useReadHandler
void useReadHandler(const PropertyBase &p) const
Definition: Property.h:272
Gaudi::Details::Property::StringConverter
Definition: Property.h:154
Gaudi::Details::Property::BoundedVerifier::hasUpper
bool hasUpper() const
Return if it has a lower bound.
Definition: Property.h:194
std::string::find
T find(T...args)
Gaudi::Property::load
bool load(Details::PropertyBase &dest) const override
set value to another property
Definition: Property.h:643
std::string::size
T size(T...args)
GaudiHandleArrayBase
Base class of array&#39;s of various gaudihandles.
Definition: GaudiHandle.h:351
Gaudi::Details::Property::UpdateHandler::getUpdateHandler
std::function< void(PropertyBase &)> getUpdateHandler() const
Definition: Property.h:294
LongDoublePropertyRef
Gaudi::Property< long double & > LongDoublePropertyRef
Definition: Property.h:740
IProperty.h
Gaudi::Property::value
ValueType & value()
Definition: Property.h:479
std::vector
STL class.
PropertyWithHandlers::useReadHandler
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:811
SignedCharArrayProperty
Gaudi::Property< std::vector< signed char > > SignedCharArrayProperty
Definition: Property.h:747
PropertyWithHandlers::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:814
StringProperty
Gaudi::Property< std::string > StringProperty
Definition: Property.h:723
std::string::begin
T begin(T...args)
std::logic_error
STL class.
Gaudi::Details::Property::UpdateHandler::setUpdateHandler
void setUpdateHandler(std::function< void(PropertyBase &)> fun)
Definition: Property.h:293
LongDoubleProperty
Gaudi::Property< long double > LongDoubleProperty
Definition: Property.h:721
GaudiHandleArrayProperty::operator=
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
Definition: Property.h:873
Gaudi::Details::Property::SwapCall::SwapCall
SwapCall(callback_t &input)
Definition: Property.h:251
GaudiHandleArrayProperty::m_pValue
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Definition: Property.h:902
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
ShortProperty
Gaudi::Property< short > ShortProperty
Definition: Property.h:711
Gaudi::Details::PropertyBase::type
std::string type() const
property type
Definition: Property.h:46
Gaudi::Details::PropertyBase::documentation
std::string documentation() const
property documentation
Definition: Property.h:42
UnsignedLongArrayProperty
Gaudi::Property< std::vector< unsigned long > > UnsignedLongArrayProperty
Definition: Property.h:754
Gaudi::Property::clone
Details::PropertyBase * clone() const override
clones the current property
Definition: Property.h:490
SimplePropertyRef
Gaudi::Property< TYPE & > SimplePropertyRef
Definition: Property.h:704
gaudirun.s
string s
Definition: gaudirun.py:253
GaudiPython.Bindings.GaudiHandleProperty
GaudiHandleProperty
Definition: Bindings.py:53
UnsignedLongLongPropertyRef
Gaudi::Property< unsigned long long & > UnsignedLongLongPropertyRef
Definition: Property.h:737
Gaudi::Details::Property::BoundedVerifier::clearBounds
void clearBounds()
Clear both bounds (lower and upper) at the same time.
Definition: Property.h:233
Gaudi::Details::Property::ReadHandler::setReadHandler
void setReadHandler(std::function< void(PropertyBase &)> fun)
Definition: Property.h:278
Gaudi::Utils::getProperty
GAUDI_API const Gaudi::Details::PropertyBase * getProperty(const std::vector< const Gaudi::Details::PropertyBase * > *p, const std::string &name)
get the property by name from the list of the properties
Definition: Property.cpp:320
Gaudi::Utils::setProperty
StatusCode setProperty(IInterface *component, const std::string &name, const Gaudi::Property< TYPE > &value, const std::string &doc="")
simple function to set the property of the given object from another property
Definition: Property.h:1412
PropertyWithHandlers::m_handlers
Handler m_handlers
Definition: Property.h:787
Gaudi::Details::Property::ReadHandler::getReadHandler
std::function< void(PropertyBase &)> getReadHandler() const
Definition: Property.h:279
StringArrayPropertyRef
Gaudi::Property< std::vector< std::string > & > StringArrayPropertyRef
Definition: Property.h:780
Gaudi::Property::assign
bool assign(const Details::PropertyBase &source) override
get the value from another property
Definition: Property.h:630
GaudiHandleProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:843
Gaudi::Property::operator!=
bool operator!=(const T &other) const
inequality comparison
Definition: Property.h:442
LongProperty
Gaudi::Property< long > LongProperty
Definition: Property.h:715
Gaudi::Details::Property::NoHandler::setUpdateHandler
void setUpdateHandler(std::function< void(PropertyBase &)>)
Definition: Property.h:264
CharArrayPropertyRef
Gaudi::Property< std::vector< char > & > CharArrayPropertyRef
Definition: Property.h:765
Gaudi::Property::value
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:478
std::remove_reference
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::Details::Property::BoundedVerifier::clearLower
void clearLower()
Clear lower bound value.
Definition: Property.h:213
GaudiHandleBase
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
Definition: GaudiHandle.h:93
Gaudi::Details::Property::UpdateHandler
Definition: Property.h:281
ToStream.h
implementation of various functions for streaming.
Gaudi::Property::Property
Property(T &&v)
Construct an anonymous property from a value.
Definition: Property.h:376
UnsignedShortPropertyRef
Gaudi::Property< unsigned short & > UnsignedShortPropertyRef
Definition: Property.h:731
FloatArrayProperty
Gaudi::Property< std::vector< float > > FloatArrayProperty
Definition: Property.h:757
Gaudi::Property::operator++
ValueType operator++(int)
Definition: Property.h:568
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
Gaudi::Details::Property::SwapCall
helper to disable a while triggering it, to avoid infinite recursion
Definition: Property.h:248
Gaudi::Details::PropertyBase::m_documentation
boost::string_ref m_documentation
property doc string
Definition: Property.h:139
GaudiHandleArrayProperty::load
bool load(PropertyBase &destination) const override
Definition: Property.h:881
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
GaudiHandleProperty::operator=
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
Definition: Property.h:833
ShortArrayPropertyRef
Gaudi::Property< std::vector< short > & > ShortArrayPropertyRef
Definition: Property.h:768
GaudiHandleArrayProperty
Definition: Property.h:868
std::ostream
STL class.
Gaudi::Property::Property
Property(OWNER *owner, std::string name, T &&value, std::string doc="")
Autodeclaring constructor with property name, value and documentation.
Definition: Property.h:365
PropertyWithHandlers::updateCallBack
const std::function< void(PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:808
Gaudi::Details::Property::NullVerifier
Definition: Property.h:175
Gaudi::Property::declareReadHandler
Details::PropertyBase & declareReadHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:391
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
UnsignedCharProperty
Gaudi::Property< unsigned char > UnsignedCharProperty
Definition: Property.h:710
Gaudi::Property::m_verifier
VerifierType m_verifier
Definition: Property.h:332
Gaudi::Property::readCallBack
const std::function< void(Details::PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:404
ShortPropertyRef
Gaudi::Property< short & > ShortPropertyRef
Definition: Property.h:730
GaudiMath::Interpolation::toString
std::string toString(const Type &)
Definition: Interpolation.cpp:42
Gaudi::Details::Property::BoundedVerifier::setUpper
void setUpper(const TYPE &value)
Set upper bound value.
Definition: Property.h:207
Gaudi::Details::Property::NoHandler::setReadHandler
void setReadHandler(std::function< void(PropertyBase &)>)
Definition: Property.h:258
Gaudi::Property< vector< std::string > >::HandlersType
Details::Property::UpdateHandler HandlersType
Definition: Property.h:327
UnsignedCharPropertyRef
Gaudi::Property< unsigned char & > UnsignedCharPropertyRef
Definition: Property.h:729
Gaudi::Property::operator--
ValueType operator--(int)
Definition: Property.h:579
std::invalid_argument
STL class.
Gaudi::operator+
decltype(std::declval< TP >()+std::declval< T >()) operator+(const T &v, const Property< TP, V, H > &p)
implemantation of (value + property)
Definition: Property.h:686
Gaudi::Details::Property::NoHandler::useReadHandler
void useReadHandler(const PropertyBase &) const
Definition: Property.h:257
BooleanArrayProperty
Gaudi::Property< std::vector< bool > > BooleanArrayProperty
Definition: Property.h:745
Gaudi::Details::PropertyBase::type_info
const std::type_info * type_info() const
property type-info
Definition: Property.h:44
UnsignedIntegerArrayPropertyRef
Gaudi::Property< std::vector< unsigned int > & > UnsignedIntegerArrayPropertyRef
Definition: Property.h:771
Gaudi::Property::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: Property.h:649
Gaudi::Property::toStream
void toStream(std::ostream &out) const override
value -> stream
Definition: Property.h:662
BooleanPropertyRef
Gaudi::Property< bool & > BooleanPropertyRef
Definition: Property.h:726
Gaudi::Details::Property::UpdateHandler::useUpdateHandler
void useUpdateHandler(PropertyBase &p)
Definition: Property.h:283
Gaudi::Details::Property::ReadUpdateHandler
Definition: Property.h:296