Go to the documentation of this file.
23 #include <string_view>
37 template <
class TYPE,
class VERIFIER = Details::Property::NullVerifier,
38 class HANDLERS = Details::Property::UpdateHandler>
57 static inline constexpr
bool is_this_type_v = std::is_same_v<Property, std::remove_reference_t<T>>;
64 template <
class T = StorageType>
72 template <
typename OWNER,
typename T = ValueType,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>,
73 typename = std::enable_if_t<std::is_default_constructible_v<T>>>
75 owner->declareProperty( *
this );
76 setOwnerType<OWNER>();
81 template <
class OWNER,
class T = StorageType,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
84 owner->declareProperty( *
this );
85 setOwnerType<OWNER>();
90 template <
class OWNER,
class T = StorageType,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
99 template <
class OWNER,
class T = StorageType,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
108 template <
class OWNER,
class T = StorageType,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
118 template <
class OWNER,
class T = StorageType,
typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
129 template <
typename T,
typename = not_copying<T>>
134 template <
typename T = StorageType,
typename = std::enable_if_t<!std::is_reference_v<T>>>
177 template <
typename Dummy = TYPE,
typename = std::enable_if_t<std::is_constructible_v<std::
string_view, Dummy>>>
178 operator std::string_view()
const {
186 if constexpr ( std::is_same_v<ValueType, std::string> ) {
195 operator std::string_view()
const {
220 decltype(
auto ) operator+( const T& other )
const {
225 template <
class T = ValueType>
256 template <
class T = const ValueType>
257 decltype(
auto )
size()
const {
258 return value().size();
260 template <
class T = const ValueType>
261 decltype(
auto ) length()
const {
262 return value().length();
264 template <
class T = const ValueType>
265 decltype(
auto ) empty()
const {
266 return value().empty();
268 template <
class T = ValueType>
269 decltype(
auto ) clear() {
272 template <
class T = const ValueType>
273 decltype(
auto )
begin()
const {
274 return value().begin();
276 template <
class T = const ValueType>
277 decltype(
auto )
end()
const {
278 return value().end();
280 template <
class T = ValueType>
281 decltype(
auto )
begin() {
282 return value().begin();
284 template <
class T = ValueType>
285 decltype(
auto )
end() {
286 return value().end();
289 decltype(
auto ) operator[]( const ARG& arg )
const {
293 decltype(
auto ) operator[]( const ARG& arg ) {
296 template <
class T = const ValueType>
297 decltype(
auto ) find( const typename T::key_type&
key )
const {
300 template <
class T = ValueType>
301 decltype(
auto ) find( const typename T::key_type&
key ) {
304 template <
class ARG,
class T = ValueType>
305 decltype(
auto ) erase( ARG arg ) {
306 return value().erase( arg );
308 template <
class = ValueType>
313 template <
class = ValueType>
317 template <
class = ValueType>
322 template <
class = ValueType>
326 template <
class T = ValueType>
331 template <
class T = ValueType>
337 template <
class T = const ValueType>
338 decltype(
auto )
key()
const {
339 return value().key();
341 template <
class T = const ValueType>
342 decltype(
auto ) objKey()
const {
343 return value().objKey();
345 template <
class T = const ValueType>
346 decltype(
auto ) fullKey()
const {
347 return value().fullKey();
349 template <
class T = ValueType>
350 decltype(
auto ) initialize() {
351 return value().initialize();
353 template <
class T = ValueType>
354 decltype(
auto ) makeHandles()
const {
355 return value().makeHandles();
357 template <
class ARG,
class T = ValueType>
358 decltype(
auto ) makeHandles( const ARG& arg )
const {
359 return value().makeHandles( arg );
365 template <
class... Args>
366 decltype( std::declval<ValueType>()( std::declval<Args&&>()... ) ) operator()( Args&&...
args ) const
367 noexcept( noexcept(
std::declval<
ValueType>()(
std::declval<Args&&>()... ) ) ) {
368 return value()( std::forward<Args>(
args )... );
376 ( std::is_same_v<ValueType, std::string> ) ?
nullptr :
dynamic_cast<const Property*
>( &source );
387 return dest.assign( *
this );
399 "Cannot convert '" + source +
"' for property '" +
name() +
"' in class '" +
ownerTypeName() +
"'";
401 case ParsingErrorPolicy::Ignore:
403 case ParsingErrorPolicy::Exception:
406 case ParsingErrorPolicy::Warning:
407 std::cerr <<
"WARNING: " << errMsg <<
"': " << err.
what() <<
'\n';
409 case ParsingErrorPolicy::Abort:
410 std::cerr <<
"FATAL: " << errMsg <<
"': " << err.
what() <<
'\n';
430 #if __cpp_impl_three_way_comparison < 201711
434 template <
class T,
class TP,
class V,
class H>
441 template <
class T,
class TP,
class V,
class H>
447 template <
class T,
class TP,
class V,
class H>
448 decltype(
auto ) operator+( const T&
v, const
Property<TP, V, H>& p ) {
449 return v + p.value();
452 template <
class TYPE,
class HANDLERS = Details::Property::UpdateHandler>
455 template <
class TYPE>
461 template <
class TYPE>
464 template <
class TYPE>
545 template <
typename Handler =
typename Gaudi::Details::Property::UpdateHandler>
550 using PropertyBase::PropertyBase;
596 bool load( PropertyBase& destination )
const override {
return destination.assign( *
this ); }
633 bool load( PropertyBase& destination )
const override {
return destination.assign( *
this ); }
807 template <
class TYPE>
832 template <
class TYPE>
882 template <
unsigned N>
918 template <
class TYPE>
996 template <
class TYPE>
1022 template <
class TYPE>
1073 template <
unsigned N>
1150 template <
class TYPE>
VerifierType & verifier()
Accessor to verifier.
Gaudi::Property< unsigned long & > UnsignedLongPropertyRef
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
const std::string name() const
property name
Property & operator=(T &&v)
Assignment from value.
Gaudi::Property< signed char & > SignedCharPropertyRef
bool operator==(const T &other) const
equality comparison
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
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
std::enable_if_t<!is_this_type_v< T > > not_copying
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
Gaudi::Property< std::vector< unsigned char > & > UnsignedCharArrayPropertyRef
Gaudi::Property< unsigned int & > UnsignedIntegerPropertyRef
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...
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
Property(T &&v)
Construct an anonymous property from a value.
Gaudi::Property< std::vector< double > > DoubleArrayProperty
bool assign(const Details::PropertyBase &source) override
get the value from another property
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
vector< std::string > StorageType
Hosted type.
Gaudi::Property< char & > CharPropertyRef
ValueType operator--(int)
PropertyBase & declareReadHandler(std::function< void(PropertyBase &)> fun) override
set new callback for reading
Gaudi::Property< float & > FloatPropertyRef
Gaudi::Property< long long > LongLongProperty
Gaudi::Property< std::vector< float > > FloatArrayProperty
double * begin(CLHEP::HepVector &v)
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
bool operator!=(const T &other) const
inequality comparison
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
const ValueType & value() const
Backward compatibility (.
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.
PropertyBase(const std::type_info &type, std::string name="", std::string doc="", std::string semantics="")
constructor from the property name and the type
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()
Header file for std:chrono::duration-based Counters.
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
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...
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.
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
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.
std::string toString() const override
value -> string
Gaudi::Property< std::vector< float > & > FloatArrayPropertyRef
bool operator<(const T &other) const
"less" comparison
Gaudi::Property< std::vector< unsigned long > > UnsignedLongArrayProperty
static constexpr bool is_this_type_v
helper typedefs for SFINAE
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.
Property(OWNER *owner, std::string name, T &&value, std::string doc="", std::string semantics="")
Autodeclaring constructor with property name, value and documentation.
Gaudi::Property< unsigned long > UnsignedLongProperty
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
Property(OWNER *owner, std::string name)
Autodeclaring constructor with property name, value and documentation.
bool load(PropertyBase &destination) const override
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
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
std::ostream & fillStream(std::ostream &stream) const override
Properly quote string properties when printing them.
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
Property()
Construct an anonymous property with default constructed value.