17 #ifndef mitkFloatPropertySerializer_h_included
18 #define mitkFloatPropertySerializer_h_included
28 class FloatPropertySerializer :
public BasePropertySerializer
32 itkFactorylessNewMacro(Self) itkCloneMacro(Self)
34 virtual TiXmlElement *Serialize()
override
36 if (
const FloatProperty *prop = dynamic_cast<const FloatProperty *>(m_Property.GetPointer()))
38 LocaleSwitch localeSwitch(
"C");
40 auto element =
new TiXmlElement(
"float");
41 element->SetAttribute(
"value", boost::lexical_cast<std::string>(prop->GetValue()));
53 LocaleSwitch localeSwitch(
"C");
56 if (element->QueryStringAttribute(
"value", &f_string) == TIXML_SUCCESS)
62 catch (boost::bad_lexical_cast &e)
64 MITK_ERROR <<
"Could not parse string as number: " << e.what();
75 FloatPropertySerializer() {}
76 virtual ~FloatPropertySerializer() {}
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
#define mitkClassMacro(className, SuperClassName)
MITK_REGISTER_SERIALIZER(FloatPropertySerializer)