14#include <boost/algorithm/string.hpp>
22namespace MDAlgorithms {
30template <
class VectorValueParameterType>
33 VectorValueParameterType *parseVectorParameter(std::string
value);
42template <
typename VectorValueParameterType>
44 std::vector<std::string> strs;
45 boost::split(strs,
value, boost::is_any_of(
","));
49 nx = std::stod(strs.at(0));
50 ny = std::stod(strs.at(1));
51 nz = std::stod(strs.at(2));
52 }
catch (std::exception &ex) {
54 std::string(ex.what()) +
" Failed to parse " + VectorValueParameterType::parameterName() +
" value: " +
value;
55 throw std::invalid_argument(message.c_str());
57 return new VectorValueParameterType(nx, ny, nz);
60template <
typename VectorValueParameterType>
63 std::string typeName = parameterElement->getChildElement(
"Type")->innerText();
64 if (VectorValueParameterType::parameterName() != typeName) {
65 return m_successor->createParameter(parameterElement);
67 std::string sParameterValue = parameterElement->getChildElement(
"Value")->innerText();
68 return parseVectorParameter(sParameterValue);
72template <
typename VectorValueParameterType>
76 m_successor.swap(temp);
double value
The value of the point.
boost::interprocess::unique_ptr< ImplicitFunctionParameterParser, DeleterPolicy< ImplicitFunctionParameterParser > > SuccessorType
Successor type.
Abstract parameter type for use with IImplicitFunctions.
XML parser for vector value (3 elements) parameter types.
VectorValueParameterType * parseVectorParameter(std::string value)
Mantid::API::ImplicitFunctionParameter * createParameter(Poco::XML::Element *parameterElement) override
void setSuccessorParser(Mantid::API::ImplicitFunctionParameterParser *paramParser) override
Helper class which provides the Collimation Length for SANS instruments.