| The Gaudi Framework v29r0 (ff2e7097)

- 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, typename std::remove_reference<T>::type>;
338 template <class T>
339 using not_copying = std::enable_if<!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 <class OWNER, class T = ValueType,
354 typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type,
355 typename = typename std::enable_if<std::is_default_constructible<T>::value>::type>
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,
365 typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type>
366 inline Property( OWNER* owner, std::string name, T&& value, std::string doc = "" )
367 : Property( std::move( name ), std::forward<T>( value ), std::move( doc ) )
368 {
369 owner->declareProperty( *this );
370 setOwnerType<OWNER>();
371 }
372
376 template <class T, typename = typename not_copying<T>::type>
377 Property( T&& v ) : Details::PropertyBase( typeid( ValueType ), "", "" ), m_value( std::forward<T>( v ) )
378 {
379 }
380
383 template <typename T = StorageType, typename = typename std::enable_if<!std::is_reference<T>::value>::type>
384 Property() : Details::PropertyBase( typeid( ValueType ), "", "" ), m_value()
385 {
386 }
387
388 using Details::PropertyBase::declareReadHandler;
389 using Details::PropertyBase::declareUpdateHandler;
390
392 Details::PropertyBase& declareReadHandler( std::function<void( Details::PropertyBase& )> fun ) override
393 {
394 m_handlers.setReadHandler( std::move( fun ) );
395 return *this;
396 }
398 Details::PropertyBase& declareUpdateHandler( std::function<void( Details::PropertyBase& )> fun ) override
399 {
400 m_handlers.setUpdateHandler( std::move( fun ) );
401 return *this;
402 }
403
405 const std::function<void( Details::PropertyBase& )> readCallBack() const override
406 {
407 return m_handlers.getReadHandler();
408 }
410 const std::function<void( Details::PropertyBase& )> updateCallBack() const override
411 {
412 return m_handlers.getUpdateHandler();
413 }
414
416 bool useUpdateHandler() override
417 {
418 m_handlers.useUpdateHandler( *this );
419 return true;
420 }
421
423 operator const ValueType&() const
424 {
425 m_handlers.useReadHandler( *this );
426 return m_value;
427 }
428 // /// Automatic conversion to value (reference).
429 // operator ValueType& () {
430 // useReadHandler();
431 // return m_value;
432 // }
433
435 template <class T>
436 inline bool operator==( const T& other ) const
437 {
438 return m_value == other;
439 }
440
442 template <class T>
443 inline bool operator!=( const T& other ) const
444 {
445 return m_value != other;
446 }
447
449 template <class T>
450 inline bool operator<( const T& other ) const
451 {
452 return m_value < other;
453 }
454
456 template <class T>
457 decltype( std::declval<ValueType>() + std::declval<T>() ) operator+( const T& other ) const
458 {
459 return m_value + other;
460 }
461
463 template <class T = ValueType>
464 Property& operator=( T&& v )
465 {
466 m_verifier( v );
467 m_value = std::forward<T>( v );
468 m_handlers.useUpdateHandler( *this );
469 return *this;
470 }
471
473 const VerifierType& verifier() const { return m_verifier; }
475 VerifierType& verifier() { return m_verifier; }
476
479 const ValueType& value() const { return *this; }
480 ValueType& value() { return const_cast<ValueType&>( (const ValueType&)*this ); }
481 bool setValue( const ValueType& v )
482 {
483 *this = v;
484 return true;
485 }
486 bool set( const ValueType& v )
487 {
488 *this = v;
489 return true;
490 }
491 Details::PropertyBase* clone() const override { return new Property( *this ); }
493
497 template <class T = const ValueType>
498 inline decltype( std::declval<T>().size() ) size() const
499 {
500 return value().size();
501 }
502 template <class T = const ValueType>
503 inline decltype( std::declval<T>().length() ) length() const
504 {
505 return value().length();
506 }
507 template <class T = const ValueType>
508 inline decltype( std::declval<T>().empty() ) empty() const
509 {
510 return value().empty();
511 }
512 template <class T = ValueType>
513 inline decltype( std::declval<T>().clear() ) clear()
514 {
515 value().clear();
516 }
517 template <class T = const ValueType>
518 inline decltype( std::declval<T>().begin() ) begin() const
519 {
520 return value().begin();
521 }
522 template <class T = const ValueType>
523 inline decltype( std::declval<T>().end() ) end() const
524 {
525 return value().end();
526 }
527 template <class T = ValueType>
528 inline decltype( std::declval<T>().begin() ) begin()
529 {
530 return value().begin();
531 }
532 template <class T = ValueType>
533 inline decltype( std::declval<T>().end() ) end()
534 {
535 return value().end();
536 }
537 template <class ARG, class T = const ValueType>
538 inline decltype( std::declval<T>()[ARG{}] ) operator[]( const ARG& arg ) const
539 {
540 return value()[arg];
541 }
542 template <class ARG, class T = ValueType>
543 inline decltype( std::declval<T>()[ARG{}] ) operator[]( const ARG& arg )
544 {
545 return value()[arg];
546 }
547 template <class T = const ValueType>
548 inline decltype( std::declval<T>().find( typename T::key_type{} ) ) find( const typename T::key_type& key ) const
549 {
550 return value().find( key );
551 }
552 template <class T = ValueType>
553 inline decltype( std::declval<T>().find( typename T::key_type{} ) ) find( const typename T::key_type& key )
554 {
555 return value().find( key );
556 }
557 template <class ARG, class T = ValueType>
558 inline decltype( std::declval<T>().erase( ARG{} ) ) erase( ARG arg )
559 {
560 return value().erase( arg );
561 }
562 template <class = ValueType>
563 inline Property& operator++()
564 {
565 ++value();
566 return *this;
567 }
568 template <class = ValueType>
569 inline ValueType operator++( int )
570 {
571 return m_value++;
572 }
573 template <class = ValueType>
574 inline Property& operator--()
575 {
576 --value();
577 return *this;
578 }
579 template <class = ValueType>
580 inline ValueType operator--( int )
581 {
582 return m_value--;
583 }
584 template <class T = ValueType>
585 inline Property& operator+=( const T& other )
586 {
587 m_value += other;
588 return *this;
589 }
590 template <class T = ValueType>
591 inline Property& operator-=( const T& other )
592 {
593 m_value -= other;
594 return *this;
595 }
597 template <class T = const ValueType>
598 inline decltype( std::declval<T>().key() ) key() const
599 {
600 return value().key();
601 }
602 template <class T = const ValueType>
603 inline decltype( std::declval<T>().objKey() ) objKey() const
604 {
605 return value().objKey();
606 }
607 template <class T = const ValueType>
608 inline decltype( std::declval<T>().fullKey() ) fullKey() const
609 {
610 return value().fullKey();
611 }
612 template <class T = ValueType>
613 inline decltype( std::declval<T>().initialize() ) initialize()
614 {
615 return value().initialize();
616 }
617 template <class T = ValueType>
618 inline decltype( std::declval<T>().makeHandles() ) makeHandles() const
619 {
620 return value().makeHandles();
621 }
622 template <class ARG, class T = ValueType>
623 inline decltype( std::declval<T>().makeHandles( std::declval<ARG>() ) ) makeHandles( const ARG& arg ) const
624 {
625 return value().makeHandles( arg );
626 }
628 // ==========================================================================
629 public:
631 bool assign( const Details::PropertyBase& source ) override
632 {
633 // Check if the property of is of "the same" type, except for strings
634 const Property* p =
635 ( std::is_same<ValueType, std::string>::value ) ? nullptr : dynamic_cast<const Property*>( &source );
636 if ( p ) {
637 *this = p->value();
638 } else {
639 this->fromString( source.toString() ).ignore();
640 }
641 return true;
642 }
644 bool load( Details::PropertyBase& dest ) const override
645 {
646 // delegate to the 'opposite' method
647 return dest.assign( *this );
648 }
650 StatusCode fromString( const std::string& source ) override
651 {
652 using Converter = Details::Property::StringConverter<ValueType>;
653 *this = Converter().fromString( source );
654 return StatusCode::SUCCESS;
655 }
657 std::string toString() const override
658 {
659 using Converter = Details::Property::StringConverter<ValueType>;
660 return Converter().toString( *this );
661 }
663 void toStream( std::ostream& out ) const override
664 {
665 m_handlers.useReadHandler( *this );
666 using Utils::toStream;
667 toStream( m_value, out );
668 }
669 };
670
672 template <class T, class TP, class V, class H>
673 bool operator==( const T& v, const Property<TP, V, H>& p )
674 {
675 return p == v;
676 }
677
679 template <class T, class TP, class V, class H>
680 bool operator!=( const T& v, const Property<TP, V, H>& p )
681 {
682 return p != v;
683 }
684
686 template <class T, class TP, class V, class H>
687 decltype( std::declval<TP>() + std::declval<T>() ) operator+( const T& v, const Property<TP, V, H>& p )
688 {
689 return v + p.value();
690 }
691
692 template <class TYPE, class HANDLERS = Details::Property::UpdateHandler>
693 using CheckedProperty = Property<TYPE, Details::Property::BoundedVerifier<TYPE>, HANDLERS>;
694
695 template <class TYPE>
696 using PropertyWithReadHandler =
697 Property<TYPE, Details::Property::NullVerifier, Gaudi::Details::Property::ReadUpdateHandler>;
698
699 } // namespace Gaudi
700
701 template <class TYPE>
702 using SimpleProperty = Gaudi::Property<TYPE>;
703
704 template <class TYPE>
705 using SimplePropertyRef = Gaudi::Property<TYPE&>;
706
707 // Typedef Properties for built-in types
708 typedef Gaudi::Property<bool> BooleanProperty;
709 typedef Gaudi::Property<char> CharProperty;
710 typedef Gaudi::Property<signed char> SignedCharProperty;
711 typedef Gaudi::Property<unsigned char> UnsignedCharProperty;
712 typedef Gaudi::Property<short> ShortProperty;
713 typedef Gaudi::Property<unsigned short> UnsignedShortProperty;
714 typedef Gaudi::Property<int> IntegerProperty;
715 typedef Gaudi::Property<unsigned int> UnsignedIntegerProperty;
716 typedef Gaudi::Property<long> LongProperty;
717 typedef Gaudi::Property<unsigned long> UnsignedLongProperty;
718 typedef Gaudi::Property<long long> LongLongProperty;
719 typedef Gaudi::Property<unsigned long long> UnsignedLongLongProperty;
720 typedef Gaudi::Property<float> FloatProperty;
721 typedef Gaudi::Property<double> DoubleProperty;
722 typedef Gaudi::Property<long double> LongDoubleProperty;
723
724 typedef Gaudi::Property<std::string> StringProperty;
725
726 // Typedef PropertyRefs for built-in types
727 typedef Gaudi::Property<bool&> BooleanPropertyRef;
728 typedef Gaudi::Property<char&> CharPropertyRef;
729 typedef Gaudi::Property<signed char&> SignedCharPropertyRef;
730 typedef Gaudi::Property<unsigned char&> UnsignedCharPropertyRef;
731 typedef Gaudi::Property<short&> ShortPropertyRef;
732 typedef Gaudi::Property<unsigned short&> UnsignedShortPropertyRef;
733 typedef Gaudi::Property<int&> IntegerPropertyRef;
734 typedef Gaudi::Property<unsigned int&> UnsignedIntegerPropertyRef;
735 typedef Gaudi::Property<long&> LongPropertyRef;
736 typedef Gaudi::Property<unsigned long&> UnsignedLongPropertyRef;
737 typedef Gaudi::Property<long long&> LongLongPropertyRef;
738 typedef Gaudi::Property<unsigned long long&> UnsignedLongLongPropertyRef;
739 typedef Gaudi::Property<float&> FloatPropertyRef;
740 typedef Gaudi::Property<double&> DoublePropertyRef;
741 typedef Gaudi::Property<long double&> LongDoublePropertyRef;
742
743 typedef Gaudi::Property<std::string&> StringPropertyRef;
744
745 // Typedef "Arrays" of Properties for built-in types
746 typedef Gaudi::Property<std::vector<bool>> BooleanArrayProperty;
747 typedef Gaudi::Property<std::vector<char>> CharArrayProperty;
748 typedef Gaudi::Property<std::vector<signed char>> SignedCharArrayProperty;
749 typedef Gaudi::Property<std::vector<unsigned char>> UnsignedCharArrayProperty;
750 typedef Gaudi::Property<std::vector<short>> ShortArrayProperty;
751 typedef Gaudi::Property<std::vector<unsigned short>> UnsignedShortArrayProperty;
752 typedef Gaudi::Property<std::vector<int>> IntegerArrayProperty;
753 typedef Gaudi::Property<std::vector<unsigned int>> UnsignedIntegerArrayProperty;
754 typedef Gaudi::Property<std::vector<long>> LongArrayProperty;
755 typedef Gaudi::Property<std::vector<unsigned long>> UnsignedLongArrayProperty;
756 typedef Gaudi::Property<std::vector<long long>> LongLongArrayProperty;
757 typedef Gaudi::Property<std::vector<unsigned long long>> UnsignedLongLongArrayProperty;
758 typedef Gaudi::Property<std::vector<float>> FloatArrayProperty;
759 typedef Gaudi::Property<std::vector<double>> DoubleArrayProperty;
760 typedef Gaudi::Property<std::vector<long double>> LongDoubleArrayProperty;
761
762 typedef Gaudi::Property<std::vector<std::string>> StringArrayProperty;
763
764 // Typedef "Arrays" of PropertyRefs for built-in types
765 typedef Gaudi::Property<std::vector<bool>&> BooleanArrayPropertyRef;
766 typedef Gaudi::Property<std::vector<char>&> CharArrayPropertyRef;
767 typedef Gaudi::Property<std::vector<signed char>&> SignedCharArrayPropertyRef;
768 typedef Gaudi::Property<std::vector<unsigned char>&> UnsignedCharArrayPropertyRef;
769 typedef Gaudi::Property<std::vector<short>&> ShortArrayPropertyRef;
770 typedef Gaudi::Property<std::vector<unsigned short>&> UnsignedShortArrayPropertyRef;
771 typedef Gaudi::Property<std::vector<int>&> IntegerArrayPropertyRef;
772 typedef Gaudi::Property<std::vector<unsigned int>&> UnsignedIntegerArrayPropertyRef;
773 typedef Gaudi::Property<std::vector<long>&> LongArrayPropertyRef;
774 typedef Gaudi::Property<std::vector<unsigned long>&> UnsignedLongArrayPropertyRef;
775 typedef Gaudi::Property<std::vector<long long>&> LongLongArrayPropertyRef;
776 typedef Gaudi::Property<std::vector<unsigned long long>&> UnsignedLongLongArrayPropertyRef;
777 typedef Gaudi::Property<std::vector<float>&> FloatArrayPropertyRef;
778 typedef Gaudi::Property<std::vector<double>&> DoubleArrayPropertyRef;
779 typedef Gaudi::Property<std::vector<long double>&> LongDoubleArrayPropertyRef;
780
781 typedef Gaudi::Property<std::vector<std::string>&> StringArrayPropertyRef;
782
785 template <typename Handler = typename Gaudi::Details::Property::UpdateHandler>
786 class PropertyWithHandlers : public Gaudi::Details::PropertyBase
787 {
788 Handler m_handlers;
789
790 public:
791 using PropertyBase::PropertyBase;
792
794 PropertyBase& declareReadHandler( std::function<void( PropertyBase& )> fun ) override
795 {
796 m_handlers.setReadHandler( std::move( fun ) );
797 return *this;
798 }
800 PropertyBase& declareUpdateHandler( std::function<void( PropertyBase& )> fun ) override
801 {
802 m_handlers.setUpdateHandler( std::move( fun ) );
803 return *this;
804 }
805
807 const std::function<void( PropertyBase& )> readCallBack() const override { return m_handlers.getReadHandler(); }
809 const std::function<void( PropertyBase& )> updateCallBack() const override { return m_handlers.getUpdateHandler(); }
810
812 void useReadHandler() const { m_handlers.useReadHandler( *this ); }
813
815 bool useUpdateHandler() override
816 {
817 m_handlers.useUpdateHandler( *this );
818 return true;
819 }
820 };
821
822 // forward-declaration is sufficient here
823 class GaudiHandleBase;
824
825 // implementation in header file only where the GaudiHandleBase class
826 // definition is not needed. The rest goes into the .cpp file.
827 // The goal is to decouple the header files, to avoid that the whole
828 // world depends on GaudiHandle.h
829 class GAUDI_API GaudiHandleProperty : public PropertyWithHandlers<>
830 {
831 public:
832 GaudiHandleProperty( std::string name, GaudiHandleBase& ref );
833
834 GaudiHandleProperty& operator=( const GaudiHandleBase& value )
835 {
836 setValue( value );
837 return *this;
838 }
839
840 GaudiHandleProperty* clone() const override { return new GaudiHandleProperty( *this ); }
841
842 bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
843
844 bool assign( const PropertyBase& source ) override { return fromString( source.toString() ); }
845
846 std::string toString() const override;
847
848 void toStream( std::ostream& out ) const override;
849
850 StatusCode fromString( const std::string& s ) override;
851
852 const GaudiHandleBase& value() const
853 {
854 useReadHandler();
855 return *m_pValue;
856 }
857
858 bool setValue( const GaudiHandleBase& value );
859
860 private:
863 GaudiHandleBase* m_pValue;
864 };
865
866 // forward-declaration is sufficient here
867 class GaudiHandleArrayBase;
868
869 class GAUDI_API GaudiHandleArrayProperty : public PropertyWithHandlers<>
870 {
871 public:
872 GaudiHandleArrayProperty( std::string name, GaudiHandleArrayBase& ref );
873
874 GaudiHandleArrayProperty& operator=( const GaudiHandleArrayBase& value )
875 {
876 setValue( value );
877 return *this;
878 }
879
880 GaudiHandleArrayProperty* clone() const override { return new GaudiHandleArrayProperty( *this ); }
881
882 bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
883
884 bool assign( const PropertyBase& source ) override { return fromString( source.toString() ); }
885
886 std::string toString() const override;
887
888 void toStream( std::ostream& out ) const override;
889
890 StatusCode fromString( const std::string& s ) override;
891
892 const GaudiHandleArrayBase& value() const
893 {
894 useReadHandler();
895 return *m_pValue;
896 }
897
898 bool setValue( const GaudiHandleArrayBase& value );
899
900 private:
903 GaudiHandleArrayBase* m_pValue;
904 };
905
906 namespace Gaudi
907 {
908 namespace Utils
909 {
910 // ========================================================================
928 GAUDI_API bool hasProperty( const IProperty* p, const std::string& name );
929 // ========================================================================
947 GAUDI_API bool hasProperty( const IInterface* p, const std::string& name );
948 // ========================================================================
966 GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IProperty* p, const std::string& name );
967 // ========================================================================
985 GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IInterface* p, const std::string& name );
986 // ========================================================================
1009 GAUDI_API bool hasProperty( const std::vector<const Gaudi::Details::PropertyBase*>* p, const std::string& name );
1010 // ========================================================================
1033 GAUDI_API const Gaudi::Details::PropertyBase*
1034 getProperty( const std::vector<const Gaudi::Details::PropertyBase*>* p, const std::string& name );
1035 // ========================================================================
1059 template <class TYPE>
1060 StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc );
1061 // ========================================================================
1084 template <class TYPE>
1085 StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value )
1086 {
1087 return setProperty( component, name, value, std::string() );
1088 }
1089 // ========================================================================
1103 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const std::string& value,
1104 const std::string& doc = "" );
1105 // ========================================================================
1119 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const char* value,
1120 const std::string& doc = "" );
1121 // ========================================================================
1135 template <unsigned N>
1136 StatusCode setProperty( IProperty* component, const std::string& name, const char ( &value )[N],
1137 const std::string& doc = "" )
1138 {
1139 return component ? setProperty( component, name, std::string( value, value + N ), doc ) : StatusCode::FAILURE;
1140 }
1141 // ========================================================================
1172 template <class TYPE>
1173 StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc )
1174 {
1175 using Gaudi::Utils::toString;
1176 return component && hasProperty( component, name )
1177 ? Gaudi::Utils::setProperty( component, name, toString( value ), doc )
1178 : StatusCode::FAILURE;
1179 }
1180 // ========================================================================
1202 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name,
1203 const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1204 // ========================================================================
1226 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name,
1227 const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1228 // ========================================================================
1251 template <class TYPE>
1252 StatusCode setProperty( IProperty* component, const std::string& name, const Gaudi::Property<TYPE>& value,
1253 const std::string& doc = "" )
1254 {
1255 return setProperty( component, name, &value, doc );
1256 }
1257 // ========================================================================
1278 template <class TYPE>
1279 StatusCode setProperty( IInterface* component, const std::string& name, const TYPE& value,
1280 const std::string& doc = "" )
1281 {
1282 if ( !component ) {
1283 return StatusCode::FAILURE;
1284 }
1285 auto property = SmartIF<IProperty>{component};
1286 return property ? setProperty( property, name, value, doc ) : StatusCode::FAILURE;
1287 }
1288 // ========================================================================
1301 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const std::string& value,
1302 const std::string& doc = "" );
1303 // ========================================================================
1316 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const char* value,
1317 const std::string& doc = "" );
1318 // ========================================================================
1332 template <unsigned N>
1333 StatusCode setProperty( IInterface* component, const std::string& name, const char ( &value )[N],
1334 const std::string& doc = "" )
1335 {
1336 if ( 0 == component ) {
1337 return StatusCode::FAILURE;
1338 }
1339 return setProperty( component, name, std::string{value, value + N}, doc );
1340 }
1341 // ========================================================================
1363 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name,
1364 const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1365 // ========================================================================
1387 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name,
1388 const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1389 // ========================================================================
1412 template <class TYPE>
1413 StatusCode setProperty( IInterface* component, const std::string& name, const Gaudi::Property<TYPE>& value,
1414 const std::string& doc = "" )
1415 {
1416 return setProperty( component, name, &value, doc );
1417 }
1418 // ========================================================================
1419 } // end of namespace Gaudi::Utils
1420 } // end of namespace Gaudi
1421 // ============================================================================
1422 // The END
1423 // ============================================================================
1424 #endif // GAUDIKERNEL_PROPERTY_H
1425 // ============================================================================
FloatArrayPropertyRef
Gaudi::Property< std::vector< float > & > FloatArrayPropertyRef
Definition: Property.h:777
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:1173
SignedCharPropertyRef
Gaudi::Property< signed char & > SignedCharPropertyRef
Definition: Property.h:729
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:767
Gaudi::Details::Property::SwapCall::~SwapCall
~SwapCall()
Definition: Property.h:252
std::out_of_range
STL class.
Gaudi::Property::Property
Property(OWNER *owner, std::string name)
Autodeclaring constructor with property name, value and documentation.
Definition: Property.h:356
StatusCode::SUCCESS
Definition: StatusCode.h:31
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:734
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:680
GaudiHandleProperty::clone
GaudiHandleProperty * clone() const override
clones the current property
Definition: Property.h:840
Gaudi::Property::setValue
bool setValue(const ValueType &v)
Definition: Property.h:481
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:751
Gaudi::Details::Property::BoundedVerifier
Definition: Property.h:182
SimpleProperty
Gaudi::Property< TYPE > SimpleProperty
Definition: Property.h:702
LongLongPropertyRef
Gaudi::Property< long long & > LongLongPropertyRef
Definition: Property.h:737
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:752
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:673
Gaudi::Property::useUpdateHandler
bool useUpdateHandler() override
manual trigger for callback for update
Definition: Property.h:416
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
StatusCode::FAILURE
Definition: StatusCode.h:31
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:718
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:807
std::function
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
LongPropertyRef
Gaudi::Property< long & > LongPropertyRef
Definition: Property.h:735
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:329
DoubleArrayPropertyRef
Gaudi::Property< std::vector< double > & > DoubleArrayPropertyRef
Definition: Property.h:778
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:842
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:464
FloatProperty
Gaudi::Property< float > FloatProperty
Definition: Property.h:720
IntegerProperty
Gaudi::Property< int > IntegerProperty
Definition: Property.h:714
UnsignedLongLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long long > & > UnsignedLongLongArrayPropertyRef
Definition: Property.h:776
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:880
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:719
std::is_same
FloatPropertyRef
Gaudi::Property< float & > FloatPropertyRef
Definition: Property.h:739
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:829
Gaudi::Property::toString
std::string toString() const override
value -> string
Definition: Property.h:657
StringArrayProperty
Gaudi::Property< std::vector< std::string > > StringArrayProperty
Definition: Property.h:762
UnsignedShortArrayPropertyRef
Gaudi::Property< std::vector< unsigned short > & > UnsignedShortArrayPropertyRef
Definition: Property.h:770
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:749
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:713
Gaudi::Property::updateCallBack
const std::function< void(Details::PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:410
Gaudi::Details::Property::NoHandler
Definition: Property.h:256
std::string::end
T end(T...args)
UnsignedLongProperty
Gaudi::Property< unsigned long > UnsignedLongProperty
Definition: Property.h:717
StringPropertyRef
Gaudi::Property< std::string & > StringPropertyRef
Definition: Property.h:743
Gaudi::Property::m_value
StorageType m_value
Storage.
Definition: Property.h:331
CharPropertyRef
Gaudi::Property< char & > CharPropertyRef
Definition: Property.h:728
BooleanArrayPropertyRef
Gaudi::Property< std::vector< bool > & > BooleanArrayPropertyRef
Definition: Property.h:765
LongDoubleArrayProperty
Gaudi::Property< std::vector< long double > > LongDoubleArrayProperty
Definition: Property.h:760
LongLongArrayProperty
Gaudi::Property< std::vector< long long > > LongLongArrayProperty
Definition: Property.h:756
DoubleArrayProperty
Gaudi::Property< std::vector< double > > DoubleArrayProperty
Definition: Property.h:759
Gaudi::Property::operator<
bool operator<(const T &other) const
"less" comparison
Definition: Property.h:450
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:750
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:774
UnsignedIntegerArrayProperty
Gaudi::Property< std::vector< unsigned int > > UnsignedIntegerArrayProperty
Definition: Property.h:753
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
std::enable_if
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:398
Gaudi::Property::Property
Property()
Construct an anonymous property with default constructed value.
Definition: Property.h:384
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:786
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:585
LongArrayProperty
Gaudi::Property< std::vector< long > > LongArrayProperty
Definition: Property.h:754
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:773
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:710
GaudiMath::Interpolation::toStream
std::ostream & toStream(const Type &, std::ostream &)
Definition: Interpolation.cpp:47
CharProperty
Gaudi::Property< char > CharProperty
Definition: Property.h:709
IOTest.N
int N
Definition: IOTest.py:101
Gaudi::Property::operator-=
Property & operator-=(const T &other)
Definition: Property.h:591
Gaudi::Property::verifier
const VerifierType & verifier() const
Accessor to verifier.
Definition: Property.h:473
IntegerPropertyRef
Gaudi::Property< int & > IntegerPropertyRef
Definition: Property.h:733
GaudiHandleProperty::m_pValue
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition: Property.h:863
UnsignedLongPropertyRef
Gaudi::Property< unsigned long & > UnsignedLongPropertyRef
Definition: Property.h:736
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:563
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:779
gaudirun.dest
dest
Definition: gaudirun.py:170
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
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:715
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:747
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:852
BooleanProperty
Gaudi::Property< bool > BooleanProperty
Definition: Property.h:708
PropertyWithHandlers::declareUpdateHandler
PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:800
UnsignedLongLongArrayProperty
Gaudi::Property< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
Definition: Property.h:757
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:54
Gaudi::Property::verifier
VerifierType & verifier()
Accessor to verifier.
Definition: Property.h:475
PropertyWithHandlers::declareReadHandler
PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:794
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:892
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:721
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:771
std::move
T move(T...args)
GaudiHandleArrayProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:884
Gaudi::Property::operator--
Property & operator--()
Definition: Property.h:574
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:775
DoublePropertyRef
Gaudi::Property< double & > DoublePropertyRef
Definition: Property.h:740
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:436
UnsignedCharArrayPropertyRef
Gaudi::Property< std::vector< unsigned char > & > UnsignedCharArrayPropertyRef
Definition: Property.h:768
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:644
std::string::size
T size(T...args)
GaudiHandleArrayBase
Base class of array&#39;s of various gaudihandles.
Definition: GaudiHandle.h:348
Gaudi::Details::Property::UpdateHandler::getUpdateHandler
std::function< void(PropertyBase &)> getUpdateHandler() const
Definition: Property.h:294
LongDoublePropertyRef
Gaudi::Property< long double & > LongDoublePropertyRef
Definition: Property.h:741
IProperty.h
Gaudi::Property::value
ValueType & value()
Definition: Property.h:480
std::vector
STL class.
PropertyWithHandlers::useReadHandler
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:812
SignedCharArrayProperty
Gaudi::Property< std::vector< signed char > > SignedCharArrayProperty
Definition: Property.h:748
PropertyWithHandlers::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:815
StringProperty
Gaudi::Property< std::string > StringProperty
Definition: Property.h:724
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:722
GaudiHandleArrayProperty::operator=
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
Definition: Property.h:874
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:903
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
ShortProperty
Gaudi::Property< short > ShortProperty
Definition: Property.h:712
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:755
Gaudi::Property::clone
Details::PropertyBase * clone() const override
clones the current property
Definition: Property.h:491
SimplePropertyRef
Gaudi::Property< TYPE & > SimplePropertyRef
Definition: Property.h:705
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:738
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:1413
PropertyWithHandlers::m_handlers
Handler m_handlers
Definition: Property.h:788
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:781
Gaudi::Property::assign
bool assign(const Details::PropertyBase &source) override
get the value from another property
Definition: Property.h:631
GaudiHandleProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:844
Gaudi::Property::operator!=
bool operator!=(const T &other) const
inequality comparison
Definition: Property.h:443
LongProperty
Gaudi::Property< long > LongProperty
Definition: Property.h:716
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:766
Gaudi::Property::value
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:479
std::remove_reference
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:83
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:377
UnsignedShortPropertyRef
Gaudi::Property< unsigned short & > UnsignedShortPropertyRef
Definition: Property.h:732
FloatArrayProperty
Gaudi::Property< std::vector< float > > FloatArrayProperty
Definition: Property.h:758
Gaudi::Property::operator++
ValueType operator++(int)
Definition: Property.h:569
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:882
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
GaudiHandleProperty::operator=
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
Definition: Property.h:834
ShortArrayPropertyRef
Gaudi::Property< std::vector< short > & > ShortArrayPropertyRef
Definition: Property.h:769
GaudiHandleArrayProperty
Definition: Property.h:869
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:366
PropertyWithHandlers::updateCallBack
const std::function< void(PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:809
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:392
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
UnsignedCharProperty
Gaudi::Property< unsigned char > UnsignedCharProperty
Definition: Property.h:711
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:405
ShortPropertyRef
Gaudi::Property< short & > ShortPropertyRef
Definition: Property.h:731
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:730
Gaudi::Property::operator--
ValueType operator--(int)
Definition: Property.h:580
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:687
Gaudi::Details::Property::NoHandler::useReadHandler
void useReadHandler(const PropertyBase &) const
Definition: Property.h:257
BooleanArrayProperty
Gaudi::Property< std::vector< bool > > BooleanArrayProperty
Definition: Property.h:746
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:772
Gaudi::Property::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: Property.h:650
Gaudi::Property::toStream
void toStream(std::ostream &out) const override
value -> stream
Definition: Property.h:663
BooleanPropertyRef
Gaudi::Property< bool & > BooleanPropertyRef
Definition: Property.h:727
Gaudi::Details::Property::UpdateHandler::useUpdateHandler
void useUpdateHandler(PropertyBase &p)
Definition: Property.h:283
Gaudi::Details::Property::ReadUpdateHandler
Definition: Property.h:296