| 19 | : od_(od), ops_(ops) {}; |
| 20 | |
| 21 | Sample Transform::get(const int64_t idx) const { |
| 22 | auto t_sample = od_->get(idx); |
| 23 | if (t_sample.empty()) { |
| 24 | throw std::runtime_error("Transform: cannot return empty sample"); |
| 25 | } |
| 26 | for (auto& op : ops_) { |
| 27 | t_sample = op->apply(t_sample); |
| 28 | if (t_sample.empty()) { |
| 29 | throw std::runtime_error("Transform: cannot return empty sample"); |
| 30 | } |
| 31 | } |
| 32 | return t_sample; |
| 33 | } |
| 34 | |
| 35 | int64_t Transform::size() const { |
| 36 | return od_->size(); |