12#include "MantidAPI/DllConfig.h"
16#include <Poco/DOM/DOMParser.h>
17#include <Poco/DOM/Document.h>
18#include <Poco/DOM/Element.h>
19#include <Poco/DOM/NodeFilter.h>
20#include <Poco/DOM/NodeIterator.h>
21#include <Poco/DOM/NodeList.h>
25#include <boost/lexical_cast.hpp>
42template <
class VectorValueParameterType>
61template <
typename VectorValueParameterType>
63 std::vector<std::string> strs;
64 boost::split(strs, sValue, boost::is_any_of(
","));
66 auto product =
new VectorValueParameterType(strs.size());
67 using ValType =
typename VectorValueParameterType::ValueType;
69 for (
size_t i = 0; i < strs.size(); i++) {
70 boost::erase_all(strs[i],
" ");
71 ValType
value = boost::lexical_cast<ValType>(strs[i]);
72 product->addValue(i,
value);
82template <
typename VectorValueParameterType>
85 std::string typeName = parameterElement->getChildElement(
"Type")->innerText();
86 if (VectorValueParameterType::parameterName() != typeName) {
88 throw std::runtime_error(
"No successor ParameterParser!");
90 return m_successor->createParameter(parameterElement);
92 std::string sParameterValue = parameterElement->getChildElement(
"Value")->innerText();
93 return parseVectorParameter(sParameterValue);
103template <
class VectorValueParameterType>
104VectorValueParameterType *
106 std::string typeName = parameterElement->getChildElement(
"Type")->innerText();
107 if (VectorValueParameterType::parameterName() != typeName) {
108 throw std::runtime_error(
"The attempted ::createWithoutDelegation failed. "
109 "The type provided does not match this parser.");
111 std::string sParameterValue = parameterElement->getChildElement(
"Value")->innerText();
112 return parseVectorParameter(sParameterValue);
120template <
typename VectorValueParameterType>
124 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 (n elements) parameter types.
void setSuccessorParser(Mantid::API::ImplicitFunctionParameterParser *paramParser) override
VectorValueParameterType * createWithoutDelegation(Poco::XML::Element *parameterElement)
VectorValueParameterType * parseVectorParameter(std::string sValue)
Mantid::API::ImplicitFunctionParameter * createParameter(Poco::XML::Element *parameterElement) override
Helper class which provides the Collimation Length for SANS instruments.