| The Gaudi Framework v32r1 (f65d50dc)

Public Types | Public Member Functions | Private Attributes | List of all members
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS > Class Template Reference

`#include <GaudiKernel/CArrayAsProperty.h>`

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

## 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...
PropertyBase & | declareReadHandler (std::function< void(PropertyBase &)> fun) override
| set new callback for reading More...
PropertyBase & | declareUpdateHandler (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...
Property & | operator= (const ValueType &v)
| Assignment from value. More...
const VerifierType & | verifier () const
| Copy constructor. More...
VerifierType & | verifier ()
| 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 ValueType & | value () const
| Backward compatibility. More...
ValueType & | value ()
bool | setValue (const ValueType &v)
bool | set (const ValueType &v)
PropertyBase * | clone () 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...
const std::type_info * | type_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 PropertyBase & | declareReadHandler (std::function< void(PropertyBase &)> fun)=0
| set new callback for reading More...
virtual PropertyBase & | declareUpdateHandler (std::function< void(PropertyBase &)> fun)=0
| set new callback for update More...
template<class HT >
PropertyBase & | declareReadHandler (void(HT::*MF)(PropertyBase &), HT *instance)
template<class HT >
PropertyBase & | declareUpdateHandler (void(HT::*MF)(PropertyBase &), HT *instance)
virtual | ~PropertyBase ()=default
| 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...
virtual std::ostream & | fillStream (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_info * | ownerType () 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="")
| 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...
PropertyBase & | operator= (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 10 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 17 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 29 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 14 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 15 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 16 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 34 of file CArrayAsProperty.h.

35 : PropertyBase( typeid( ValueType ), std::move( name ), std::move( doc ) ), m_value( value ) {
36 m_verifier( m_value );
37 }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::value
const ValueType & value() const
Backward compatibility.
Definition: CArrayAsProperty.h:94
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_value
StorageType m_value
Storage.
Definition: CArrayAsProperty.h:21
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:36
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: CArrayAsProperty.h:15
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:111
std::move
T move(T... args)
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_verifier
VerifierType m_verifier
Definition: CArrayAsProperty.h:22

## 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 | ) |
| inline override

get the value from another property

Definition at line 124 of file CArrayAsProperty.h.

124 {
125 // Is the property of "the same" type?
126 const Property* p = dynamic_cast<const Property*>( &source );
127 if ( p ) {
128 *this = p->value();
129 } else {
130 this->fromString( source.toString() ).ignore();
131 }
132 return true;
133 }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::fromString
StatusCode fromString(const std::string &source) override
string -> value
Definition: CArrayAsProperty.h:140
Property
Gaudi::Details::PropertyBase Property
\fixme backward compatibility hack for old Property base class
Definition: PropertyFwd.h:25

## ◆ clone()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

PropertyBase* Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::clone | ( |  | ) | const
| inline override virtual

clones the current property

Implements Gaudi::Details::PropertyBase.

Definition at line 104 of file CArrayAsProperty.h.

104 { return new Property( *this ); }
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:34

## ◆ declareReadHandler()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

PropertyBase& Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::declareReadHandler | ( | std::function< void(PropertyBase &)> | fun | ) |
| inline override

set new callback for reading

Definition at line 43 of file CArrayAsProperty.h.

43 {
44 m_handlers.setReadHandler( std::move( fun ) );
45 return *this;
46 }
std::move
T move(T... args)
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:23

## ◆ declareUpdateHandler()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

PropertyBase& Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::declareUpdateHandler | ( | std::function< void(PropertyBase &)> | fun | ) |
| inline override

set new callback for update

Definition at line 48 of file CArrayAsProperty.h.

48 {
49 m_handlers.setUpdateHandler( std::move( fun ) );
50 return *this;
51 }
std::move
T move(T... args)
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:23

## ◆ empty()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

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

Definition at line 111 of file CArrayAsProperty.h.

111 { 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 | ) |
| inline override virtual

string -> value

Implements Gaudi::Details::PropertyBase.

Definition at line 140 of file CArrayAsProperty.h.

140 {
141 ValueType tmp;
142 if ( Parsers::parse( tmp, source ).isSuccess() ) {
143 *this = tmp;
144 } else {
145 throw std::invalid_argument( "cannot parse '" + source + "' to " + this->type() );
146 }
147 return StatusCode::SUCCESS;
148 }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: CArrayAsProperty.h:15
Gaudi::Details::PropertyBase::type
std::string type() const
property type
Definition: Property.h:42
std::invalid_argument
STL class.

## ◆ load()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

bool Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::load | ( | PropertyBase & | dest | ) | const
| inline override

set value to another property

Definition at line 135 of file CArrayAsProperty.h.

135 {
136 // delegate to the 'opposite' method
137 return dest.assign( *this );
138 }
gaudirun.dest
dest
Definition: gaudirun.py:201

## ◆ 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 65 of file CArrayAsProperty.h.

65 {
66 m_handlers.useReadHandler( *this );
67 return m_value;
68 }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_value
StorageType m_value
Storage.
Definition: CArrayAsProperty.h:21
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:23

## ◆ 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 76 of file CArrayAsProperty.h.

76 {
77 m_verifier( v );
78 for ( size_t i = 0; i != N; ++i ) { m_value[i] = v[i]; }
79 m_handlers.useUpdateHandler( *this );
80 return *this;
81 }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_value
StorageType m_value
Storage.
Definition: CArrayAsProperty.h:21
IOTest.N
int N
Definition: IOTest.py:99
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:23
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_verifier
VerifierType m_verifier
Definition: CArrayAsProperty.h:22

## ◆ readCallBack()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

const std::function<void( PropertyBase& )> Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::readCallBack | ( |  | ) | const
| inline override virtual

get a reference to the readCallBack

Implements Gaudi::Details::PropertyBase.

Definition at line 54 of file CArrayAsProperty.h.

54 { return m_handlers.getReadHandler(); }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:23

## ◆ 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 100 of file CArrayAsProperty.h.

100 {
101 *this = v;
102 return true;
103 }

## ◆ 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 96 of file CArrayAsProperty.h.

96 {
97 *this = v;
98 return true;
99 }

## ◆ 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 110 of file CArrayAsProperty.h.

110 { return N; }
IOTest.N
int N
Definition: IOTest.py:99

## ◆ toStream()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

void Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::toStream | ( | std::ostream & | out | ) | const
| inline override virtual

value -> stream

Implements Gaudi::Details::PropertyBase.

Definition at line 155 of file CArrayAsProperty.h.

155 {
156 m_handlers.useReadHandler( *this );
157 Utils::toStream( m_value, out );
158 }
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:284
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_value
StorageType m_value
Storage.
Definition: CArrayAsProperty.h:21
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:23

## ◆ toString()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

std::string Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::toString | ( |  | ) | const
| inline override virtual

value -> string

Implements Gaudi::Details::PropertyBase.

Definition at line 150 of file CArrayAsProperty.h.

150 {
151 m_handlers.useReadHandler( *this );
152 return Utils::toString( m_value );
153 }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_value
StorageType m_value
Storage.
Definition: CArrayAsProperty.h:21
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:334
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:23

## ◆ updateCallBack()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

const std::function<void( PropertyBase& )> Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::updateCallBack | ( |  | ) | const
| inline override virtual

get a reference to the updateCallBack

Implements Gaudi::Details::PropertyBase.

Definition at line 56 of file CArrayAsProperty.h.

56 { return m_handlers.getUpdateHandler(); }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:23

## ◆ useUpdateHandler()

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

bool Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::useUpdateHandler | ( |  | ) |
| inline override virtual

manual trigger for callback for update

Implements Gaudi::Details::PropertyBase.

Definition at line 59 of file CArrayAsProperty.h.

59 {
60 m_handlers.useUpdateHandler( *this );
61 return true;
62 }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_handlers
HandlersType m_handlers
Definition: CArrayAsProperty.h:23

## ◆ value() [1/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 94 of file CArrayAsProperty.h.

94 { return *this; }

## ◆ value() [2/2]

template<class TYPE , size_t N, class VERIFIER , class HANDLERS >

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

Definition at line 95 of file CArrayAsProperty.h.

95 { return const_cast<ValueType&>( (const ValueType&)*this ); }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::ValueType
typename std::remove_reference< StorageType >::type ValueType
Definition: CArrayAsProperty.h:15

## ◆ verifier() [1/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 88 of file CArrayAsProperty.h.

88 { return m_verifier; }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_verifier
VerifierType m_verifier
Definition: CArrayAsProperty.h:22

## ◆ verifier() [2/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 90 of file CArrayAsProperty.h.

90 { return m_verifier; }
Gaudi::Property< TYPE[N], VERIFIER, HANDLERS >::m_verifier
VerifierType m_verifier
Definition: CArrayAsProperty.h:22

## 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>>
| inline static private

helper typedefs for SFINAE

Definition at line 27 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 23 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 21 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 22 of file CArrayAsProperty.h.

The documentation for this class was generated from the following file:

- GaudiKernel/GaudiKernel/CArrayAsProperty.h