| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <Processors/IProcessor.h> |
| 4 | |
| 5 | |
| 6 | namespace DB |
| 7 | { |
| 8 | |
| 9 | class ISource : public IProcessor |
| 10 | { |
| 11 | protected: |
| 12 | OutputPort & output; |
| 13 | bool has_input = false; |
| 14 | bool finished = false; |
| 15 | bool got_exception = false; |
| 16 | Port::Data current_chunk; |
| 17 | |
| 18 | virtual Chunk generate() = 0; |
| 19 | |
| 20 | public: |
| 21 | ISource(Block header); |
| 22 | |
| 23 | Status prepare() override; |
| 24 | void work() override; |
| 25 | |
| 26 | OutputPort & getPort() { return output; } |
| 27 | const OutputPort & getPort() const { return output; } |
| 28 | }; |
| 29 | |
| 30 | using SourcePtr = std::shared_ptr<ISource>; |
| 31 | |
| 32 | } |
| 33 |