Go to the documentation of this file.
22 #include <string_view>
35 template <
class TYPE,
class VERIFIER = Details::Property::NullVerifier,
36 class HANDLERS = Details::Property::UpdateHandler>
56 template <
class T = StorageType>
64 template <std::derived_from<IProperty> OWNER,
typename T = ValueType>
67 owner->declareProperty( *
this );
68 setOwnerType<OWNER>();
73 template <std::derived_from<IProperty> OWNER,
class T = StorageType>
76 owner->declareProperty( *
this );
77 setOwnerType<OWNER>();
82 template <std::derived_from<IProperty> OWNER,
class T = StorageType>
91 template <std::derived_from<IProperty> OWNER,
class T = StorageType>
100 template <std::derived_from<IProperty> OWNER,
class T = StorageType>
110 template <std::derived_from<IProperty> OWNER,
class T = StorageType>
121 template <
typename T>
127 template <
typename T = StorageType>
171 template <
typename Dummy = TYPE>
172 requires( std::is_constructible_v<std::string_view, Dummy> )
173 operator std::string_view()
const {
181 if constexpr ( std::is_same_v<ValueType, std::string> ) {
190 operator std::string_view()
const {
215 decltype(
auto ) operator+( const T& other )
const {
220 template <
class T = ValueType>
250 template <
class T = const ValueType>
251 decltype(
auto )
size()
const {
252 return value().size();
254 template <class T = const ValueType, typename = decltype( std::declval<const T>().length() )>
255 decltype(
auto ) length()
const {
256 return value().length();
258 template <
class T = const ValueType>
259 decltype(
auto ) empty()
const {
260 return value().empty();
262 template <
class T = ValueType>
263 decltype(
auto ) clear() {
266 template <class T = const ValueType, typename = decltype( std::declval<const T>().begin() )>
267 decltype(
auto )
begin()
const {
268 return value().begin();
270 template <
class T = const ValueType>
271 decltype(
auto )
end()
const {
272 return value().end();
274 template <class T = ValueType, typename = decltype( std::declval<T>().begin() )>
275 decltype(
auto )
begin() {
276 return value().begin();
278 template <
class T = ValueType>
279 decltype(
auto )
end() {
280 return value().end();
283 decltype(
auto ) operator[]( const ARG& arg )
const {
287 decltype(
auto ) operator[]( const ARG& arg ) {
290 template <
class T = const ValueType>
291 decltype(
auto ) find( const typename T::key_type&
key )
const {
294 template <
class T = ValueType>
295 decltype(
auto ) find( const typename T::key_type&
key ) {
298 template <
class ARG,
class T = ValueType>
299 decltype(
auto ) erase( ARG arg ) {
300 return value().erase( arg );
302 template <
class = ValueType>
307 template <
class = ValueType>
311 template <
class = ValueType>
316 template <
class = ValueType>
320 template <
class T = ValueType>
325 template <
class T = ValueType>
331 template <
class T = const ValueType>
332 decltype(
auto )
key()
const {
333 return value().key();
335 template <
class T = const ValueType>
336 decltype(
auto ) objKey()
const {
337 return value().objKey();
339 template <
class T = const ValueType>
340 decltype(
auto ) fullKey()
const {
341 return value().fullKey();
343 template <
class T = ValueType>
344 decltype(
auto ) initialize() {
345 return value().initialize();
347 template <
class T = ValueType>
348 decltype(
auto ) makeHandles()
const {
349 return value().makeHandles();
351 template <
class ARG,
class T = ValueType>
352 decltype(
auto ) makeHandles( const ARG& arg )
const {
353 return value().makeHandles( arg );
359 template <
class... Args>
360 decltype( std::declval<ValueType>()( std::declval<Args&&>()... ) ) operator()( Args&&...
args ) const
361 noexcept( noexcept(
std::declval<
ValueType>()(
std::declval<Args&&>()... ) ) ) {
362 return value()( std::forward<Args>(
args )... );
370 ( std::is_same_v<ValueType, std::string> ) ?
nullptr :
dynamic_cast<const Property*
>( &source );
381 return dest.assign( *
this );
393 "Cannot convert '" + source +
"' for property '" +
name() +
"' in class '" +
ownerTypeName() +
"'";
395 case ParsingErrorPolicy::Ignore:
397 case ParsingErrorPolicy::Exception:
400 case ParsingErrorPolicy::Warning:
401 std::cerr <<
"WARNING: " << errMsg <<
"': " << err.
what() <<
'\n';
403 case ParsingErrorPolicy::Abort:
404 std::cerr <<
"FATAL: " << errMsg <<
"': " << err.
what() <<
'\n';
425 template <
class T,
class TP,
class V,
class H>
427 return p.operator==(
v );
431 template <
class T,
class TP,
class V,
class H>
433 return p.operator!=(
v );
437 template <
class T,
class TP,
class V,
class H>
438 decltype(
auto ) operator+( const T&
v, const
Property<TP, V, H>& p ) {
439 return v + p.value();
442 template <
class TYPE,
class HANDLERS = Details::Property::UpdateHandler>
445 template <
class TYPE>
451 template <
class TYPE>
454 template <
class TYPE>
535 template <
typename Handler =
typename Gaudi::Details::Property::UpdateHandler>
540 using PropertyBase::PropertyBase;
586 bool load( PropertyBase& destination )
const override {
return destination.assign( *
this ); }
623 bool load( PropertyBase& destination )
const override {
return destination.assign( *
this ); }
797 template <
class TYPE>
822 template <
class TYPE>
872 template <
unsigned N>
908 template <
class TYPE>
986 template <
class TYPE>
1012 template <
class TYPE>
1063 template <
unsigned N>
1140 template <
class TYPE>
VerifierType & verifier()
Accessor to verifier.
Gaudi::Property< unsigned long & > UnsignedLongPropertyRef
Property(OWNER *owner, std::string name, T &&value, std::function< void(PropertyBase &)> handler, std::string doc="", std::string semantics="")
Autodeclaring constructor with property name, value, updateHandler and documentation.
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Property & operator-=(const T &other)
const std::function< void(PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Gaudi::Property< signed char & > SignedCharPropertyRef
constexpr auto size(const T &, Args &&...) noexcept
Gaudi::Property< int & > IntegerPropertyRef
bool load(PropertyBase &destination) const override
GaudiHandleBase * m_pValue
Pointer to the real property.
Gaudi::Property< std::vector< std::string > > StringArrayProperty
const GaudiHandleArrayBase & value() const
PropertyBase & operator=(const PropertyBase &)=default
assignment operator
Gaudi::Property< std::vector< char > & > CharArrayPropertyRef
const std::function< void(Details::PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
Gaudi::Property< std::vector< unsigned short > & > UnsignedShortArrayPropertyRef
ValueType operator++(int)
Gaudi::Property< std::vector< unsigned long long > & > UnsignedLongLongArrayPropertyRef
Gaudi::Property< std::vector< char > > CharArrayProperty
Gaudi::Property< short & > ShortPropertyRef
bool operator==(const T &v, const Property< TP, V, H > &p)
delegate (value == property) to property operator==
const VerifierType & verifier() const
Accessor to verifier.
Gaudi::Property< unsigned long long & > UnsignedLongLongPropertyRef
Gaudi::Property< long & > LongPropertyRef
Gaudi::Property< unsigned int > UnsignedIntegerProperty
Gaudi::Property< std::vector< std::string > & > StringArrayPropertyRef
requires(!std::is_same_v< Property, std::remove_reference_t< T >>) Property(T &&v)
Construct an anonymous property from a value.
Gaudi::Property< std::vector< unsigned char > & > UnsignedCharArrayPropertyRef
Gaudi::Property< unsigned int & > UnsignedIntegerPropertyRef
Gaudi::Property< std::vector< signed char > > SignedCharArrayProperty
Gaudi::Property< long double & > LongDoublePropertyRef
Details::PropertyBase * clone() const override
clones the current property
Gaudi::Property< double > DoubleProperty
Gaudi::Property< std::vector< double > > DoubleArrayProperty
bool assign(const Details::PropertyBase &source) override
get the value from another property
requires(std::is_default_constructible_v< T >) Property(OWNER *owner
Autodeclaring constructor with property name, value and documentation.
virtual void toStream(std::ostream &out) const =0
value -> stream
Gaudi::Property< unsigned char > UnsignedCharProperty
Gaudi::Property< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
bool load(Details::PropertyBase &dest) const override
set value to another property
virtual StatusCode fromString(const std::string &value)=0
string -> value
Gaudi::Property< short > ShortProperty
virtual PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for reading
Gaudi::Property< std::vector< long double > & > LongDoubleArrayPropertyRef
StatusCode fromString(const std::string &source) override
string -> value
bool setValue(const ValueType &v)
Gaudi::Property< std::vector< unsigned int > > UnsignedIntegerArrayProperty
Gaudi::Property< long > LongProperty
requires(!std::is_reference_v< T >) Property()
Construct an anonymous property with default constructed value.
Gaudi::Property< char & > CharPropertyRef
ValueType operator--(int)
PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun) override
set new callback for reading
AttribStringParser::Iterator begin(const AttribStringParser &parser)
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Gaudi::Property< float & > FloatPropertyRef
requires(std::is_constructible_v< std::string_view, Dummy >) operator std
Gaudi::Property< long long > LongLongProperty
Gaudi::Property< std::vector< float > > FloatArrayProperty
bool assign(const PropertyBase &source) override
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
Gaudi::Property< std::vector< bool > > BooleanArrayProperty
GAUDI_API Gaudi::Details::PropertyBase * getProperty(const IProperty *p, std::string_view name)
simple function which gets the property with given name from the component
Gaudi::Property< unsigned char & > UnsignedCharPropertyRef
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
const ValueType & value() const
PropertyBase(const std::type_info &type, std::string name="", std::string doc="", std::string semantics="")
constructor from the property name and the type
Property(OWNER *owner, std::string name, T &&value, std::function< void(PropertyBase &)> handler, Details::Property::ImmediatelyInvokeHandler invoke, std::string doc="", std::string semantics="")
Autodeclaring constructor with property name, value, updateHandler and documentation.
Property & operator+=(const T &other)
Gaudi::Property< std::vector< long > > LongArrayProperty
bool set(const ValueType &v)
Gaudi::Property< char > CharProperty
Gaudi::Property< std::vector< double > & > DoubleArrayPropertyRef
const GaudiHandleBase & value() const
Gaudi::Property< std::vector< unsigned short > > UnsignedShortArrayProperty
std::string semantics() const
property semantics
PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun) override
set new callback for update
bool useUpdateHandler() override
manual trigger for callback for update
ParsingErrorPolicy parsingErrorPolicy()
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Base class of array's of various gaudihandles.
GaudiHandleArrayProperty * clone() const override
clones the current property
Gaudi::Property< std::vector< short > > ShortArrayProperty
Gaudi::Property< unsigned short & > UnsignedShortPropertyRef
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
Gaudi::Property< long long & > LongLongPropertyRef
virtual PropertyBase & declareUpdateHandler(std::function< void(PropertyBase &)> fun)=0
set new callback for update
Gaudi::Property< std::vector< long long > > LongLongArrayProperty
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
void toStream(std::ostream &out) const override
value -> stream
Helper class to simplify the migration old properties deriving directly from PropertyBase.
Property(OWNER *owner, std::string name, T &&value, void(OWNER::*handler)(PropertyBase &), std::string doc="", std::string semantics="")
Autodeclaring constructor with property name, value, pointer to member function updateHandler and doc...
Gaudi::Property< float > FloatProperty
constexpr static const auto SUCCESS
Details::PropertyBase & declareReadHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for reading
const std::function< void(Details::PropertyBase &)> readCallBack() const override
get a reference to the readCallBack
Gaudi::Property< std::vector< long long > & > LongLongArrayPropertyRef
const std::function< void(PropertyBase &)> updateCallBack() const override
get a reference to the updateCallBack
StorageType m_value
Storage.
virtual std::string toString() const =0
value -> string
Gaudi::Property< bool > BooleanProperty
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
Gaudi::Property< std::vector< unsigned int > & > UnsignedIntegerArrayPropertyRef
bool useUpdateHandler() override
use the call-back function at update, if available
bool assign(const PropertyBase &source) override
Gaudi::Property< unsigned short > UnsignedShortProperty
Gaudi::Property< std::vector< unsigned long > & > UnsignedLongArrayPropertyRef
std::string toString() const override
value -> string
bool operator<(const Gaudi::Histo1DDef &left, const Gaudi::Histo1DDef &right)
Gaudi::Property< std::vector< float > & > FloatArrayPropertyRef
Gaudi::Property< std::vector< unsigned long > > UnsignedLongArrayProperty
GaudiHandleProperty * clone() const override
clones the current property
Property(std::string name, T &&value, std::string doc="", std::string semantics="")
the constructor with property name, value and documentation.
Gaudi::Property< unsigned long > UnsignedLongProperty
Property(OWNER *owner, std::string name, T &&value, std::string doc="", std::string semantics="")
Autodeclaring constructor with property name, value and documentation.
Gaudi::Property< std::vector< unsigned char > > UnsignedCharArrayProperty
Gaudi::Property< signed char > SignedCharProperty
Gaudi::Property< std::vector< int > > IntegerArrayProperty
constexpr static const auto FAILURE
Gaudi::Property< long double > LongDoubleProperty
std::string ownerTypeName() const
get the string for the type of the owner class (used for documentation)
bool operator!=(const T &v, const Property< TP, V, H > &p)
delegate (value != property) to property operator!=
Gaudi::Property< std::vector< long double > > LongDoubleArrayProperty
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
Gaudi::Property< unsigned long long > UnsignedLongLongProperty
bool load(PropertyBase &destination) const override
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Property(OWNER *owner, std::string name, T &&value, void(OWNER::*handler)(), std::string doc="", std::string semantics="")
Autodeclaring constructor with property name, value, pointer to member function updateHandler and doc...
void useReadHandler() const
use the call-back function at reading, if available
typename std::remove_reference< StorageType >::type ValueType
Gaudi::Property< std::vector< long > & > LongArrayPropertyRef
Implementation of property with value of concrete type.
GAUDI_API bool hasProperty(const IProperty *p, std::string_view name)
simple function which check the existence of the property with the given name.
Gaudi::Property< std::vector< bool > & > BooleanArrayPropertyRef
Gaudi::Property< std::vector< int > & > IntegerArrayPropertyRef
Gaudi::Property< int > IntegerProperty
Gaudi::Property< std::string > StringProperty
Gaudi::Property< std::vector< signed char > & > SignedCharArrayPropertyRef
Gaudi::Property< std::string & > StringPropertyRef
Gaudi::Property< double & > DoublePropertyRef
Gaudi::Property< bool & > BooleanPropertyRef
Gaudi::Property< std::vector< short > & > ShortArrayPropertyRef