| 59 | |
| 60 | |
| 61 | void FerryFilter::initialize() |
| 62 | { |
| 63 | std::vector<std::string> toNames; |
| 64 | for (auto& dim : m_dimSpec) |
| 65 | { |
| 66 | StringList s = Utils::split(dim, '='); |
| 67 | if (s.size() != 2) |
| 68 | throwError("Invalid dimension specified '" + dim + "'. Need " |
| 69 | "<from dimension>=><to dimension>. See documentation for " |
| 70 | "details."); |
| 71 | // Allow new '=>' syntax |
| 72 | if (s[1][0] == '>') |
| 73 | s[1].erase(s[1].begin()); |
| 74 | |
| 75 | Utils::trim(s[0]); |
| 76 | Utils::trim(s[1]); |
| 77 | if (s[0] == s[1]) |
| 78 | throwError("Can't ferry dimension '" + s[0] + "' to itself."); |
| 79 | if (Utils::contains(toNames, s[1])) |
| 80 | throwError("Can't ferry two source dimensions to the same " |
| 81 | "destination dimension."); |
| 82 | toNames.push_back(s[1]); |
| 83 | m_dims.emplace_back(s[0], s[1]); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | |
| 88 | void FerryFilter::addDimensions(PointLayoutPtr layout) |