The Gaudi Framework  v36r6 (b1ee9983)
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS > Class Template Reference

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/CArrayAsProperty.h>

Inheritance diagram for Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >:
Collaboration diagram for Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >:

Public Types

using StorageType = TYPE(&)[N]
 Hosted type. More...
 
using ValueType = typename std::remove_reference< StorageType >::type
 
using VerifierType = VERIFIER
 
using HandlersType = HANDLERS
 

Public Member Functions

 Property (std::string name, StorageType value, std::string doc="")
 the constructor with property name, value and documentation. More...
 
PropertyBasedeclareReadHandler (std::function< void(PropertyBase &)> fun) override
 set new callback for reading More...
 
PropertyBasedeclareUpdateHandler (std::function< void(PropertyBase &)> fun) override
 set new callback for update More...
 
const std::function< void(PropertyBase &)> readCallBack () const override
 get a reference to the readCallBack More...
 
const std::function< void(PropertyBase &)> updateCallBack () const override
 get a reference to the updateCallBack More...
 
bool useUpdateHandler () override
 manual trigger for callback for update More...
 
 operator const ValueType & () const
 Automatic conversion to value (const reference). More...
 
Propertyoperator= (const ValueType &v)
 Assignment from value. More...
 
const VerifierTypeverifier () const
 Copy constructor. More...
 
VerifierTypeverifier ()
 Accessor to verifier. More...
 
bool assign (const PropertyBase &source) override
 get the value from another property More...
 
bool load (PropertyBase &dest) const override
 set value to another property More...
 
StatusCode fromString (const std::string &source) override
 string -> value More...
 
std::string toString () const override
 value -> string More...
 
void toStream (std::ostream &out) const override
 value -> stream More...
 
const ValueTypevalue () const
 Backward compatibility. More...
 
ValueTypevalue ()
 
bool setValue (const ValueType &v)
 
bool set (const ValueType &v)
 
PropertyBaseclone () const override
 clones the current property More...
 
Helpers for easy use of string and vector properties.

They are instantiated only if they are implemented in the wrapped class.

size_t size () const
 
bool empty () const
 
- Public Member Functions inherited from Gaudi::Details::PropertyBase
const std::string name () const
 property name More...
 
std::string documentation () const
 property documentation More...
 
std::string semantics () const
 property semantics More...
 
const std::type_infotype_info () const
 property type-info More...
 
std::string type () const
 property type More...
 
virtual bool load (PropertyBase &dest) const =0
 export the property value to the destination More...
 
virtual bool assign (const PropertyBase &source)=0
 import the property value form the source More...
 
virtual PropertyBasedeclareReadHandler (std::function< void(PropertyBase &)> fun)=0
 set new callback for reading More...
 
virtual PropertyBasedeclareUpdateHandler (std::function< void(PropertyBase &)> fun)=0
 set new callback for update More...
 
template<class HT >
PropertyBasedeclareReadHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
template<class HT >
PropertyBasedeclareUpdateHandler (void(HT::*MF)(PropertyBase &), HT *instance)
 
virtual ~PropertyBase ()
 virtual destructor More...
 
void setName (std::string value)
 set the new value for the property name More...
 
void setDocumentation (std::string value)
 set the documentation string More...
 
void setSemantics (std::string value)
 set the semantics string More...
 
virtual std::ostreamfillStream (std::ostream &) const
 the printout of the property value More...
 
void setOwnerType (const std::type_info &ownerType)
 set the type of the owner class (used for documentation) More...
 
template<class OWNER >
void setOwnerType ()
 set the type of the owner class (used for documentation) More...
 
const std::type_infoownerType () const
 get the type of the owner class (used for documentation) More...
 
std::string ownerTypeName () const
 get the string for the type of the owner class (used for documentation) More...
 

Private Attributes

StorageType m_value
 Storage. More...
 
VerifierType m_verifier
 
HandlersType m_handlers
 
template<class T >
using not_copying = std::enable_if<!is_this_type_v< T > >
 
template<class T >
static constexpr bool is_this_type_v = std::is_same_v<Property, typename std::remove_reference_t<T>>
 helper typedefs for SFINAE More...
 

Additional Inherited Members

- Protected Member Functions inherited from Gaudi::Details::PropertyBase
 PropertyBase (const std::type_info &type, std::string name="", std::string doc="", std::string semantics="")
 constructor from the property name and the type More...
 
 PropertyBase (std::string name, const std::type_info &type)
 constructor from the property name and the type More...
 
 PropertyBase (const PropertyBase &)=default
 copy constructor More...
 
PropertyBaseoperator= (const PropertyBase &)=default
 assignment operator More...
 

Detailed Description

template<class TYPE, size_t N, class VERIFIER, class HANDLERS>
class Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >

Definition at line 20 of file CArrayAsProperty.h.

Member Typedef Documentation

◆ HandlersType

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
using Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::HandlersType = HANDLERS

Definition at line 27 of file CArrayAsProperty.h.

◆ not_copying

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
template<class T >
using Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::not_copying = std::enable_if<!is_this_type_v<T> >
private

Definition at line 39 of file CArrayAsProperty.h.

◆ StorageType

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
using Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::StorageType = TYPE ( & )[N]

Hosted type.

Definition at line 24 of file CArrayAsProperty.h.

◆ ValueType

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
using Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::ValueType = typename std::remove_reference<StorageType>::type

Definition at line 25 of file CArrayAsProperty.h.

◆ VerifierType

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
using Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::VerifierType = VERIFIER

Definition at line 26 of file CArrayAsProperty.h.

Constructor & Destructor Documentation

◆ Property()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::Property ( std::string  name,
StorageType  value,
std::string  doc = "" 
)
inline

the constructor with property name, value and documentation.

Definition at line 44 of file CArrayAsProperty.h.

45  : PropertyBase( typeid( ValueType ), std::move( name ), std::move( doc ) ), m_value( value ) {
47  }

Member Function Documentation

◆ assign()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
bool Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::assign ( const PropertyBase source)
inlineoverride

get the value from another property

Definition at line 134 of file CArrayAsProperty.h.

134  {
135  // Is the property of "the same" type?
136  const Property* p = dynamic_cast<const Property*>( &source );
137  if ( p ) {
138  *this = p->value();
139  } else {
140  this->fromString( source.toString() ).ignore();
141  }
142  return true;
143  }

◆ clone()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
PropertyBase* Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::clone ( ) const
inlineoverridevirtual

clones the current property

Implements Gaudi::Details::PropertyBase.

Definition at line 114 of file CArrayAsProperty.h.

114 { return new Property( *this ); }

◆ declareReadHandler()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
PropertyBase& Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::declareReadHandler ( std::function< void(PropertyBase &)>  fun)
inlineoverride

set new callback for reading

Definition at line 53 of file CArrayAsProperty.h.

53  {
54  m_handlers.setReadHandler( std::move( fun ) );
55  return *this;
56  }

◆ declareUpdateHandler()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
PropertyBase& Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::declareUpdateHandler ( std::function< void(PropertyBase &)>  fun)
inlineoverride

set new callback for update

Definition at line 58 of file CArrayAsProperty.h.

58  {
59  m_handlers.setUpdateHandler( std::move( fun ) );
60  return *this;
61  }

◆ empty()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
bool Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::empty ( ) const
inline

Definition at line 121 of file CArrayAsProperty.h.

121 { return false; }

◆ fromString()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
StatusCode Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::fromString ( const std::string source)
inlineoverridevirtual

string -> value

Implements Gaudi::Details::PropertyBase.

Definition at line 150 of file CArrayAsProperty.h.

150  {
151  ValueType tmp;
152  if ( Parsers::parse( tmp, source ).isSuccess() ) {
153  *this = tmp;
154  } else {
155  throw std::invalid_argument( "cannot parse '" + source + "' to " + this->type() );
156  }
157  return StatusCode::SUCCESS;
158  }

◆ load()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
bool Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::load ( PropertyBase dest) const
inlineoverride

set value to another property

Definition at line 145 of file CArrayAsProperty.h.

145  {
146  // delegate to the 'opposite' method
147  return dest.assign( *this );
148  }

◆ operator const ValueType &()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::operator const ValueType & ( ) const
inline

Automatic conversion to value (const reference).

Definition at line 75 of file CArrayAsProperty.h.

75  {
76  m_handlers.useReadHandler( *this );
77  return m_value;
78  }

◆ operator=()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
Property& Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::operator= ( const ValueType v)
inline

Assignment from value.

Definition at line 86 of file CArrayAsProperty.h.

86  {
87  m_verifier( v );
88  for ( size_t i = 0; i != N; ++i ) { m_value[i] = v[i]; }
89  m_handlers.useUpdateHandler( *this );
90  return *this;
91  }

◆ readCallBack()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
const std::function<void( PropertyBase& )> Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::readCallBack ( ) const
inlineoverridevirtual

get a reference to the readCallBack

Implements Gaudi::Details::PropertyBase.

Definition at line 64 of file CArrayAsProperty.h.

64 { return m_handlers.getReadHandler(); }

◆ set()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
bool Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::set ( const ValueType v)
inline

Definition at line 110 of file CArrayAsProperty.h.

110  {
111  *this = v;
112  return true;
113  }

◆ setValue()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
bool Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::setValue ( const ValueType v)
inline

Definition at line 106 of file CArrayAsProperty.h.

106  {
107  *this = v;
108  return true;
109  }

◆ size()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
size_t Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::size ( ) const
inline

Definition at line 120 of file CArrayAsProperty.h.

120 { return N; }

◆ toStream()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
void Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::toStream ( std::ostream out) const
inlineoverridevirtual

value -> stream

Implements Gaudi::Details::PropertyBase.

Definition at line 165 of file CArrayAsProperty.h.

165  {
166  m_handlers.useReadHandler( *this );
168  }

◆ toString()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
std::string Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::toString ( ) const
inlineoverridevirtual

value -> string

Implements Gaudi::Details::PropertyBase.

Definition at line 160 of file CArrayAsProperty.h.

160  {
161  m_handlers.useReadHandler( *this );
162  return Utils::toString( m_value );
163  }

◆ updateCallBack()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
const std::function<void( PropertyBase& )> Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::updateCallBack ( ) const
inlineoverridevirtual

get a reference to the updateCallBack

Implements Gaudi::Details::PropertyBase.

Definition at line 66 of file CArrayAsProperty.h.

66 { return m_handlers.getUpdateHandler(); }

◆ useUpdateHandler()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
bool Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::useUpdateHandler ( )
inlineoverridevirtual

manual trigger for callback for update

Implements Gaudi::Details::PropertyBase.

Definition at line 69 of file CArrayAsProperty.h.

69  {
70  m_handlers.useUpdateHandler( *this );
71  return true;
72  }

◆ value() [1/2]

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
ValueType& Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::value ( )
inline

Definition at line 105 of file CArrayAsProperty.h.

105 { return const_cast<ValueType&>( (const ValueType&)*this ); }

◆ value() [2/2]

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
const ValueType& Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::value ( ) const
inline

Backward compatibility.

Deprecated:
will be removed in v29r0

Definition at line 104 of file CArrayAsProperty.h.

104 { return *this; }

◆ verifier() [1/2]

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
VerifierType& Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::verifier ( )
inline

Accessor to verifier.

Definition at line 100 of file CArrayAsProperty.h.

100 { return m_verifier; }

◆ verifier() [2/2]

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
const VerifierType& Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::verifier ( ) const
inline

Copy constructor.

Accessor to verifier.

Definition at line 98 of file CArrayAsProperty.h.

98 { return m_verifier; }

Member Data Documentation

◆ is_this_type_v

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
template<class T >
constexpr bool Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::is_this_type_v = std::is_same_v<Property, typename std::remove_reference_t<T>>
inlinestaticconstexprprivate

helper typedefs for SFINAE

Definition at line 37 of file CArrayAsProperty.h.

◆ m_handlers

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
HandlersType Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
private

Definition at line 33 of file CArrayAsProperty.h.

◆ m_value

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
StorageType Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_value
private

Storage.

Definition at line 31 of file CArrayAsProperty.h.

◆ m_verifier

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >
VerifierType Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_verifier
private

Definition at line 32 of file CArrayAsProperty.h.


The documentation for this class was generated from the following file:
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:35
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: PropertyBase.h:39
std::move
T move(T... args)
Gaudi::Details::PropertyBase::type
std::string type() const
property type
Definition: PropertyBase.h:47
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: CArrayAsProperty.h:150
IOTest.N
int N
Definition: IOTest.py:115
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::Property
Property(std::string name, StorageType value, std::string doc="")
the constructor with property name, value and documentation.
Definition: CArrayAsProperty.h:44
Gaudi::Details::PropertyBase::PropertyBase
PropertyBase(const std::type_info &type, std::string name="", std::string doc="", std::string semantics="")
constructor from the property name and the type
Definition: PropertyBase.h:118
std::invalid_argument
STL class.
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:33
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: CArrayAsProperty.h:25
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::value
const ValueType & value() const
Backward compatibility.
Definition: CArrayAsProperty.h:104
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
gaudirun.dest
dest
Definition: gaudirun.py:224
HistoDumpEx.v
v
Definition: HistoDumpEx.py:27
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_verifier
VerifierType m_verifier
Definition: CArrayAsProperty.h:32
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:353
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Utils::toStream
std::ostream & toStream(ITERATOR first, ITERATOR last, std::ostream &s, const std::string &open, const std::string &close, const std::string &delim)
the helper function to print the sequence
Definition: ToStream.h:299
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:21
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_value
StorageType m_value
Storage.
Definition: CArrayAsProperty.h:31
PrepareBase.out
out
Definition: PrepareBase.py:20