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 <string>
7 #include <stdexcept>
8 #include <typeinfo>
9 // ============================================================================
10 // Application C++ Class Headers
11 // ============================================================================
12 #include "GaudiKernel/Kernel.h"
14 #include "GaudiKernel/Parsers.h"
15 #include "GaudiKernel/ToStream.h"
16 #include "GaudiKernel/SmartIF.h"
17 // ============================================================================
18 
19 // ============================================================================
20 class Property ;
21 class IProperty ;
22 class IInterface ;
23 // ============================================================================
24 
25 // ============================================================================
27 // ============================================================================
29 // ============================================================================
39 {
40 private:
41  // the default constructor is disabled
42  Property();
43 public:
45  const std::string& name () const { return m_name ; }
47  const std::string& documentation() const { return m_documentation; }
49  const std::type_info* type_info () const { return m_typeinfo ; }
51  std::string type () const { return m_typeinfo->name() ; }
53  virtual bool load ( Property& dest ) const = 0 ;
55  virtual bool assign ( const Property& source ) = 0 ;
56 public:
58  virtual std::string toString () const = 0 ;
60  virtual void toStream(std::ostream& out) const = 0;
62  virtual StatusCode fromString ( const std::string& value ) = 0 ;
63 public:
65  const std::function<void(Property&)>& readCallBack() const { return m_readCallBack; }
67  const std::function<void(Property&)>& updateCallBack() const { return m_updateCallBack; }
68 
70  virtual Property& declareReadHandler ( std::function<void(Property&)> fun ) ;
72  virtual Property& declareUpdateHandler ( std::function<void(Property&)> fun ) ;
73 
74  template< class HT >
75  inline Property& declareReadHandler( void ( HT::* MF ) ( Property& ) , HT* instance )
76  { return declareReadHandler( [=](Property& p) { (instance->*MF)(p); } ) ; }
77 
78  template< class HT >
79  inline Property& declareUpdateHandler( void ( HT::* MF ) ( Property& ) , HT* instance )
80  { return declareUpdateHandler ( [=](Property& p) { (instance->*MF)(p); } ); }
81 
83  virtual void useReadHandler () const ;
85  virtual bool useUpdateHandler () ;
86 public:
88  virtual ~Property() = default;
90  virtual Property* clone () const = 0 ;
92  void setName ( std::string value ) { m_name = std::move(value) ; }
94  void setDocumentation( std::string documentation ) {
95  m_documentation = std::move(documentation); }
97  virtual std::ostream& fillStream ( std::ostream& ) const ;
98 protected:
100  Property
101  ( const std::type_info& type ,
102  std::string name = "" ) ;
104  Property
105  ( std::string name ,
106  const std::type_info& type ) ;
108  Property ( const Property& ) = default;
110  Property& operator=( const Property& ) = default;
111 private:
112  // property name
114  // property doc string
116  // property type
118 protected:
119  // call back functor for reading
121  // call back functor for update
123 };
124 // ============================================================================
132 // ============================================================================
133 template <class TYPE>
135 {
136 public:
137  // ==========================================================================
141  typedef typename Traits::PVal PVal ;
142  // ==========================================================================
143 protected:
144  // ==========================================================================
146  inline PropertyWithValue
147  ( std::string name ,
148  PVal value ,
149  const bool owner ) ;
151  inline PropertyWithValue ( const PropertyWithValue& rhs ) ;
153  template <class OTHER>
154  inline PropertyWithValue ( const PropertyWithValue<OTHER>& right ) ;
156  ~PropertyWithValue() override ;
158  PropertyWithValue& operator=( const TYPE& value ) ;
159  // assignment operator (don't let the compiler generate a buggy one)
161  // assignment operator
162  template <class OTHER>
164  // ==========================================================================
165 public:
166  // ==========================================================================
168  operator const TYPE& () const { return value() ;}
170  inline const TYPE& value() const ;
171  // ==========================================================================
172 public:
173  // ==========================================================================
175  virtual bool setValue ( const TYPE& value ) = 0 ;
177  bool assign ( const Property& source ) override;
179  bool load ( Property& dest ) const override;
181  StatusCode fromString ( const std::string& s ) override;
183  std::string toString () const override;
185  void toStream (std::ostream& out) const override;
186  // ==========================================================================
187 protected:
188  // ==========================================================================
190  inline void i_set ( const TYPE& value ) {
191  Traits::assign(*m_value, value);
192  }
194  inline PVal i_get () const {
195  return m_value;
196  }
197  // ==========================================================================
198 private:
199  // ==========================================================================
201  PVal m_value ; // the actual property value
203  bool m_own ; // owner of the storage
204  // ==========================================================================
205 };
206 
207 // ============================================================================
209 // ============================================================================
210 template <class TYPE>
211 inline
214  PVal value ,
215  const bool own )
216  : Property ( typeid( TYPE ) , std::move(name) )
217  , m_value ( value )
218  , m_own ( own )
219 {}
220 // ============================================================================
221 // copy constructor
222 // ============================================================================
223 template <class TYPE>
225 ( const PropertyWithValue& right )
226  : Property( right )
227  , m_value ( right.m_value )
228  , m_own ( right.m_own )
229 {
230  m_value = Traits::copy ( right.value() , m_own ) ;
231 }
232 // ============================================================================
233 // "copy" constructor form any other type
234 // ============================================================================
235 template <class TYPE>
236 template <class OTHER>
238 ( const PropertyWithValue<OTHER>& right )
239  : Property( right )
240  , m_value ( right.m_value )
241  , m_own ( right.m_own )
242 {
243  m_value = Traits::copy ( right.value() , m_own ) ;
244 }
245 // ============================================================================
247 // ============================================================================
248 template <class TYPE>
250 {
251  Traits::dele ( m_value , m_own ) ;
252 }
253 // ============================================================================
255 // ============================================================================
256 template <class TYPE>
259 {
260  if ( !setValue ( value ) )
261  { throw std::out_of_range( "Value not verified" ) ; }
262  return *this ;
263 }
264 // ============================================================================
266 // ============================================================================
267 template <class TYPE>
268 inline bool
270 {
271  // 1) Is the property of "the same" type?
272  const PropertyWithValue<TYPE>* p =
273  dynamic_cast<const PropertyWithValue<TYPE>*> ( &source ) ;
274  if ( p ) { return setValue ( p->value() ) ; } // RETURN
275  // 2) Else use the string representation
276  return this->fromString( source.toString() ).isSuccess() ;
277 }
278 // ============================================================================
280 // ============================================================================
281 template <class TYPE>
282 inline bool
284 {
285  // delegate to the 'opposite' method ;
286  return dest.assign( *this ) ;
287 }
288 // ============================================================================
290 // ============================================================================
291 template <class TYPE>
292 inline std::string
294 {
295  useReadHandler();
296  return Gaudi::Utils::toString( *m_value ) ;
297 }
298 // ============================================================================
300 // ============================================================================
301 template <class TYPE>
302 inline void
304 {
305  useReadHandler();
306  Gaudi::Utils::toStream( *m_value, out ) ;
307 }
308 // ============================================================================
310 // ============================================================================
311 template <class TYPE>
312 inline StatusCode
314 {
315  TYPE tmp ;
316  StatusCode sc = Gaudi::Parsers::parse ( tmp , source ) ;
317  if ( sc.isFailure() ) { return sc ; }
318  return setValue ( tmp ) ? StatusCode::SUCCESS : StatusCode::FAILURE ;
319 }
320 // ============================================================================
322 // ============================================================================
323 template <>
324 inline std::string
326 {
327  useReadHandler();
328  return this->value() ;
329 }
330 // ============================================================================
331 template <>
333 { return this->fromString( source.toString() ).isSuccess() ; }
334 // ============================================================================
335 
336 // ============================================================================
338 // ============================================================================
339 template <class TYPE>
340 inline const TYPE&
342 { useReadHandler() ; return *m_value ; }
343 // ============================================================================
344 // assignment operator
345 // ============================================================================
346 template <class TYPE>
348 ( const PropertyWithValue& right )
349 {
350  // assign the base class
351  Property::operator=( right ) ;
352  // assign the value
354  return *this ;
355 }
356 // ============================================================================
357 // templated assignment operator
358 // ============================================================================
359 template <class TYPE>
360 template <class OTHER>
361 PropertyWithValue<TYPE>& PropertyWithValue<TYPE>::operator=
362 ( const PropertyWithValue<OTHER>& right )
363 {
364  // assign the base class
365  Property::operator=( right ) ;
366  // assign the value
368  return *this ;
369 }
370 // ============================================================================
371 
372 // ============================================================================
380 // ============================================================================
381 template<class TYPE,class VERIFIER>
383  : public PropertyWithValue<TYPE>
384 {
385 protected:
386  // ==========================================================================
389  ( std::string name ,
391  const bool owner ,
392  const VERIFIER& verifier )
393  : PropertyWithValue<TYPE> ( std::move(name) , value , owner )
394  , m_verifier ( verifier )
395  {}
397  ~PropertyWithVerifier() override = default;
398  // ==========================================================================
399 public:
400  // ==========================================================================
401  inline VERIFIER& verifier() { return m_verifier ; }
402  inline const VERIFIER& verifier() const { return m_verifier ; }
404  bool set( const TYPE& value ) ;
406  bool setValue( const TYPE& value ) override { return set( value ) ; }
408  template <class OTHER,class OTHERVERIFIER>
409  PropertyWithVerifier& operator=
412  template <class OTHER>
415  PropertyWithVerifier& operator=( const TYPE& right ) ;
416  // ==========================================================================
417 private:
418  // ==========================================================================
422  // ==========================================================================
423 private:
424  // ==========================================================================
426  VERIFIER m_verifier ; // the verifier itself
427  // ==========================================================================
428 } ;
429 // ============================================================================
431 // ============================================================================
432 template <class TYPE,class VERIFIER>
433 inline bool
435 {
437  if ( !m_verifier.isValid( &value ) ) { return false ; }
439  this->i_set( value ) ;
441  return this->useUpdateHandler() ;
442 }
443 // ============================================================================
445 // ============================================================================
446 template <class TYPE,class VERIFIER>
449 {
451  return *this ;
452 }
453 // ============================================================================
455 // ============================================================================
456 template <class TYPE,class VERIFIER>
457 template <class OTHER>
460 {
462  return *this ;
463 }
464 // ============================================================================
466 // ============================================================================
467 template <class TYPE,class VERIFIER>
468 template <class OTHER,class OTHERVERIFIER>
472 {
474  return *this ;
475 }
476 // ============================================================================
477 
478 // ============================================================================
488 // ============================================================================
489 template <class TYPE,class VERIFIER = BoundedVerifier<TYPE> >
490 class SimpleProperty
491  : public PropertyWithVerifier<TYPE,VERIFIER>
492 {
493 protected:
494  // ==========================================================================
496  // ==========================================================================
497 public:
498  // ==========================================================================
501  ( VERIFIER verifier = VERIFIER() ) ;
504  ( const TYPE& value ,
505  VERIFIER verifier = VERIFIER() ) ;
508  ( std::string name ,
509  const TYPE& value ,
510  VERIFIER verifier = VERIFIER() ) ;
512  template <class OTHER>
513  SimpleProperty ( const PropertyWithValue<OTHER>& right ) ;
515  SimpleProperty ( const SimpleProperty& right ) ;
517  ~SimpleProperty() override = default;
519  SimpleProperty* clone() const override;
521  SimpleProperty& operator=( const TYPE& value ) ;
523  template <class OTHER>
525  // ==========================================================================
526 };
527 // ============================================================================
529 // ============================================================================
530 template <class TYPE,class VERIFIER>
532 ( VERIFIER verifier )
534 ( "" , Traits::new_() , true , verifier )
535 {}
536 // ============================================================================
538 // ============================================================================
539 template <class TYPE,class VERIFIER>
541 ( const TYPE& value ,
542  VERIFIER verifier )
544 ( "" , Traits::new_(value) , true , verifier )
545 {}
546 // ============================================================================
548 // ============================================================================
549 template <class TYPE,class VERIFIER>
551 ( std::string name ,
552  const TYPE& value ,
553  VERIFIER verifier )
555 ( std::move(name) , Traits::new_(value) , true , verifier )
556 {}
557 // ============================================================================
559 // ============================================================================
560 template <class TYPE,class VERIFIER>
561 template <class OTHER>
563 ( const PropertyWithValue<OTHER>& right )
565 ( right.name() , Traits::new_( right.value() ) , true , VERIFIER() )
566 {}
567 // ============================================================================
569 // ============================================================================
570 template <class TYPE,class VERIFIER>
572 ( const SimpleProperty& right )
574 ( right.name() , Traits::new_( right.value() ) , true , right.verifier() )
575 {}
576 // ============================================================================
578 // ============================================================================
579 template <class TYPE,class VERIFIER>
580 inline
583 { return new SimpleProperty(*this) ; }
584 // ============================================================================
586 // ============================================================================
587 template <class TYPE,class VERIFIER>
588 inline
591 {
593  return *this ;
594 }
595 // ============================================================================
597 // ============================================================================
598 template <class TYPE,class VERIFIER>
599 template <class OTHER>
600 inline
603 ( const PropertyWithValue<OTHER>& right )
604 {
606  return *this ;
607 }
608 // ============================================================================
609 
610 // ============================================================================
619 // ============================================================================
620 template< class TYPE, class VERIFIER = NullVerifier<TYPE> >
621 class SimplePropertyRef :
622  public PropertyWithVerifier<TYPE,VERIFIER>
623 {
624 public:
627  ( std::string name ,
628  TYPE& value ,
629  VERIFIER verifier = VERIFIER() ) ;
631  SimplePropertyRef ( const SimplePropertyRef& right ) ;
633  ~SimplePropertyRef() override = default;
635  SimplePropertyRef* clone() const override;
637  SimplePropertyRef& operator=( const TYPE& value ) ;
639  template <class OTHER>
641 private:
642  // the default constructor is disabled
644 };
645 // ============================================================================
647 // ============================================================================
648 template <class TYPE,class VERIFIER>
650 ( std::string name ,
651  TYPE& value ,
652  VERIFIER verifier )
653  : PropertyWithVerifier<TYPE,VERIFIER> ( std::move(name) , &value , false , verifier )
654 {}
655 // ============================================================================
657 // ============================================================================
658 template <class TYPE,class VERIFIER>
660 ( const SimplePropertyRef& right )
662 ( right.name() , right.i_get() , false , right.verifier() )
663 {}
664 // ============================================================================
666 // ============================================================================
667 template <class TYPE,class VERIFIER>
668 inline
671 { return new SimplePropertyRef(*this) ; }
672 // ============================================================================
674 // ============================================================================
675 template <class TYPE,class VERIFIER>
676 inline
679 {
681  return *this ;
682 }
683 // ============================================================================
685 // ============================================================================
686 template <class TYPE,class VERIFIER>
687 template <class OTHER>
688 inline
691 ( const PropertyWithValue<OTHER>& right )
692 {
694  return *this ;
695 }
696 // ============================================================================
697 
698 
699 
700 
701 // Typedef Properties for built-in types
717 
719 
720 
721 // Typedef PropertyRefs for built-in types
737 
739 
740 
741 // Typedef "Arrays" of Properties for built-in types
757 
759 
760 
761 // Typedef "Arrays" of PropertyRefs for built-in types
777 
779 
780 // pre-declaration is sufficient here
781 class GaudiHandleBase;
782 
784 public:
786 
788 
789  GaudiHandleProperty* clone() const override;
790 
791  bool load( Property& destination ) const override;
792 
793  bool assign( const Property& source ) override;
794 
795  std::string toString() const override;
796 
797  void toStream(std::ostream& out) const override;
798 
799  StatusCode fromString(const std::string& s) override;
800 
801  const GaudiHandleBase& value() const;
802 
803  bool setValue( const GaudiHandleBase& value );
804 
805 private:
809 };
810 
811 // implementation in header file only where the GaudiHandleBase class
812 // definition is not needed. The rest goes into the .cpp file.
813 // The goal is to decouple the header files, to avoid that the whole
814 // world depends on GaudiHandle.h
816  setValue( value );
817  return *this;
818 }
819 
821  return new GaudiHandleProperty( *this );
822 }
823 
824 inline bool GaudiHandleProperty::load( Property& destination ) const {
825  return destination.assign( *this );
826 }
827 
828 inline bool GaudiHandleProperty::assign( const Property& source ) {
829  return fromString( source.toString() ).isSuccess();
830 }
831 
833  useReadHandler();
834  return *m_pValue;
835 }
836 
837 
838 // pre-declaration is sufficient here
840 
842 public:
843 
845 
847 
848  GaudiHandleArrayProperty* clone() const override;
849 
850  bool load( Property& destination ) const override;
851 
852  bool assign( const Property& source ) override;
853 
854  std::string toString() const override;
855 
856  void toStream(std::ostream& out) const override;
857 
858  StatusCode fromString(const std::string& s) override;
859 
860  const GaudiHandleArrayBase& value() const;
861 
862  bool setValue( const GaudiHandleArrayBase& value );
863 
864 private:
868 
869 };
870 
871 // implementation in header file only where the GaudiHandleBase class
872 // definition is not needed. The rest goes into the .cpp file.
873 // The goal is to decouple the header files, to avoid that the whole
874 // world depends on GaudiHandle.h
876  setValue( value );
877  return *this;
878 }
879 
881  return new GaudiHandleArrayProperty( *this );
882 }
883 
884 inline bool GaudiHandleArrayProperty::load( Property& destination ) const {
885  return destination.assign( *this );
886 }
887 
888 inline bool GaudiHandleArrayProperty::assign( const Property& source ) {
889  return fromString( source.toString() ) != 0;
890 }
891 
893  useReadHandler();
894  return *m_pValue;
895 }
896 
897 
898 namespace Gaudi
899 {
900  namespace Utils
901  {
902  // ========================================================================
920  GAUDI_API bool hasProperty ( const IProperty* p , const std::string& name ) ;
921  // ========================================================================
939  GAUDI_API bool hasProperty ( const IInterface* p , const std::string& name ) ;
940  // ========================================================================
959  ( const IProperty* p , const std::string& name ) ;
960  // ========================================================================
979  ( const IInterface* p , const std::string& name ) ;
980  // ========================================================================
1003  GAUDI_API bool hasProperty
1004  ( const std::vector<const Property*>* p ,
1005  const std::string& name ) ;
1006  // ========================================================================
1030  ( const std::vector<const Property*>* p ,
1031  const std::string& name ) ;
1032  // ========================================================================
1056  template <class TYPE>
1058  ( IProperty* component ,
1059  const std::string& name ,
1060  const TYPE& value ,
1061  const std::string& doc ) ;
1062  // ========================================================================
1085  template <class TYPE>
1087  ( IProperty* component ,
1088  const std::string& name ,
1089  const TYPE& value )
1090  { return setProperty ( component , name , value , std::string() ) ; }
1091  // ========================================================================
1106  ( IProperty* component ,
1107  const std::string& name ,
1108  const std::string& value ,
1109  const std::string& doc = "" ) ;
1110  // ========================================================================
1125  ( IProperty* component ,
1126  const std::string& name ,
1127  const char* value ,
1128  const std::string& doc = "" ) ;
1129  // ========================================================================
1143  template <unsigned N>
1145  ( IProperty* component ,
1146  const std::string& name ,
1147  const char (&value)[N] ,
1148  const std::string& doc = "" )
1149  {
1150  return component ? setProperty ( component , name ,
1151  std::string ( value , value + N ), doc )
1153  }
1154  // ========================================================================
1185  template <class TYPE>
1187  ( IProperty* component ,
1188  const std::string& name ,
1189  const TYPE& value ,
1190  const std::string& doc )
1191  {
1192  return component && hasProperty(component,name) ?
1193  Gaudi::Utils::setProperty ( component , name ,
1194  Gaudi::Utils::toString ( value ) , doc ) :
1196  }
1197  // ========================================================================
1220  ( IProperty* component ,
1221  const std::string& name ,
1222  const Property* property ,
1223  const std::string& doc = "" ) ;
1224  // ========================================================================
1247  ( IProperty* component ,
1248  const std::string& name ,
1249  const Property& property ,
1250  const std::string& doc = "" ) ;
1251  // ========================================================================
1274  template <class TYPE>
1276  ( IProperty* component ,
1277  const std::string& name ,
1278  const SimpleProperty<TYPE>& value ,
1279  const std::string& doc = "" )
1280  {
1281  return setProperty ( component , name , &value , doc ) ;
1282  }
1283  // ========================================================================
1304  template <class TYPE>
1306  ( IInterface* component ,
1307  const std::string& name ,
1308  const TYPE& value ,
1309  const std::string& doc = "" )
1310  {
1311  if ( !component ) { return StatusCode::FAILURE ; }
1312  auto property = SmartIF<IProperty>{ component } ;
1313  return property ? setProperty ( property , name , value , doc )
1315  }
1316  // ========================================================================
1330  ( IInterface* component ,
1331  const std::string& name ,
1332  const std::string& value ,
1333  const std::string& doc = "" ) ;
1334  // ========================================================================
1348  ( IInterface* component ,
1349  const std::string& name ,
1350  const char* value ,
1351  const std::string& doc = "" ) ;
1352  // ========================================================================
1366  template <unsigned N>
1368  ( IInterface* component ,
1369  const std::string& name ,
1370  const char (&value)[N] ,
1371  const std::string& doc = "" )
1372  {
1373  if ( 0 == component ) { return StatusCode::FAILURE ; }
1374  return setProperty ( component , name ,
1375  std::string{ value , value + N }, doc ) ;
1376  }
1377  // ========================================================================
1400  ( IInterface* component ,
1401  const std::string& name ,
1402  const Property* property ,
1403  const std::string& doc = "" ) ;
1404  // ========================================================================
1427  ( IInterface* component ,
1428  const std::string& name ,
1429  const Property& property ,
1430  const std::string& doc = "" ) ;
1431  // ========================================================================
1454  template <class TYPE>
1455  StatusCode
1456  setProperty
1457  ( IInterface* component ,
1458  const std::string& name ,
1459  const SimpleProperty<TYPE>& value ,
1460  const std::string& doc = "" )
1461  {
1462  return setProperty ( component , name , &value , doc ) ;
1463  }
1464  // ========================================================================
1465  } // end of namespace Gaudi::Utils
1466 } // end of namespace Gaudi
1467 
1468 
1469 // ============================================================================
1470 // The END
1471 // ============================================================================
1472 #endif // GAUDIKERNEL_PROPERTY_H
1473 // ============================================================================
SimplePropertyRef< unsigned int > UnsignedIntegerPropertyRef
Definition: Property.h:729
SimplePropertyRef< float > FloatPropertyRef
Definition: Property.h:734
SimpleProperty< std::vector< int > > IntegerArrayProperty
Definition: Property.h:748
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
Definition: Property.h:815
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:1187
const GaudiHandleArrayBase & value() const
Definition: Property.h:892
SimpleProperty< std::vector< char > > CharArrayProperty
Definition: Property.h:743
SimplePropertyRef< long long > LongLongPropertyRef
Definition: Property.h:732
std::string m_documentation
Definition: Property.h:115
helper structure to define the types for properties
bool load(Property &destination) const override
export the property value to the destination
Definition: Property.h:824
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
GaudiHandleArrayProperty * clone() const override
clone: "virtual constructor"
Definition: Property.h:880
SimplePropertyRef< unsigned short > UnsignedShortPropertyRef
Definition: Property.h:727
PropertyWithValue(std::string name, PVal value, const bool owner)
the constructor with property name and value
Definition: Property.h:213
SimplePropertyRef< char > CharPropertyRef
Definition: Property.h:723
PVal i_get() const
get the value
Definition: Property.h:194
bool setValue(const GaudiHandleArrayBase &value)
Definition: Property.cpp:206
virtual bool assign(const Property &source)=0
import the property value form the source
const std::function< void(Property &)> & updateCallBack() const
get a reference to the updateCallBack
Definition: Property.h:67
~PropertyWithValue() override
virtual destructor
Definition: Property.h:249
PropertyWithValue & operator=(const TYPE &value)
assignment operator
Definition: Property.h:258
GAUDI_API std::ostream & operator<<(std::ostream &stream, const Property &prop)
The output operator for friendly printout.
Definition: Property.cpp:32
SimpleProperty< std::vector< long > > LongArrayProperty
Definition: Property.h:750
SimplePropertyRef< std::vector< unsigned int > > UnsignedIntegerArrayPropertyRef
Definition: Property.h:769
virtual std::string toString() const =0
value -> string
SimplePropertyRef< double > DoublePropertyRef
Definition: Property.h:735
SimpleProperty & operator=(const TYPE &value)
assignment form the value
Definition: Property.h:590
SimplePropertyRef templated class.
Definition: HistoProperty.h:14
const std::string & name() const
property name
Definition: Property.h:45
virtual bool setValue(const TYPE &value)=0
NB: abstract : to be implemented when verifier is available.
SimplePropertyRef< std::vector< double > > DoubleArrayPropertyRef
Definition: Property.h:775
PropertyWithVerifier()
the default & copy constructors are deleted
Helper intermediate class which represent partly implemented property with value of concrete type and...
Definition: Property.h:382
SimpleProperty< std::vector< bool > > BooleanArrayProperty
Definition: Property.h:742
GaudiHandleProperty * clone() const override
clone: "virtual constructor"
Definition: Property.h:820
bool assign(const Property &source) override
import the property value form the source
Definition: Property.h:888
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
SimplePropertyRef< std::vector< char > > CharArrayPropertyRef
Definition: Property.h:763
StatusCode fromString(const std::string &s) override
string -> value
Definition: Property.cpp:191
SimplePropertyRef< std::vector< long long > > LongLongArrayPropertyRef
Definition: Property.h:772
GAUDI_API bool hasProperty(const IProperty *p, const std::string &name)
simple function which check the existence of the property with the given name.
Definition: Property.cpp:159
SimplePropertyRef< std::vector< unsigned long long > > UnsignedLongLongArrayPropertyRef
Definition: Property.h:773
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:371
void setDocumentation(std::string documentation)
set the documentation string
Definition: Property.h:94
~SimplePropertyRef() override=default
virtual Destructor
SimpleProperty< std::vector< unsigned int > > UnsignedIntegerArrayProperty
Definition: Property.h:749
SimplePropertyRef & operator=(const TYPE &value)
assignment form the value
Definition: Property.h:678
SimplePropertyRef< std::vector< unsigned long > > UnsignedLongArrayPropertyRef
Definition: Property.h:771
SimplePropertyRef< std::vector< float > > FloatArrayPropertyRef
Definition: Property.h:774
bool setValue(const TYPE &value) override
implementation of PropertyWithValue::setValue
Definition: Property.h:406
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
const std::function< void(Property &)> & readCallBack() const
get a reference to the readCallBack
Definition: Property.h:65
Property & declareUpdateHandler(void(HT::*MF)(Property &), HT *instance)
Definition: Property.h:79
bool set(const TYPE &value)
update the value of the property/check the verifier
Definition: Property.h:434
virtual bool load(Property &dest) const =0
export the property value to the destination
SimplePropertyRef< std::vector< short > > ShortArrayPropertyRef
Definition: Property.h:766
SimplePropertyRef< std::vector< long double > > LongDoubleArrayPropertyRef
Definition: Property.h:776
GAUDI_API Property * getProperty(const IProperty *p, const std::string &name)
simple function which gets the property with given name from the component
Definition: Property.cpp:278
PropertyWithVerifier & operator=(const PropertyWithVerifier< OTHER, OTHERVERIFIER > &right)
templated assignment
SimpleProperty< bool > BooleanProperty
Definition: Property.h:702
const std::string & documentation() const
property documentation
Definition: Property.h:47
Gaudi::Utils::PropertyTypeTraits< TYPE > Traits
the type-traits for properties
Definition: Property.h:139
SimpleProperty< std::vector< signed char > > SignedCharArrayProperty
Definition: Property.h:744
bool assign(const Property &source) override
import the property value form the source
Definition: Property.h:828
SimplePropertyRef< bool > BooleanPropertyRef
Definition: Property.h:722
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
SimpleProperty< char > CharProperty
Definition: Property.h:703
SimpleProperty< std::string > StringProperty
Definition: Property.h:718
SimpleProperty< std::vector< float > > FloatArrayProperty
Definition: Property.h:754
STL class.
SimpleProperty< std::vector< unsigned char > > UnsignedCharArrayProperty
Definition: Property.h:745
SimpleProperty concrete class which implements the full Property interface.
Definition: HistoProperty.h:13
PVal m_value
the actual property value
Definition: Property.h:201
SimpleProperty< long double > LongDoubleProperty
Definition: Property.h:716
std::string type() const
property type
Definition: Property.h:51
SimplePropertyRef< std::vector< signed char > > SignedCharArrayPropertyRef
Definition: Property.h:764
SimpleProperty< unsigned long > UnsignedLongProperty
Definition: Property.h:711
int N
Definition: IOTest.py:90
GaudiHandleBase * m_pValue
Pointer to the real property.
Definition: Property.h:808
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:319
SimplePropertyRef< long > LongPropertyRef
Definition: Property.h:730
GaudiHandleProperty(std::string name, GaudiHandleBase &ref)
Definition: Property.cpp:170
string type
Definition: gaudirun.py:151
SimplePropertyRef< std::vector< unsigned short > > UnsignedShortArrayPropertyRef
Definition: Property.h:767
SimpleProperty< long long > LongLongProperty
Definition: Property.h:712
Helper intermediate class which represent partly implemented property with value of concrete type...
Definition: Property.h:134
SimpleProperty< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
Definition: Property.h:753
SimplePropertyRef< unsigned long > UnsignedLongPropertyRef
Definition: Property.h:731
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::string toString() const override
value -> string
Definition: Property.h:293
SimplePropertyRef< std::vector< unsigned char > > UnsignedCharArrayPropertyRef
Definition: Property.h:765
Definition of the basic interface.
Definition: IInterface.h:234
SimpleProperty< std::vector< std::string > > StringArrayProperty
Definition: Property.h:758
SimpleProperty< std::vector< short > > ShortArrayProperty
Definition: Property.h:746
GaudiHandleArrayProperty(std::string name, GaudiHandleArrayBase &ref)
Definition: Property.cpp:200
string dest
Definition: gaudirun.py:162
void i_set(const TYPE &value)
set the value
Definition: Property.h:190
SimpleProperty< unsigned short > UnsignedShortProperty
Definition: Property.h:707
const VERIFIER & verifier() const
Definition: Property.h:402
SimpleProperty< unsigned char > UnsignedCharProperty
Definition: Property.h:705
VERIFIER & verifier()
Definition: Property.h:401
~SimpleProperty() override=default
virtual Destructor
SimpleProperty< long > LongProperty
Definition: Property.h:710
SimplePropertyRef< std::vector< int > > IntegerArrayPropertyRef
Definition: Property.h:768
Property & declareReadHandler(void(HT::*MF)(Property &), HT *instance)
Definition: Property.h:75
Gaudi::Utils::PropertyTypeTraits< TYPE > Traits
Definition: Property.h:495
SimpleProperty< int > IntegerProperty
Definition: Property.h:708
SimpleProperty< float > FloatProperty
Definition: Property.h:714
T move(T...args)
const TYPE & value() const
explicit conversion
Definition: Property.h:341
SimpleProperty * clone() const override
implementation of Property::clone
Definition: Property.h:582
std::string m_name
Definition: Property.h:113
std::function< void(Property &)> m_readCallBack
Definition: Property.h:120
StatusCode fromString(const std::string &s) override
string -> value
Definition: Property.cpp:223
Property & operator=(const Property &)=default
assignment operator
SimplePropertyRef< std::vector< long > > LongArrayPropertyRef
Definition: Property.h:770
SimpleProperty(VERIFIER verifier=VERIFIER())
"Almost default" constructor from verifier
Definition: Property.h:532
Base class of array's of various gaudihandles.
Definition: GaudiHandle.h:320
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
bool assign(const Property &source) override
get the value from another property
Definition: Property.h:269
STL class.
SimplePropertyRef< std::vector< std::string > > StringArrayPropertyRef
Definition: Property.h:778
StatusCode fromString(const std::string &s) override
string -> value
Definition: Property.h:313
SimplePropertyRef< unsigned long long > UnsignedLongLongPropertyRef
Definition: Property.h:733
bool m_own
owner of the storage
Definition: Property.h:203
SimplePropertyRef< int > IntegerPropertyRef
Definition: Property.h:728
VERIFIER m_verifier
the verifier itself
Definition: Property.h:426
SimpleProperty< std::vector< long long > > LongLongArrayProperty
Definition: Property.h:752
void setName(std::string value)
set the new value for the property name
Definition: Property.h:92
SimplePropertyRef * clone() const override
implementation of Property::clone
Definition: Property.h:670
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
Definition: Property.h:875
void toStream(std::ostream &out) const override
value -> stream
Definition: Property.h:303
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Definition: Property.h:867
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
std::function< void(Property &)> m_updateCallBack
Definition: Property.h:122
const GaudiHandleBase & value() const
Definition: Property.h:832
SimpleProperty< std::vector< double > > DoubleArrayProperty
Definition: Property.h:755
string s
Definition: gaudirun.py:245
SimpleProperty< unsigned long long > UnsignedLongLongProperty
Definition: Property.h:713
SimpleProperty< std::vector< long double > > LongDoubleArrayProperty
Definition: Property.h:756
bool load(Property &destination) const override
export the property value to the destination
Definition: Property.h:884
const std::type_info * type_info() const
property type-info
Definition: Property.h:49
SimpleProperty< unsigned int > UnsignedIntegerProperty
Definition: Property.h:709
bool load(Property &dest) const override
set value for another property
Definition: Property.h:283
SimpleProperty< double > DoubleProperty
Definition: Property.h:715
SimplePropertyRef< unsigned char > UnsignedCharPropertyRef
Definition: Property.h:725
SimpleProperty< std::vector< unsigned short > > UnsignedShortArrayProperty
Definition: Property.h:747
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
Definition: GaudiHandle.h:93
SimpleProperty< std::vector< unsigned long > > UnsignedLongArrayProperty
Definition: Property.h:751
implementation of various functions for streaming.
const std::type_info * m_typeinfo
Definition: Property.h:117
SimpleProperty< short > ShortProperty
Definition: Property.h:706
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
SimplePropertyRef< short > ShortPropertyRef
Definition: Property.h:726
Traits::PVal PVal
the actual storage type
Definition: Property.h:141
#define GAUDI_API
Definition: Kernel.h:107
virtual Property * clone() const =0
clone: "virtual constructor"
STL class.
~PropertyWithVerifier() override=default
virtual destructor
Helper functions to set/get the application return code.
Definition: __init__.py:1
SimplePropertyRef< long double > LongDoublePropertyRef
Definition: Property.h:736
SimplePropertyRef< std::vector< bool > > BooleanArrayPropertyRef
Definition: Property.h:762
bool setValue(const GaudiHandleBase &value)
Definition: Property.cpp:176
SimplePropertyRef< std::string > StringPropertyRef
Definition: Property.h:738
virtual void toStream(std::ostream &out) const =0
value -> stream
SimplePropertyRef< signed char > SignedCharPropertyRef
Definition: Property.h:724
SimpleProperty< signed char > SignedCharProperty
Definition: Property.h:704
virtual StatusCode fromString(const std::string &value)=0
string -> value