13 #ifndef ML_PROPERTY_PERSISTENCE_H
14 #define ML_PROPERTY_PERSISTENCE_H
23 #include <boost/noncopyable.hpp>
28 #define DOT_TEMPLATE template
37 std::string
operator()(
const T& value)
const {
return StringConversion::writeToStdString(value); }
53 template<
typename Functor>
58 _functor(functor), _typeString(typeString), _applied(false) {};
65 _result = _functor.DOT_TEMPLATE operator()<
T>();
70 typename Functor::result_type
getResult()
const {
return _result; }
74 const std::string _typeString;
76 typename Functor::result_type _result;
82 FromStringFunctor(
const std::string& stringRepresentation) : _stringRepresentation(stringRepresentation) {};
87 bool success = StringConversion::readFromString(_stringRepresentation, value);
89 std::string err(
"Could not convert \"");
90 err += _stringRepresentation;
98 const std::string _stringRepresentation;
105 boost::mpl::for_each<PropertyValue::SupportedPropertyTypes>(boost::ref(visitor));
117 std::string valueString;
118 parent->readChild(valueString);
119 return fromString(valueString, parent->getLastReadChildName());
void operator()(const T &)
ApplyFunctorWithType(const Functor &functor, const std::string &typeString)
Functor::result_type getResult() const
bool functorWasApplied() const
FromStringFunctor(const std::string &stringRepresentation)
Class PropertyValue, which is used to hold properties of a given set of allowed types in typesafe way...
Class PropertyValue, which is used to hold properties of a given set of allowed types in typesafe way...
VisitorType::result_type apply(VisitorType &visitor)
std::string operator()(const T &value) const
std::string operator()(const T &) const
#define ML_BAD_PARAMETER
A bad/invalid parameter (or even an inappropriate image) has been passed to a module or an algorithm;...
PropertyValue fromString(const std::string &representation, const std::string &typeString)
PropertyValue readFromTree(TreeNode *parent)
void addToTree(TreeNode *parent, const PropertyValue &value)
#define VESSELGRAPH_END_NAMESPACE
#define VESSELGRAPH_BEGIN_NAMESPACE