| 326 | } |
| 327 | |
| 328 | inline void |
| 329 | Connector::start(const std::string& file_path, |
| 330 | int execution_id, bool has_restarts) { |
| 331 | /// extract fzn file name |
| 332 | std::string base_name(file_path); |
| 333 | { |
| 334 | size_t pos = base_name.find_last_of('/'); |
| 335 | if (pos != static_cast<size_t>(-1)) { |
| 336 | base_name = base_name.substr(pos + 1, base_name.length() - pos - 1); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | std::string info{""}; |
| 341 | { |
| 342 | std::stringstream ss; |
| 343 | ss << "{"; |
| 344 | ss << "\"has_restarts\": " << (has_restarts ? "true" : "false") << "\n"; |
| 345 | ss << ",\"name\": " << "\"" << base_name << "\"" << "\n"; |
| 346 | if (execution_id != -1) { |
| 347 | ss << ",\"execution_id\": " << execution_id; |
| 348 | } |
| 349 | ss << "}"; |
| 350 | info = ss.str(); |
| 351 | } |
| 352 | |
| 353 | marshalling.makeStart(info); |
| 354 | sendOverSocket(); |
| 355 | } |
| 356 | |
| 357 | inline void |
| 358 | Connector::restart(int restart_id) { |