| 34 | namespace { |
| 35 | |
| 36 | std::vector<ExecutionContext> fromStrings(std::vector<std::string> const& ctxs) { |
| 37 | std::vector<ExecutionContext> res; |
| 38 | for (auto const& ctx : ctxs) { |
| 39 | std::string c; |
| 40 | c.reserve(ctx.size()); |
| 41 | std::transform(ctx.begin(), ctx.end(), std::back_inserter(c), [](char c) { return std::tolower(c); }); |
| 42 | if (c == "all") { |
| 43 | res.push_back(ExecutionContext::Net2); |
| 44 | res.push_back(ExecutionContext::Simulation); |
| 45 | } else if (c == "simulation") { |
| 46 | res.push_back(ExecutionContext::Simulation); |
| 47 | } else if (c == "net2") { |
| 48 | res.push_back(ExecutionContext::Net2); |
| 49 | } else { |
| 50 | throw invalid_option_value(); |
| 51 | } |
| 52 | } |
| 53 | std::sort(res.begin(), res.end()); |
| 54 | res.erase(std::unique(res.begin(), res.end()), res.end()); |
| 55 | return res; |
| 56 | } |
| 57 | |
| 58 | std::string_view normalizePath(const char* path) { |
| 59 | std::string_view srcBase(FDB_SOURCE_DIR); |