8#include <boost/algorithm/string.hpp>
17 std::string typeName = parameterElement->getChildElement(
"Type")->innerText();
19 throw std::runtime_error(std::string(
"AffineMatrixParameterParser cannot parse parameter of type: " + typeName));
22 using VecStrings = std::vector<std::string>;
23 using VecDoubles = std::vector<coord_t>;
25 std::string sParameterValue = parameterElement->getChildElement(
"Value")->innerText();
27 VecStrings vecStrRows;
28 VecStrings vecStrCols;
30 boost::split(vecStrRows, sParameterValue, boost::is_any_of(
";"));
31 size_t nRows = vecStrRows.size();
33 auto row_it = vecStrRows.begin();
34 VecStrings::iterator col_it;
40 while (row_it != vecStrRows.end()) {
41 boost::split(vecStrCols, *row_it, boost::is_any_of(
","));
42 nCols = vecStrCols.size();
43 col_it = vecStrCols.begin();
44 while (col_it != vecStrCols.end()) {
46 elements.emplace_back(val);
55 for (
size_t i = 0; i < nRows; i++) {
56 for (
size_t j = 0; j < nCols; j++) {
64 parameter->setMatrix(
m);
74 throw std::runtime_error(
"Cannot set a successor parser on a AffineMatrixParameterParser");
AffineMatrixParameter * createParameter(Poco::XML::Element *parameterElement) override
Creates the parameter by reading the xml given.
AffineMatrixParameterParser()
Constructor.
void setSuccessorParser(ImplicitFunctionParameterParser *) override
Set a successor parser for chain-of-responsibility type reading.
Type to wrap an affine matrix and allow serialization via xml.
static std::string parameterName()
Gets the type parameter name.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...