7 #ifndef __FWMEDDATACAMP_CAMP_MAPPER_HPP__ 8 #define __FWMEDDATACAMP_CAMP_MAPPER_HPP__ 10 #include <fwCamp/Mapper/ValueMapper.hpp> 12 #include <fwMedData/NavigationSeries.hpp> 14 #include <boost/algorithm/string.hpp> 20 struct ValueMapper< ::fwMedData::NavigationSeries::CoordinateType >
22 typedef ::fwMedData::NavigationSeries::CoordinateType ReturnType;
23 static const int type = camp::stringType;
24 static const std::string to(
const ReturnType& source)
28 std::string current = ::boost::lexical_cast<std::string>(source[0]);
32 current = ::boost::lexical_cast<std::string>(source[1]);
36 current = ::boost::lexical_cast<std::string>(source[2]);
43 static ReturnType from(
bool source)
45 CAMP_ERROR(camp::BadType(camp::boolType, camp::mapType<ReturnType>()));
47 static ReturnType from(
long source)
49 CAMP_ERROR(camp::BadType(camp::intType, camp::mapType<ReturnType>()));
51 static ReturnType from(
double source)
53 CAMP_ERROR(camp::BadType(camp::realType, camp::mapType<ReturnType>()));
55 static ReturnType from(
const camp::EnumObject& source)
57 CAMP_ERROR(camp::BadType(camp::enumType, camp::mapType<ReturnType>()));
59 static ReturnType from(
const camp::UserObject& source)
61 CAMP_ERROR(camp::BadType(camp::userType, camp::mapType<ReturnType>()));
63 static ReturnType from(
const std::string& source)
65 std::vector< std::string> result;
67 ::boost::split(result, source, ::boost::is_any_of(
";"));
69 if(result.size() >= 3)
71 coord[0] = ValueMapper<double>::from(result[0]);
72 coord[1] = ValueMapper<double>::from(result[1]);
73 coord[2] = ValueMapper<double>::from(result[2]);
77 OSLM_WARN(
"Invalid number of components: " << result.size());
#define OSLM_WARN(message)