17 #ifndef mitkDoublePropertySerializer_h_included
18 #define mitkDoublePropertySerializer_h_included
23 #include <boost/lexical_cast.hpp>
31 class DoublePropertySerializer :
public BasePropertySerializer
35 itkFactorylessNewMacro(Self) itkCloneMacro(Self)
37 virtual TiXmlElement *Serialize()
override
39 if (
const DoubleProperty *prop = dynamic_cast<const DoubleProperty *>(m_Property.GetPointer()))
41 LocaleSwitch localeSwitch(
"C");
43 auto element =
new TiXmlElement(
"double");
44 element->SetAttribute(
"value", boost::lexical_cast<std::string>(prop->GetValue()));
56 LocaleSwitch localeSwitch(
"C");
59 if (element->QueryStringAttribute(
"value", &d) == TIXML_SUCCESS)
65 catch (boost::bad_lexical_cast &e)
67 MITK_ERROR <<
"Could not parse string as number: " << e.what();
78 DoublePropertySerializer() {}
79 virtual ~DoublePropertySerializer() {}
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
#define mitkClassMacro(className, SuperClassName)
MITK_REGISTER_SERIALIZER(DoublePropertySerializer)