14 #ifndef DD4HEP_DDG4_COMPONENTPROPERTIES_H
15 #define DD4HEP_DDG4_COMPONENTPROPERTIES_H
31 class PropertyGrammar;
43 virtual void set(
const PropertyGrammar& setter,
const std::string&,
const std::string&,
void* ptr)
const = 0;
63 static void invalidConversion(
const std::type_info& from,
const std::type_info& to);
65 static void invalidConversion(
const std::string& value,
const std::type_info& to);
67 virtual const std::type_info&
type()
const;
69 virtual std::string
str(
const void* ptr)
const;
71 virtual bool fromString(
void* ptr,
const std::string& value)
const;
94 template <
typename TYPE>
void make(TYPE&
value);
107 static std::string
type(
const std::type_info& proptery);
111 std::string
type()
const;
115 std::string
str()
const;
127 template <
typename TYPE> TYPE
value()
const;
129 template <
typename TYPE>
void value(TYPE&
value)
const;
131 template <
typename TYPE>
void set(
const TYPE&
value);
158 template <
typename T>
T value()
const {
return this->Property::value<T>();}
160 template <
typename T>
185 Properties::const_iterator
verifyExistence(
const std::string& name)
const;
193 bool exists(
const std::string& name)
const;
205 template <
typename T>
void add(
const std::string& name,
T& value) {
211 template <
typename FUNCTOR>
void for_each(FUNCTOR& func) {
250 template <
typename T>
256 template <
typename T>
262 #endif // DD4HEP_DDG4_COMPONENTPROPERTIES_H
void make(TYPE &value)
Setup property.
void add(const std::string &name, const Property &property)
Add a new property.
virtual const std::type_info & type() const
Access to the type information.
Property & operator[](const std::string &name)
Access property by name.
The property class to assign options to actions.
virtual ~PropertyManager()
Default destructor.
void value(TYPE &val) const
Retrieve value from stack with data conversion (large values e.g. vectors etc.)
const PropertyGrammar & grammar() const
Access grammar object.
void dump() const
Dump string values.
PropertyConfigurable()
Standard constructor.
virtual bool fromString(void *ptr, const std::string &value) const
Set value from serialized string. On successful data conversion TRUE is returned. ...
std::string type() const
Property type name.
Class describing the grammar representation of a given data type.
Property object as base class for all objects supporting properties.
Property(TYPE &val)
User constructor.
const BasicGrammar & m_grammar
std::string str() const
Conversion to string value.
void adopt(const PropertyManager ©)
Export properties of another instance.
Base class describing string evaluation to C++ objects using boost::spirit.
std::string str() const
Conversion to string value.
Concrete template instantiation of a combined property value pair.
PropertyValue()
Default constructor.
const Property & property(const std::string &name) const
Access property by name (CONST)
void set(const std::string &component_name, PropertyConfigurator &setup)
Bulk set of all properties.
Properties m_properties
Property array/map.
void declareProperty(const std::string &nam, T &val)
Declare property.
virtual void set(const PropertyGrammar &setter, const std::string &, const std::string &, void *ptr) const =0
bool hasProperty(const std::string &name) const
Check property for existence.
static void invalidConversion(const std::type_info &from, const std::type_info &to)
Error callback on invalid conversion.
void set(const T &val)
Set value of this property with data conversion.
virtual ~PropertyConfigurator()
const PropertyGrammar * m_hdl
Reference to the grammar of this property (extended type description)
Properties::iterator verifyExistence(const std::string &name)
Verify that this property exists (throw exception if the name was not found)
PropertyGrammar(const BasicGrammar &g)
Default constructor.
Property & operator=(const Property &p)=default
Assignment operator.
void for_each(FUNCTOR &func)
Apply functor on properties.
void verifyNonExistence(const std::string &name) const
Verify that this property does not exist (throw exception if the name was found)
PropertyValue & operator=(const PropertyValue &c)=default
Assignment operator.
const PropertyGrammar & grammar() const
Access grammar object.
T value() const
Retrieve value with data conversion.
TYPE value() const
Retrieve value.
Heler class to configure properties.
bool exists(const std::string &name) const
Check for existence.
bool operator==(const TYPE &val) const
Equality operator.
Property & property(const std::string &name)
Access single property.
std::map< std::string, Property > Properties
Property array definition.
PropertyManager m_properties
Property pool.
virtual ~PropertyConfigurable()
Default destructor.
virtual ~PropertyGrammar()
Default destructor.
void * m_par
Pointer to the data location.
void * ptr() const
Access void data pointer.
PropertyManager()
Default constructor.
virtual std::string str(const void *ptr) const
Serialize an opaque value to a string.
PropertyValue & operator=(const TYPE &val)
Assignment operator.
void set(const TYPE &value)
Set value of this property.
Property()=default
Default constructor.
Manager to ease the handling of groups of properties.
void add(const std::string &name, T &value)
Add a new property.
PropertyManager & properties()
Access to the properties of the object.