| 114 | } |
| 115 | |
| 116 | bool IsValid() const |
| 117 | { |
| 118 | if (!BaseParameters::IsValid()) |
| 119 | return false; |
| 120 | |
| 121 | // Distance Table makes only sense with 2+ coordinates |
| 122 | if (coordinates.size() < 2) |
| 123 | return false; |
| 124 | |
| 125 | // 1/ The user is able to specify duplicates in srcs and dsts, in that case it's their fault |
| 126 | |
| 127 | // 2/ 0 <= index < len(locations) |
| 128 | const auto not_in_range = [this](const std::size_t x) { return x >= coordinates.size(); }; |
| 129 | |
| 130 | if (std::any_of(begin(sources), end(sources), not_in_range)) |
| 131 | return false; |
| 132 | |
| 133 | if (std::any_of(begin(destinations), end(destinations), not_in_range)) |
| 134 | return false; |
| 135 | |
| 136 | if (fallback_speed <= 0) |
| 137 | return false; |
| 138 | |
| 139 | if (scale_factor <= 0) |
| 140 | return false; |
| 141 | |
| 142 | return true; |
| 143 | } |
| 144 | }; |
| 145 | inline bool operator&(TableParameters::AnnotationsType lhs, TableParameters::AnnotationsType rhs) |
| 146 | { |