| 692 | explicit operator bool() const { return decoder_ != nullptr; } |
| 693 | |
| 694 | int64_t Skip(int64_t num_values) { |
| 695 | EnsureScratch(); |
| 696 | |
| 697 | int64_t total_read = 0; |
| 698 | int iter_read = 0; |
| 699 | do { |
| 700 | static_assert(kScratchValueCount <= std::numeric_limits<int>::max()); |
| 701 | const int batch_size = |
| 702 | static_cast<int>(std::min(kScratchValueCount, num_values - total_read)); |
| 703 | |
| 704 | iter_read = get()->Decode(scratch_->mutable_data_as<T>(), batch_size); |
| 705 | total_read += iter_read; |
| 706 | } while (iter_read > 0 && total_read < num_values); |
| 707 | |
| 708 | return total_read; |
| 709 | } |
| 710 | |
| 711 | private: |
| 712 | /// Scratch space to skip decode values that need skipping. |