| 380 | return _fs.is_open(); |
| 381 | } |
| 382 | void open(const std::string &filename) override |
| 383 | { |
| 384 | ARM_COMPUTE_ERROR_ON(is_open()); |
| 385 | try |
| 386 | { |
| 387 | _fs.exceptions(std::ifstream::failbit | std::ifstream::badbit); |
| 388 | _fs.open(filename, std::ios::in | std::ios::binary); |
| 389 | |
| 390 | unsigned int max_val = 0; |
| 391 | std::tie(_width, _height, max_val) = parse_ppm_header(_fs); |
| 392 | |
| 393 | ARM_COMPUTE_ERROR_ON_MSG_VAR(max_val >= 256, "2 bytes per colour channel not supported in file %s", |
| 394 | filename.c_str()); |
| 395 | |
| 396 | _feeder = std::make_unique<FileImageFeeder>(_fs); |
| 397 | } |
| 398 | catch (std::runtime_error &e) |
| 399 | { |
| 400 | ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", filename.c_str(), e.what()); |
| 401 | } |
| 402 | } |
| 403 | void close() override |
| 404 | { |
| 405 | if (is_open()) |
nothing calls this directly
no test coverage detected