diff options
Diffstat (limited to 'sensor/include/trygvis')
-rw-r--r-- | sensor/include/trygvis/sensor/io.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sensor/include/trygvis/sensor/io.h b/sensor/include/trygvis/sensor/io.h index f86f2d9..b69bd7a 100644 --- a/sensor/include/trygvis/sensor/io.h +++ b/sensor/include/trygvis/sensor/io.h @@ -206,8 +206,9 @@ private: class SampleStreamParser { public: - // TODO: return number of samples found for progress indication? - virtual void process(mutable_buffers_1 &buffer) = 0; + virtual int process(mutable_buffers_1 &buffer) = 0; + + virtual int finish() = 0; virtual sample_format_type type() { return type_; @@ -233,10 +234,12 @@ public: line(make_shared<vector<uint8_t>>()) { } - void process(mutable_buffers_1 &buffer) override; + int process(mutable_buffers_1 &buffer) override; + + int finish() override; private: - void process_line(shared_ptr<vector<uint8_t>> packet); + void process_line(shared_ptr<vector<uint8_t>> &packet); static const uint8_t packet_delimiter = '\n'; shared_ptr<SampleOutputStream> output; @@ -247,7 +250,9 @@ class AutoSampleParser : public SampleStreamParser { public: AutoSampleParser(shared_ptr<SampleOutputStream> output, KeyDictionary &dict); - virtual void process(mutable_buffers_1 &buffer) override; + virtual int process(mutable_buffers_1 &buffer) override; + + virtual int finish() override; private: unique_ptr<SampleStreamParser> parser; |