13 #ifndef mitkFloatPropertySerializer_h_included 14 #define mitkFloatPropertySerializer_h_included 24 class FloatPropertySerializer :
public BasePropertySerializer
28 itkFactorylessNewMacro(Self) itkCloneMacro(Self)
30 TiXmlElement *Serialize()
override 32 if (
const FloatProperty *prop = dynamic_cast<const FloatProperty *>(m_Property.GetPointer()))
34 LocaleSwitch localeSwitch(
"C");
36 auto element =
new TiXmlElement(
"float");
37 element->SetAttribute(
"value", boost::lexical_cast<std::string>(prop->GetValue()));
49 LocaleSwitch localeSwitch(
"C");
52 if (element->QueryStringAttribute(
"value", &f_string) == TIXML_SUCCESS)
58 catch (boost::bad_lexical_cast &e)
60 MITK_ERROR <<
"Could not parse string as number: " << e.what();
71 FloatPropertySerializer() {}
72 ~FloatPropertySerializer()
override {}
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
#define mitkClassMacro(className, SuperClassName)
MITK_REGISTER_SERIALIZER(FloatPropertySerializer)