26 using namespace DD4hep;
29 PropertyGrammar::PropertyGrammar(
const BasicGrammar&
g) : m_grammar(g) {
79 throw runtime_error(
"Attempt to access property grammar from invalid object.");
87 throw runtime_error(
"Attempt to access property grammar from invalid object.");
96 throw runtime_error(
"Attempt to access property grammar from invalid object.");
108 this->set < string > (val);
111 throw runtime_error(
"Attempt to set invalid string to property!");
139 throw runtime_error(
"The property:" + name +
" already exists for this component.");
147 throw runtime_error(
"PropertyManager: Unknown property:" + name);
155 throw runtime_error(
"PropertyManager: Unknown property:" + name);
196 printout(
ALWAYS,
"PropertyManager",
"Property %s = %s", (*i).first.c_str(), p.
str().c_str());
227 return os << result.
str();
250 #if defined(DD4HEP_HAVE_ALL_PARSERS)
254 #endif // DD4HEP_HAVE_ALL_PARSERS
272 #ifndef DD4HEP_PARSERS_NO_ROOT
273 #include "Math/Point3D.h"
274 #include "Math/Vector3D.h"
275 #include "Math/Vector4D.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.
virtual const std::type_info & type() const =0
Access to the type information.
void dump() const
Dump string values.
PropertyConfigurable()
Standard constructor.
virtual std::string str(const void *ptr) const =0
Serialize an opaque value to a string.
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.
const BasicGrammar & m_grammar
void adopt(const PropertyManager ©)
Export properties of another instance.
Base class describing string evaluation to C++ objects using boost::spirit.
std::string typeName(const std::type_info &type)
ABI information about type names.
std::string str() const
Conversion to string value.
static void invalidConversion(const std::type_info &from, const std::type_info &to)
Error callback on invalid conversion.
const Property & property(const std::string &name) const
Access property by name (CONST)
#define DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(x)
map< string, string > map_string_string
void set(const std::string &component_name, PropertyConfigurator &setup)
Bulk set of all properties.
Properties m_properties
Property array/map.
DD4HEP_DEFINE_PROPERTY_TYPE(map_string_int)
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.
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)
Property & operator=(const Property &p)=default
Assignment operator.
void verifyNonExistence(const std::string &name) const
Verify that this property does not exist (throw exception if the name was found)
virtual bool fromString(void *ptr, const std::string &value) const =0
Set value from serialized string. On successful data conversion TRUE is returned. ...
const PropertyGrammar & grammar() const
Access grammar object.
TYPE value() const
Retrieve value.
Heler class to configure properties.
bool exists(const std::string &name) const
Check for existence.
DD4HEP_DEFINE_PROPERTY_CONT(bool)
std::ostream & toStream(const Property &result, std::ostream &os)
int parse(Property &result, const std::string &input)
Property & property(const std::string &name)
Access single property.
PropertyManager m_properties
Property pool.
virtual ~PropertyConfigurable()
Default destructor.
virtual ~PropertyGrammar()
Default destructor.
map< string, int > map_string_int
void * m_par
Pointer to the data location.
void * ptr() const
Access void data pointer.
PropertyManager()
Default constructor.
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
virtual std::string str(const void *ptr) const
Serialize an opaque value to a string.
void set(const TYPE &value)
Set value of this property.
Manager to ease the handling of groups of properties.
PropertyManager & properties()
Access to the properties of the object.
DD4HEP_DEFINE_PROPERTY_U_CONT(int)