13 #ifndef mitkDoublePropertySerializer_h_included 14 #define mitkDoublePropertySerializer_h_included 27 class DoublePropertySerializer :
public BasePropertySerializer
31 itkFactorylessNewMacro(Self) itkCloneMacro(Self)
33 TiXmlElement *Serialize()
override 35 if (
const DoubleProperty *prop = dynamic_cast<const DoubleProperty *>(m_Property.GetPointer()))
37 LocaleSwitch localeSwitch(
"C");
39 auto element =
new TiXmlElement(
"double");
40 element->SetAttribute(
"value", boost::lexical_cast<std::string>(prop->GetValue()));
52 LocaleSwitch localeSwitch(
"C");
55 if (element->QueryStringAttribute(
"value", &d) == TIXML_SUCCESS)
61 catch (boost::bad_lexical_cast &e)
63 MITK_ERROR <<
"Could not parse string as number: " << e.what();
74 DoublePropertySerializer() {}
75 ~DoublePropertySerializer()
override {}
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
#define mitkClassMacro(className, SuperClassName)
MITK_REGISTER_SERIALIZER(DoublePropertySerializer)