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>
37template <
class VectorValueParameterType>
40 VectorValueParameterType *parseVectorParameter(std::string sValue);
44 VectorValueParameterType *createWithoutDelegation(Poco::XML::Element *parameterElement);
56template <
typename VectorValueParameterType>
58 std::vector<std::string> strs;
59 boost::split(strs, sValue, boost::is_any_of(
","));
61 auto product =
new VectorValueParameterType(strs.size());
62 using ValType =
typename VectorValueParameterType::ValueType;
64 for (
size_t i = 0; i < strs.size(); i++) {
65 boost::erase_all(strs[i],
" ");
66 ValType
value = boost::lexical_cast<ValType>(strs[i]);
67 product->addValue(i,
value);
77template <
typename VectorValueParameterType>
80 std::string typeName = parameterElement->getChildElement(
"Type")->innerText();
81 if (VectorValueParameterType::parameterName() != typeName) {
83 throw std::runtime_error(
"No successor ParameterParser!");
85 return m_successor->createParameter(parameterElement);
87 std::string sParameterValue = parameterElement->getChildElement(
"Value")->innerText();
88 return parseVectorParameter(sParameterValue);
98template <
class VectorValueParameterType>
99VectorValueParameterType *
101 std::string typeName = parameterElement->getChildElement(
"Type")->innerText();
102 if (VectorValueParameterType::parameterName() != typeName) {
103 throw std::runtime_error(
"The attempted ::createWithoutDelegation failed. "
104 "The type provided does not match this parser.");
106 std::string sParameterValue = parameterElement->getChildElement(
"Value")->innerText();
107 return parseVectorParameter(sParameterValue);
115template <
typename VectorValueParameterType>
119 m_successor.swap(temp);
double value
The value of the point.
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
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.