Rationalize property values serialization and deserialization
While trying to use a custom property looking like
using MyPropType = std::vector<SomeValueType>;
std::ostream& operator<<(std::ostream& s, const SomeValueType& v) {
return s << "value[" << ... << "]";
}
class MyAlg: ... {
Gaudi::Property<MyPropType> m_prop{...};
}
I wanted to represent it in Python as a vector of strings so I used Gaudi::Details::Property::StringConverter
template specializations to control how the default values of the property was serialized for configurables, but I realized that genconf
serializes anything that is not explicitly handles using PropertyBase::toStream
(and commenting that it is a list) instead of PropertyBase::toString
.
In a normal case this is not a problem as by default toString
is implemented in terms of toStream
, and it is not a problem in my case as the default value an empty list, but in general terms there is an inconsistency.
What I think we need (as already mentioned a few times) is a Python-like separation between conversion to string (for printing) and representation (as a mean of serializing the value to valid Python code).