| The Gaudi Framework v28r2-patches (bc4ad17a)

- 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() + " [" + ownerTypeName() + "]"; }
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 ) { return Gaudi::Utils::toString( v ); }
156 inline TYPE fromString( const std::string& s )
157 {
158 TYPE tmp;
159 using Gaudi::Parsers::parse;
160 if ( !parse( tmp, s ).isSuccess() ) {
161 throw std::invalid_argument( "cannot parse '" + s + "' to " + System::typeinfoName( typeid( TYPE ) ) );
162 }
163 return tmp;
164 }
165 };
166 template <>
167 inline std::string StringConverter<std::string>::toString( const std::string& v )
168 {
169 return v;
170 }
171 struct NullVerifier {
172 template <class TYPE>
173 void operator()( const TYPE& ) const
174 {
175 }
176 };
177 template <class TYPE>
178 struct BoundedVerifier {
179 void operator()( const TYPE& value ) const
180 {
181 // throw the exception if the limit is defined and value is outside
182 if ( ( m_hasLowerBound && ( value < m_lowerBound ) ) || ( m_hasUpperBound && ( m_upperBound < value ) ) )
183 throw std::out_of_range( "value " + Gaudi::Utils::toString( value ) + " outside range" );
184 }
185
187 bool hasLower() const { return m_hasLowerBound; }
189 bool hasUpper() const { return m_hasUpperBound; }
191 const TYPE& lower() const { return m_lowerBound; }
193 const TYPE& upper() const { return m_upperBound; }
194
196 void setLower( const TYPE& value )
197 {
198 m_hasLowerBound = true;
199 m_lowerBound = value;
200 }
202 void setUpper( const TYPE& value )
203 {
204 m_hasUpperBound = true;
205 m_upperBound = value;
206 }
208 void clearLower()
209 {
210 m_hasLowerBound = false;
211 m_lowerBound = TYPE();
212 }
214 void clearUpper()
215 {
216 m_hasUpperBound = false;
217 m_upperBound = TYPE();
218 }
219
221 void setBounds( const TYPE& lower, const TYPE& upper )
222 {
223 setLower( lower );
224 setUpper( upper );
225 }
226
228 void clearBounds()
229 {
230 clearLower();
231 clearUpper();
232 }
233
234 private:
236 bool m_hasLowerBound{false};
237 bool m_hasUpperBound{false};
238 TYPE m_lowerBound{};
239 TYPE m_upperBound{};
240 };
241
243 struct SwapCall {
244 using callback_t = std::function<void( PropertyBase& )>;
245 callback_t tmp, &orig;
246 SwapCall( callback_t& input ) : orig( input ) { tmp.swap( orig ); }
247 ~SwapCall() { orig.swap( tmp ); }
248 void operator()( PropertyBase& p ) const { tmp( p ); }
249 };
250
251 struct NoHandler {
252 void useReadHandler( const PropertyBase& ) const {}
253 void setReadHandler( std::function<void( PropertyBase& )> )
254 {
255 throw std::logic_error( "setReadHandler not implemented for this class" );
256 }
257 std::function<void( PropertyBase& )> getReadHandler() const { return nullptr; }
258 void useUpdateHandler( const PropertyBase& ) const {}
259 void setUpdateHandler( std::function<void( PropertyBase& )> )
260 {
261 throw std::logic_error( "setUpdateHandler not implemented for this class" );
262 }
263 std::function<void( PropertyBase& )> getUpdateHandler() const { return nullptr; }
264 };
265 struct ReadHandler : NoHandler {
266 mutable std::function<void( PropertyBase& )> m_readCallBack;
267 void useReadHandler( const PropertyBase& p ) const
268 {
269 if ( m_readCallBack ) {
270 SwapCall{m_readCallBack}( const_cast<PropertyBase&>( p ) );
271 }
272 }
273 void setReadHandler( std::function<void( PropertyBase& )> fun ) { m_readCallBack = std::move( fun ); }
274 std::function<void( PropertyBase& )> getReadHandler() const { return m_readCallBack; }
275 };
276 struct UpdateHandler : NoHandler {
277 std::function<void( PropertyBase& )> m_updateCallBack;
278 void useUpdateHandler( PropertyBase& p )
279 {
280 if ( m_updateCallBack ) {
281 try {
282 SwapCall{m_updateCallBack}( p );
283 } catch ( const std::exception& x ) {
284 throw std::invalid_argument( "failure in update handler of '" + p.name() + "': " + x.what() );
285 }
286 }
287 }
288 void setUpdateHandler( std::function<void( PropertyBase& )> fun ) { m_updateCallBack = std::move( fun ); }
289 std::function<void( PropertyBase& )> getUpdateHandler() const { return m_updateCallBack; }
290 };
291 struct ReadUpdateHandler : ReadHandler, UpdateHandler {
292 using ReadHandler::useReadHandler;
293 using ReadHandler::setReadHandler;
294 using ReadHandler::getReadHandler;
295 using UpdateHandler::useUpdateHandler;
296 using UpdateHandler::setUpdateHandler;
297 using UpdateHandler::getUpdateHandler;
298 };
299 }
300
301 } // namespace Details
302
303 // ============================================================================
311 // ============================================================================
312 template <class TYPE, class VERIFIER = Details::Property::NullVerifier,
313 class HANDLERS = Details::Property::UpdateHandler>
314 class Property : public Details::PropertyBase
315 {
316 public:
317 // ==========================================================================
319 using StorageType = TYPE;
320 using ValueType = typename std::remove_reference<StorageType>::type;
321 using VerifierType = VERIFIER;
322 using HandlersType = HANDLERS;
323
324 private:
326 StorageType m_value;
327 VerifierType m_verifier;
328 HandlersType m_handlers;
331 template <class T>
332 using is_this_type = std::is_same<Property, typename std::remove_reference<T>::type>;
333 template <class T>
334 using not_copying = std::enable_if<!is_this_type<T>::value>;
336 public:
337 // ==========================================================================
339 template <class T = ValueType>
340 inline Property( std::string name, T&& value, std::string doc = "" )
341 : Details::PropertyBase( typeid( ValueType ), std::move( name ), std::move( doc ) )
342 , m_value( std::forward<T>( value ) )
343 {
344 m_verifier( m_value );
345 }
348 template <class OWNER, class T = ValueType,
349 typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type,
350 typename = typename std::enable_if<std::is_default_constructible<T>::value>::type>
351 inline Property( OWNER* owner, std::string name )
352 : Property( std::move( name ), ValueType{}, "" )
353 {
354 owner->declareProperty( *this );
355 setOwnerType<OWNER>();
356 }
357
360 template <class OWNER, class T = ValueType,
361 typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type>
362 inline Property( OWNER* owner, std::string name, T&& value, std::string doc = "" )
363 : Property( std::move( name ), std::forward<T>( value ), std::move( doc ) )
364 {
365 owner->declareProperty( *this );
366 setOwnerType<OWNER>();
367 }
368
372 template <class T = ValueType, typename = typename not_copying<T>::type>
373 Property( T&& v ) : Details::PropertyBase( typeid( ValueType ), "", "" ), m_value( std::forward<T>( v ) )
374 {
375 }
376
379 template <typename T = StorageType, typename = typename std::enable_if<!std::is_reference<T>::value>::type>
380 Property() : Details::PropertyBase( typeid( ValueType ), "", "" ), m_value()
381 {
382 }
383
384 using Details::PropertyBase::declareReadHandler;
385 using Details::PropertyBase::declareUpdateHandler;
386
388 Details::PropertyBase& declareReadHandler( std::function<void( Details::PropertyBase& )> fun ) override
389 {
390 m_handlers.setReadHandler( std::move( fun ) );
391 return *this;
392 }
394 Details::PropertyBase& declareUpdateHandler( std::function<void( Details::PropertyBase& )> fun ) override
395 {
396 m_handlers.setUpdateHandler( std::move( fun ) );
397 return *this;
398 }
399
401 const std::function<void( Details::PropertyBase& )> readCallBack() const override
402 {
403 return m_handlers.getReadHandler();
404 }
406 const std::function<void( Details::PropertyBase& )> updateCallBack() const override
407 {
408 return m_handlers.getUpdateHandler();
409 }
410
412 bool useUpdateHandler() override
413 {
414 m_handlers.useUpdateHandler( *this );
415 return true;
416 }
417
419 operator const ValueType&() const
420 {
421 m_handlers.useReadHandler( *this );
422 return m_value;
423 }
424 // /// Automatic conversion to value (reference).
425 // operator ValueType& () {
426 // useReadHandler();
427 // return m_value;
428 // }
429
431 template <class T>
432 inline bool operator==( const T& other ) const
433 {
434 return m_value == other;
435 }
436
438 template <class T>
439 inline bool operator!=( const T& other ) const
440 {
441 return m_value != other;
442 }
443
445 template <class T>
446 inline bool operator<( const T& other ) const
447 {
448 return m_value < other;
449 }
450
452 template <class T>
453 decltype( std::declval<ValueType>() + std::declval<T>() ) operator+( const T& other ) const
454 {
455 return m_value + other;
456 }
457
459 template <class T = ValueType>
460 Property& operator=( T&& v )
461 {
462 m_verifier( v );
463 m_value = std::forward<T>( v );
464 m_handlers.useUpdateHandler( *this );
465 return *this;
466 }
467
469 const VerifierType& verifier() const { return m_verifier; }
471 VerifierType& verifier() { return m_verifier; }
472
475 const ValueType& value() const { return *this; }
476 ValueType& value() { return const_cast<ValueType&>( (const ValueType&)*this ); }
477 bool setValue( const ValueType& v )
478 {
479 *this = v;
480 return true;
481 }
482 bool set( const ValueType& v )
483 {
484 *this = v;
485 return true;
486 }
487 Details::PropertyBase* clone() const override { return new Property( *this ); }
489
493 template <class T = const ValueType>
494 inline decltype( std::declval<T>().size() ) size() const
495 {
496 return value().size();
497 }
498 template <class T = const ValueType>
499 inline decltype( std::declval<T>().length() ) length() const
500 {
501 return value().length();
502 }
503 template <class T = const ValueType>
504 inline decltype( std::declval<T>().empty() ) empty() const
505 {
506 return value().empty();
507 }
508 template <class T = ValueType>
509 inline decltype( std::declval<T>().clear() ) clear()
510 {
511 value().clear();
512 }
513 template <class T = const ValueType>
514 inline decltype( std::declval<T>().begin() ) begin() const
515 {
516 return value().begin();
517 }
518 template <class T = const ValueType>
519 inline decltype( std::declval<T>().end() ) end() const
520 {
521 return value().end();
522 }
523 template <class T = ValueType>
524 inline decltype( std::declval<T>().begin() ) begin()
525 {
526 return value().begin();
527 }
528 template <class T = ValueType>
529 inline decltype( std::declval<T>().end() ) end()
530 {
531 return value().end();
532 }
533 template <class ARG, class T = const ValueType>
534 inline decltype( std::declval<T>()[ARG{}] ) operator[]( const ARG& arg ) const
535 {
536 return value()[arg];
537 }
538 template <class ARG, class T = ValueType>
539 inline decltype( std::declval<T>()[ARG{}] ) operator[]( const ARG& arg )
540 {
541 return value()[arg];
542 }
543 template <class T = const ValueType>
544 inline decltype( std::declval<T>().find( typename T::key_type{} ) ) find( const typename T::key_type& key ) const
545 {
546 return value().find( key );
547 }
548 template <class T = ValueType>
549 inline decltype( std::declval<T>().find( typename T::key_type{} ) ) find( const typename T::key_type& key )
550 {
551 return value().find( key );
552 }
553 template <class ARG, class T = ValueType>
554 inline decltype( std::declval<T>().erase( ARG{} ) ) erase( ARG arg )
555 {
556 return value().erase( arg );
557 }
558 template <class = ValueType>
559 inline Property& operator++()
560 {
561 ++value();
562 return *this;
563 }
564 template <class = ValueType>
565 inline ValueType operator++( int )
566 {
567 return m_value++;
568 }
569 template <class = ValueType>
570 inline Property& operator--()
571 {
572 --value();
573 return *this;
574 }
575 template <class = ValueType>
576 inline ValueType operator--( int )
577 {
578 return m_value--;
579 }
580 template <class T = ValueType>
581 inline Property& operator+=( const T& other )
582 {
583 m_value += other;
584 return *this;
585 }
586 template <class T = ValueType>
587 inline Property& operator-=( const T& other )
588 {
589 m_value -= other;
590 return *this;
591 }
593 // ==========================================================================
594 public:
596 bool assign( const Details::PropertyBase& source ) override
597 {
598 // Check if the property of is of "the same" type, except for strings
599 const Property* p =
600 ( std::is_same<ValueType, std::string>::value ) ? nullptr : dynamic_cast<const Property*>( &source );
601 if ( p ) {
602 *this = p->value();
603 } else {
604 this->fromString( source.toString() ).ignore();
605 }
606 return true;
607 }
609 bool load( Details::PropertyBase& dest ) const override
610 {
611 // delegate to the 'opposite' method
612 return dest.assign( *this );
613 }
615 StatusCode fromString( const std::string& source ) override
616 {
617 using Converter = Details::Property::StringConverter<ValueType>;
618 *this = Converter().fromString( source );
619 return StatusCode::SUCCESS;
620 }
622 std::string toString() const override
623 {
624 using Converter = Details::Property::StringConverter<ValueType>;
625 return Converter().toString( *this );
626 }
628 void toStream( std::ostream& out ) const override
629 {
630 m_handlers.useReadHandler( *this );
631 using Utils::toStream;
632 toStream( m_value, out );
633 }
634 };
635
637 template <class T, class TP, class V, class H>
638 bool operator==( const T& v, const Property<TP, V, H>& p )
639 {
640 return p == v;
641 }
642
644 template <class T, class TP, class V, class H>
645 bool operator!=( const T& v, const Property<TP, V, H>& p )
646 {
647 return p != v;
648 }
649
651 template <class T, class TP, class V, class H>
652 decltype( std::declval<TP>() + std::declval<T>() ) operator+( const T& v, const Property<TP, V, H>& p )
653 {
654 return v + p.value();
655 }
656
657 template <class TYPE, class HANDLERS = Details::Property::UpdateHandler>
658 using CheckedProperty = Property<TYPE, Details::Property::BoundedVerifier<TYPE>, HANDLERS>;
659
660 template <class TYPE>
661 using PropertyWithReadHandler =
662 Property<TYPE, Details::Property::NullVerifier, Gaudi::Details::Property::ReadUpdateHandler>;
663
664 } // namespace Gaudi
665
666 template <class TYPE>
667 using SimpleProperty = Gaudi::Property<TYPE>;
668
669 template <class TYPE>
670 using SimplePropertyRef = Gaudi::Property<TYPE&>;
671
672 // Typedef Properties for built-in types
673 typedef Gaudi::Property<bool> BooleanProperty;
674 typedef Gaudi::Property<char> CharProperty;
675 typedef Gaudi::Property<signed char> SignedCharProperty;
676 typedef Gaudi::Property<unsigned char> UnsignedCharProperty;
677 typedef Gaudi::Property<short> ShortProperty;
678 typedef Gaudi::Property<unsigned short> UnsignedShortProperty;
679 typedef Gaudi::Property<int> IntegerProperty;
680 typedef Gaudi::Property<unsigned int> UnsignedIntegerProperty;
681 typedef Gaudi::Property<long> LongProperty;
682 typedef Gaudi::Property<unsigned long> UnsignedLongProperty;
683 typedef Gaudi::Property<long long> LongLongProperty;
684 typedef Gaudi::Property<unsigned long long> UnsignedLongLongProperty;
685 typedef Gaudi::Property<float> FloatProperty;
686 typedef Gaudi::Property<double> DoubleProperty;
687 typedef Gaudi::Property<long double> LongDoubleProperty;
688
689 typedef Gaudi::Property<std::string> StringProperty;
690
691 // Typedef PropertyRefs for built-in types
692 typedef Gaudi::Property<bool&> BooleanPropertyRef;
693 typedef Gaudi::Property<char&> CharPropertyRef;
694 typedef Gaudi::Property<signed char&> SignedCharPropertyRef;
695 typedef Gaudi::Property<unsigned char&> UnsignedCharPropertyRef;
696 typedef Gaudi::Property<short&> ShortPropertyRef;
697 typedef Gaudi::Property<unsigned short&> UnsignedShortPropertyRef;
698 typedef Gaudi::Property<int&> IntegerPropertyRef;
699 typedef Gaudi::Property<unsigned int&> UnsignedIntegerPropertyRef;
700 typedef Gaudi::Property<long&> LongPropertyRef;
701 typedef Gaudi::Property<unsigned long&> UnsignedLongPropertyRef;
702 typedef Gaudi::Property<long long&> LongLongPropertyRef;
703 typedef Gaudi::Property<unsigned long long&> UnsignedLongLongPropertyRef;
704 typedef Gaudi::Property<float&> FloatPropertyRef;
705 typedef Gaudi::Property<double&> DoublePropertyRef;
706 typedef Gaudi::Property<long double&> LongDoublePropertyRef;
707
708 typedef Gaudi::Property<std::string&> StringPropertyRef;
709
710 // Typedef "Arrays" of Properties for built-in types
711 typedef Gaudi::Property<std::vector<bool>> BooleanArrayProperty;
712 typedef Gaudi::Property<std::vector<char>> CharArrayProperty;
713 typedef Gaudi::Property<std::vector<signed char>> SignedCharArrayProperty;
714 typedef Gaudi::Property<std::vector<unsigned char>> UnsignedCharArrayProperty;
715 typedef Gaudi::Property<std::vector<short>> ShortArrayProperty;
716 typedef Gaudi::Property<std::vector<unsigned short>> UnsignedShortArrayProperty;
717 typedef Gaudi::Property<std::vector<int>> IntegerArrayProperty;
718 typedef Gaudi::Property<std::vector<unsigned int>> UnsignedIntegerArrayProperty;
719 typedef Gaudi::Property<std::vector<long>> LongArrayProperty;
720 typedef Gaudi::Property<std::vector<unsigned long>> UnsignedLongArrayProperty;
721 typedef Gaudi::Property<std::vector<long long>> LongLongArrayProperty;
722 typedef Gaudi::Property<std::vector<unsigned long long>> UnsignedLongLongArrayProperty;
723 typedef Gaudi::Property<std::vector<float>> FloatArrayProperty;
724 typedef Gaudi::Property<std::vector<double>> DoubleArrayProperty;
725 typedef Gaudi::Property<std::vector<long double>> LongDoubleArrayProperty;
726
727 typedef Gaudi::Property<std::vector<std::string>> StringArrayProperty;
728
729 // Typedef "Arrays" of PropertyRefs for built-in types
730 typedef Gaudi::Property<std::vector<bool>&> BooleanArrayPropertyRef;
731 typedef Gaudi::Property<std::vector<char>&> CharArrayPropertyRef;
732 typedef Gaudi::Property<std::vector<signed char>&> SignedCharArrayPropertyRef;
733 typedef Gaudi::Property<std::vector<unsigned char>&> UnsignedCharArrayPropertyRef;
734 typedef Gaudi::Property<std::vector<short>&> ShortArrayPropertyRef;
735 typedef Gaudi::Property<std::vector<unsigned short>&> UnsignedShortArrayPropertyRef;
736 typedef Gaudi::Property<std::vector<int>&> IntegerArrayPropertyRef;
737 typedef Gaudi::Property<std::vector<unsigned int>&> UnsignedIntegerArrayPropertyRef;
738 typedef Gaudi::Property<std::vector<long>&> LongArrayPropertyRef;
739 typedef Gaudi::Property<std::vector<unsigned long>&> UnsignedLongArrayPropertyRef;
740 typedef Gaudi::Property<std::vector<long long>&> LongLongArrayPropertyRef;
741 typedef Gaudi::Property<std::vector<unsigned long long>&> UnsignedLongLongArrayPropertyRef;
742 typedef Gaudi::Property<std::vector<float>&> FloatArrayPropertyRef;
743 typedef Gaudi::Property<std::vector<double>&> DoubleArrayPropertyRef;
744 typedef Gaudi::Property<std::vector<long double>&> LongDoubleArrayPropertyRef;
745
746 typedef Gaudi::Property<std::vector<std::string>&> StringArrayPropertyRef;
747
750 template <typename Handler = typename Gaudi::Details::Property::UpdateHandler>
751 class PropertyWithHandlers : public Gaudi::Details::PropertyBase
752 {
753 Handler m_handlers;
754
755 public:
756 using PropertyBase::PropertyBase;
757
759 PropertyBase& declareReadHandler( std::function<void( PropertyBase& )> fun ) override
760 {
761 m_handlers.setReadHandler( std::move( fun ) );
762 return *this;
763 }
765 PropertyBase& declareUpdateHandler( std::function<void( PropertyBase& )> fun ) override
766 {
767 m_handlers.setUpdateHandler( std::move( fun ) );
768 return *this;
769 }
770
772 const std::function<void( PropertyBase& )> readCallBack() const override { return m_handlers.getReadHandler(); }
774 const std::function<void( PropertyBase& )> updateCallBack() const override { return m_handlers.getUpdateHandler(); }
775
777 void useReadHandler() const { m_handlers.useReadHandler( *this ); }
778
780 bool useUpdateHandler() override
781 {
782 m_handlers.useUpdateHandler( *this );
783 return true;
784 }
785 };
786
787 // forward-declaration is sufficient here
788 class GaudiHandleBase;
789
790 // implementation in header file only where the GaudiHandleBase class
791 // definition is not needed. The rest goes into the .cpp file.
792 // The goal is to decouple the header files, to avoid that the whole
793 // world depends on GaudiHandle.h
794 class GAUDI_API GaudiHandleProperty : public PropertyWithHandlers<>
795 {
796 public:
797 GaudiHandleProperty( std::string name, GaudiHandleBase& ref );
798
799 GaudiHandleProperty& operator=( const GaudiHandleBase& value )
800 {
801 setValue( value );
802 return *this;
803 }
804
805 GaudiHandleProperty* clone() const override { return new GaudiHandleProperty( *this ); }
806
807 bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
808
809 bool assign( const PropertyBase& source ) override { return fromString( source.toString() ); }
810
811 std::string toString() const override;
812
813 void toStream( std::ostream& out ) const override;
814
815 StatusCode fromString( const std::string& s ) override;
816
817 const GaudiHandleBase& value() const
818 {
819 useReadHandler();
820 return *m_pValue;
821 }
822
823 bool setValue( const GaudiHandleBase& value );
824
825 private:
828 GaudiHandleBase* m_pValue;
829 };
830
831 // forward-declaration is sufficient here
832 class GaudiHandleArrayBase;
833
834 class GAUDI_API GaudiHandleArrayProperty : public PropertyWithHandlers<>
835 {
836 public:
837 GaudiHandleArrayProperty( std::string name, GaudiHandleArrayBase& ref );
838
839 GaudiHandleArrayProperty& operator=( const GaudiHandleArrayBase& value )
840 {
841 setValue( value );
842 return *this;
843 }
844
845 GaudiHandleArrayProperty* clone() const override { return new GaudiHandleArrayProperty( *this ); }
846
847 bool load( PropertyBase& destination ) const override { return destination.assign( *this ); }
848
849 bool assign( const PropertyBase& source ) override { return fromString( source.toString() ); }
850
851 std::string toString() const override;
852
853 void toStream( std::ostream& out ) const override;
854
855 StatusCode fromString( const std::string& s ) override;
856
857 const GaudiHandleArrayBase& value() const
858 {
859 useReadHandler();
860 return *m_pValue;
861 }
862
863 bool setValue( const GaudiHandleArrayBase& value );
864
865 private:
868 GaudiHandleArrayBase* m_pValue;
869 };
870
871 namespace Gaudi
872 {
873 namespace Utils
874 {
875 // ========================================================================
893 GAUDI_API bool hasProperty( const IProperty* p, const std::string& name );
894 // ========================================================================
912 GAUDI_API bool hasProperty( const IInterface* p, const std::string& name );
913 // ========================================================================
931 GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IProperty* p, const std::string& name );
932 // ========================================================================
950 GAUDI_API Gaudi::Details::PropertyBase* getProperty( const IInterface* p, const std::string& name );
951 // ========================================================================
974 GAUDI_API bool hasProperty( const std::vector<const Gaudi::Details::PropertyBase*>* p, const std::string& name );
975 // ========================================================================
998 GAUDI_API const Gaudi::Details::PropertyBase*
999 getProperty( const std::vector<const Gaudi::Details::PropertyBase*>* p, const std::string& name );
1000 // ========================================================================
1024 template <class TYPE>
1025 StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc );
1026 // ========================================================================
1049 template <class TYPE>
1050 StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value )
1051 {
1052 return setProperty( component, name, value, std::string() );
1053 }
1054 // ========================================================================
1068 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const std::string& value,
1069 const std::string& doc = "" );
1070 // ========================================================================
1084 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name, const char* value,
1085 const std::string& doc = "" );
1086 // ========================================================================
1100 template <unsigned N>
1101 StatusCode setProperty( IProperty* component, const std::string& name, const char ( &value )[N],
1102 const std::string& doc = "" )
1103 {
1104 return component ? setProperty( component, name, std::string( value, value + N ), doc ) : StatusCode::FAILURE;
1105 }
1106 // ========================================================================
1137 template <class TYPE>
1138 StatusCode setProperty( IProperty* component, const std::string& name, const TYPE& value, const std::string& doc )
1139 {
1140 return component && hasProperty( component, name )
1141 ? Gaudi::Utils::setProperty( component, name, Gaudi::Utils::toString( value ), doc )
1142 : StatusCode::FAILURE;
1143 }
1144 // ========================================================================
1166 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name,
1167 const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1168 // ========================================================================
1190 GAUDI_API StatusCode setProperty( IProperty* component, const std::string& name,
1191 const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1192 // ========================================================================
1215 template <class TYPE>
1216 StatusCode setProperty( IProperty* component, const std::string& name, const Gaudi::Property<TYPE>& value,
1217 const std::string& doc = "" )
1218 {
1219 return setProperty( component, name, &value, doc );
1220 }
1221 // ========================================================================
1242 template <class TYPE>
1243 StatusCode setProperty( IInterface* component, const std::string& name, const TYPE& value,
1244 const std::string& doc = "" )
1245 {
1246 if ( !component ) {
1247 return StatusCode::FAILURE;
1248 }
1249 auto property = SmartIF<IProperty>{component};
1250 return property ? setProperty( property, name, value, doc ) : StatusCode::FAILURE;
1251 }
1252 // ========================================================================
1265 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const std::string& value,
1266 const std::string& doc = "" );
1267 // ========================================================================
1280 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name, const char* value,
1281 const std::string& doc = "" );
1282 // ========================================================================
1296 template <unsigned N>
1297 StatusCode setProperty( IInterface* component, const std::string& name, const char ( &value )[N],
1298 const std::string& doc = "" )
1299 {
1300 if ( 0 == component ) {
1301 return StatusCode::FAILURE;
1302 }
1303 return setProperty( component, name, std::string{value, value + N}, doc );
1304 }
1305 // ========================================================================
1327 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name,
1328 const Gaudi::Details::PropertyBase* property, const std::string& doc = "" );
1329 // ========================================================================
1351 GAUDI_API StatusCode setProperty( IInterface* component, const std::string& name,
1352 const Gaudi::Details::PropertyBase& property, const std::string& doc = "" );
1353 // ========================================================================
1376 template <class TYPE>
1377 StatusCode setProperty( IInterface* component, const std::string& name, const Gaudi::Property<TYPE>& value,
1378 const std::string& doc = "" )
1379 {
1380 return setProperty( component, name, &value, doc );
1381 }
1382 // ========================================================================
1383 } // end of namespace Gaudi::Utils
1384 } // end of namespace Gaudi
1385 // ============================================================================
1386 // The END
1387 // ============================================================================
1388 #endif // GAUDIKERNEL_PROPERTY_H
1389 // ============================================================================
FloatArrayPropertyRef
Gaudi::Property< std::vector< float > & > FloatArrayPropertyRef
Definition: Property.h:742
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:1138
SignedCharPropertyRef
Gaudi::Property< signed char & > SignedCharPropertyRef
Definition: Property.h:694
Gaudi::Property< vector< std::string > >::VerifierType
Details::Property::NullVerifier VerifierType
Definition: Property.h:321
SignedCharArrayPropertyRef
Gaudi::Property< std::vector< signed char > & > SignedCharArrayPropertyRef
Definition: Property.h:732
Gaudi::Details::Property::SwapCall::~SwapCall
~SwapCall()
Definition: Property.h:247
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:351
StatusCode::SUCCESS
Definition: StatusCode.h:30
Gaudi::Details::Property::ReadHandler::m_readCallBack
std::function< void(PropertyBase &)> m_readCallBack
Definition: Property.h:266
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:699
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:645
GaudiHandleProperty::clone
GaudiHandleProperty * clone() const override
clones the current property
Definition: Property.h:805
Gaudi::Property::setValue
bool setValue(const ValueType &v)
Definition: Property.h:477
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:315
Gaudi::Details::Property::NoHandler::getReadHandler
std::function< void(PropertyBase &)> getReadHandler() const
Definition: Property.h:257
Gaudi::Details::Property::NoHandler::useUpdateHandler
void useUpdateHandler(const PropertyBase &) const
Definition: Property.h:258
UnsignedShortArrayProperty
Gaudi::Property< std::vector< unsigned short > > UnsignedShortArrayProperty
Definition: Property.h:716
Gaudi::Details::Property::BoundedVerifier
Definition: Property.h:178
SimpleProperty
Gaudi::Property< TYPE > SimpleProperty
Definition: Property.h:667
LongLongPropertyRef
Gaudi::Property< long long & > LongLongPropertyRef
Definition: Property.h:702
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:717
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:638
Gaudi::Property::useUpdateHandler
bool useUpdateHandler() override
manual trigger for callback for update
Definition: Property.h:412
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
StatusCode::FAILURE
Definition: StatusCode.h:29
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:683
Gaudi::Details::Property::ReadHandler
Definition: Property.h:265
PropertyWithHandlers::readCallBack
const std::function< void(PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:772
std::function
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:314
LongPropertyRef
Gaudi::Property< long & > LongPropertyRef
Definition: Property.h:700
Gaudi::Details::Property::UpdateHandler::m_updateCallBack
std::function< void(PropertyBase &)> m_updateCallBack
Definition: Property.h:277
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:299
DoubleArrayPropertyRef
Gaudi::Property< std::vector< double > & > DoubleArrayPropertyRef
Definition: Property.h:743
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:245
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:807
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:460
FloatProperty
Gaudi::Property< float > FloatProperty
Definition: Property.h:685
IntegerProperty
Gaudi::Property< int > IntegerProperty
Definition: Property.h:679
UnsignedLongLongArrayPropertyRef
Gaudi::Property< std::vector< unsigned long long > & > UnsignedLongLongArrayPropertyRef
Definition: Property.h:741
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:214
Gaudi::Details::Property::BoundedVerifier::upper
const TYPE & upper() const
Return the upper bound value.
Definition: Property.h:193
GaudiHandleArrayProperty::clone
GaudiHandleArrayProperty * clone() const override
clones the current property
Definition: Property.h:845
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:367
UnsignedLongLongProperty
Gaudi::Property< unsigned long long > UnsignedLongLongProperty
Definition: Property.h:684
std::is_same
FloatPropertyRef
Gaudi::Property< float & > FloatPropertyRef
Definition: Property.h:704
Gaudi::Property< vector< std::string > >::StorageType
vector< std::string > StorageType
Hosted type.
Definition: Property.h:319
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:794
Gaudi::Property::toString
std::string toString() const override
value -> string
Definition: Property.h:622
StringArrayProperty
Gaudi::Property< std::vector< std::string > > StringArrayProperty
Definition: Property.h:727
UnsignedShortArrayPropertyRef
Gaudi::Property< std::vector< unsigned short > & > UnsignedShortArrayPropertyRef
Definition: Property.h:735
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:11
UnsignedCharArrayProperty
Gaudi::Property< std::vector< unsigned char > > UnsignedCharArrayProperty
Definition: Property.h:714
Gaudi::Details::Property::BoundedVerifier::setLower
void setLower(const TYPE &value)
Set lower bound value.
Definition: Property.h:196
Gaudi::Property::m_handlers
HandlersType m_handlers
Definition: Property.h:328
UnsignedShortProperty
Gaudi::Property< unsigned short > UnsignedShortProperty
Definition: Property.h:678
Gaudi::Property::updateCallBack
const std::function< void(Details::PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:406
Gaudi::Details::Property::NoHandler
Definition: Property.h:251
std::string::end
T end(T...args)
UnsignedLongProperty
Gaudi::Property< unsigned long > UnsignedLongProperty
Definition: Property.h:682
StringPropertyRef
Gaudi::Property< std::string & > StringPropertyRef
Definition: Property.h:708
Gaudi::Property::m_value
StorageType m_value
Storage.
Definition: Property.h:326
CharPropertyRef
Gaudi::Property< char & > CharPropertyRef
Definition: Property.h:693
BooleanArrayPropertyRef
Gaudi::Property< std::vector< bool > & > BooleanArrayPropertyRef
Definition: Property.h:730
LongDoubleArrayProperty
Gaudi::Property< std::vector< long double > > LongDoubleArrayProperty
Definition: Property.h:725
LongLongArrayProperty
Gaudi::Property< std::vector< long long > > LongLongArrayProperty
Definition: Property.h:721
DoubleArrayProperty
Gaudi::Property< std::vector< double > > DoubleArrayProperty
Definition: Property.h:724
Gaudi::Property::operator<
bool operator<(const T &other) const
"less" comparison
Definition: Property.h:446
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:715
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:739
UnsignedIntegerArrayProperty
Gaudi::Property< std::vector< unsigned int > > UnsignedIntegerArrayProperty
Definition: Property.h:718
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:394
Gaudi::Property::Property
Property()
Construct an anonymous property with default constructed value.
Definition: Property.h:380
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:48
PropertyWithHandlers
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Definition: Property.h:751
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:581
LongArrayProperty
Gaudi::Property< std::vector< long > > LongArrayProperty
Definition: Property.h:719
Gaudi::Property< vector< std::string > >::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: Property.h:320
LongArrayPropertyRef
Gaudi::Property< std::vector< long > & > LongArrayPropertyRef
Definition: Property.h:738
Gaudi::Details::Property::SwapCall::operator()
void operator()(PropertyBase &p) const
Definition: Property.h:248
Gaudi::Details::Property::BoundedVerifier::operator()
void operator()(const TYPE &value) const
Definition: Property.h:179
SignedCharProperty
Gaudi::Property< signed char > SignedCharProperty
Definition: Property.h:675
CharProperty
Gaudi::Property< char > CharProperty
Definition: Property.h:674
IOTest.N
int N
Definition: IOTest.py:90
Gaudi::Property::operator-=
Property & operator-=(const T &other)
Definition: Property.h:587
Gaudi::Property::verifier
const VerifierType & verifier() const
Accessor to verifier.
Definition: Property.h:469
IntegerPropertyRef
Gaudi::Property< int & > IntegerPropertyRef
Definition: Property.h:698
GaudiHandleProperty::m_pValue
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition: Property.h:828
UnsignedLongPropertyRef
Gaudi::Property< unsigned long & > UnsignedLongPropertyRef
Definition: Property.h:701
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:559
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:221
LongDoubleArrayPropertyRef
Gaudi::Property< std::vector< long double > & > LongDoubleArrayPropertyRef
Definition: Property.h:744
gaudirun.dest
dest
Definition: gaudirun.py:162
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:340
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
gaudirun.type
type
Definition: gaudirun.py:125
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:680
SmartIF.h
Gaudi::Details::Property::StringConverter::fromString
TYPE fromString(const std::string &s)
Definition: Property.h:156
Gaudi::Details::Property::BoundedVerifier::lower
const TYPE & lower() const
Return the lower bound value.
Definition: Property.h:191
std::string::erase
T erase(T...args)
CharArrayProperty
Gaudi::Property< std::vector< char > > CharArrayProperty
Definition: Property.h:712
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:817
BooleanProperty
Gaudi::Property< bool > BooleanProperty
Definition: Property.h:673
PropertyWithHandlers::declareUpdateHandler
PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:765
UnsignedLongLongArrayProperty
Gaudi::Property< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
Definition: Property.h:722
GaudiPython.Bindings.GaudiHandleArrayProperty
GaudiHandleArrayProperty
Definition: Bindings.py:50
Gaudi::Property::verifier
VerifierType & verifier()
Accessor to verifier.
Definition: Property.h:471
PropertyWithHandlers::declareReadHandler
PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:759
GaudiHandleArrayProperty::value
const GaudiHandleArrayBase & value() const
Definition: Property.h:857
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:50
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:187
DoubleProperty
Gaudi::Property< double > DoubleProperty
Definition: Property.h:686
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:736
std::move
T move(T...args)
GaudiHandleArrayProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:849
Gaudi::Property::operator--
Property & operator--()
Definition: Property.h:570
Gaudi::Details::Property::NullVerifier::operator()
void operator()(const TYPE &) const
Definition: Property.h:173
LongLongArrayPropertyRef
Gaudi::Property< std::vector< long long > & > LongLongArrayPropertyRef
Definition: Property.h:740
DoublePropertyRef
Gaudi::Property< double & > DoublePropertyRef
Definition: Property.h:705
Gaudi::Details::Property::NoHandler::getUpdateHandler
std::function< void(PropertyBase &)> getUpdateHandler() const
Definition: Property.h:263
Gaudi::Property::operator==
bool operator==(const T &other) const
equality comparison
Definition: Property.h:432
UnsignedCharArrayPropertyRef
Gaudi::Property< std::vector< unsigned char > & > UnsignedCharArrayPropertyRef
Definition: Property.h:733
Gaudi::Details::Property::ReadHandler::useReadHandler
void useReadHandler(const PropertyBase &p) const
Definition: Property.h:267
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:189
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:609
std::string::size
T size(T...args)
GaudiHandleArrayBase
Base class of array&#39;s of various gaudihandles.
Definition: GaudiHandle.h:364
Gaudi::Details::Property::UpdateHandler::getUpdateHandler
std::function< void(PropertyBase &)> getUpdateHandler() const
Definition: Property.h:289
LongDoublePropertyRef
Gaudi::Property< long double & > LongDoublePropertyRef
Definition: Property.h:706
IProperty.h
Gaudi::Property::value
ValueType & value()
Definition: Property.h:476
std::vector
STL class.
PropertyWithHandlers::useReadHandler
void useReadHandler() const
use the call-back function at reading, if available
Definition: Property.h:777
SignedCharArrayProperty
Gaudi::Property< std::vector< signed char > > SignedCharArrayProperty
Definition: Property.h:713
PropertyWithHandlers::useUpdateHandler
bool useUpdateHandler() override
use the call-back function at update, if available
Definition: Property.h:780
StringProperty
Gaudi::Property< std::string > StringProperty
Definition: Property.h:689
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:288
LongDoubleProperty
Gaudi::Property< long double > LongDoubleProperty
Definition: Property.h:687
GaudiHandleArrayProperty::operator=
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
Definition: Property.h:839
Gaudi::Details::Property::SwapCall::SwapCall
SwapCall(callback_t &input)
Definition: Property.h:246
GaudiHandleArrayProperty::m_pValue
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Definition: Property.h:868
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
ShortProperty
Gaudi::Property< short > ShortProperty
Definition: Property.h:677
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:720
Gaudi::Property::clone
Details::PropertyBase * clone() const override
clones the current property
Definition: Property.h:487
SimplePropertyRef
Gaudi::Property< TYPE & > SimplePropertyRef
Definition: Property.h:670
gaudirun.s
string s
Definition: gaudirun.py:245
GaudiPython.Bindings.GaudiHandleProperty
GaudiHandleProperty
Definition: Bindings.py:49
UnsignedLongLongPropertyRef
Gaudi::Property< unsigned long long & > UnsignedLongLongPropertyRef
Definition: Property.h:703
Gaudi::Details::Property::BoundedVerifier::clearBounds
void clearBounds()
Clear both bounds (lower and upper) at the same time.
Definition: Property.h:228
Gaudi::Details::Property::ReadHandler::setReadHandler
void setReadHandler(std::function< void(PropertyBase &)> fun)
Definition: Property.h:273
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:1377
PropertyWithHandlers::m_handlers
Handler m_handlers
Definition: Property.h:753
Gaudi::Details::Property::ReadHandler::getReadHandler
std::function< void(PropertyBase &)> getReadHandler() const
Definition: Property.h:274
StringArrayPropertyRef
Gaudi::Property< std::vector< std::string > & > StringArrayPropertyRef
Definition: Property.h:746
Gaudi::Property::assign
bool assign(const Details::PropertyBase &source) override
get the value from another property
Definition: Property.h:596
GaudiHandleProperty::assign
bool assign(const PropertyBase &source) override
Definition: Property.h:809
Gaudi::Property::operator!=
bool operator!=(const T &other) const
inequality comparison
Definition: Property.h:439
LongProperty
Gaudi::Property< long > LongProperty
Definition: Property.h:681
Gaudi::Details::Property::NoHandler::setUpdateHandler
void setUpdateHandler(std::function< void(PropertyBase &)>)
Definition: Property.h:259
CharArrayPropertyRef
Gaudi::Property< std::vector< char > & > CharArrayPropertyRef
Definition: Property.h:731
Gaudi::Property::value
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:475
std::remove_reference
Gaudi::Details::Property::BoundedVerifier::clearLower
void clearLower()
Clear lower bound value.
Definition: Property.h:208
GaudiHandleBase
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
Definition: GaudiHandle.h:94
Gaudi::Details::Property::UpdateHandler
Definition: Property.h:276
ToStream.h
implementation of various functions for streaming.
Gaudi::Property::Property
Property(T &&v)
Construct an anonymous property from a value.
Definition: Property.h:373
UnsignedShortPropertyRef
Gaudi::Property< unsigned short & > UnsignedShortPropertyRef
Definition: Property.h:697
FloatArrayProperty
Gaudi::Property< std::vector< float > > FloatArrayProperty
Definition: Property.h:723
Gaudi::Property::operator++
ValueType operator++(int)
Definition: Property.h:565
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:243
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:847
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
GaudiHandleProperty::operator=
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
Definition: Property.h:799
ShortArrayPropertyRef
Gaudi::Property< std::vector< short > & > ShortArrayPropertyRef
Definition: Property.h:734
GaudiHandleArrayProperty
Definition: Property.h:834
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:362
PropertyWithHandlers::updateCallBack
const std::function< void(PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Definition: Property.h:774
Gaudi::Details::Property::NullVerifier
Definition: Property.h:171
Gaudi::Property::declareReadHandler
Details::PropertyBase & declareReadHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for reading
Definition: Property.h:388
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
UnsignedCharProperty
Gaudi::Property< unsigned char > UnsignedCharProperty
Definition: Property.h:676
Gaudi::Property::m_verifier
VerifierType m_verifier
Definition: Property.h:327
Gaudi::Property::readCallBack
const std::function< void(Details::PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Definition: Property.h:401
ShortPropertyRef
Gaudi::Property< short & > ShortPropertyRef
Definition: Property.h:696
Gaudi::Details::Property::BoundedVerifier::setUpper
void setUpper(const TYPE &value)
Set upper bound value.
Definition: Property.h:202
Gaudi::Details::Property::NoHandler::setReadHandler
void setReadHandler(std::function< void(PropertyBase &)>)
Definition: Property.h:253
Gaudi::Property< vector< std::string > >::HandlersType
Details::Property::UpdateHandler HandlersType
Definition: Property.h:322
UnsignedCharPropertyRef
Gaudi::Property< unsigned char & > UnsignedCharPropertyRef
Definition: Property.h:695
Gaudi::Property::operator--
ValueType operator--(int)
Definition: Property.h:576
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:652
Gaudi::Details::Property::NoHandler::useReadHandler
void useReadHandler(const PropertyBase &) const
Definition: Property.h:252
BooleanArrayProperty
Gaudi::Property< std::vector< bool > > BooleanArrayProperty
Definition: Property.h:711
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:737
Gaudi::Property::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: Property.h:615
Gaudi::Property::toStream
void toStream(std::ostream &out) const override
value -> stream
Definition: Property.h:628
BooleanPropertyRef
Gaudi::Property< bool & > BooleanPropertyRef
Definition: Property.h:692
Gaudi::Details::Property::UpdateHandler::useUpdateHandler
void useUpdateHandler(PropertyBase &p)
Definition: Property.h:278
Gaudi::Details::Property::ReadUpdateHandler
Definition: Property.h:291