2018-05-23 20:19:33 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Processors/IProcessor.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ISource : public IProcessor
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
OutputPort & output;
|
2019-02-07 18:51:53 +00:00
|
|
|
bool has_input = false;
|
2018-05-23 20:19:33 +00:00
|
|
|
bool finished = false;
|
2019-04-30 09:45:13 +00:00
|
|
|
bool got_exception = false;
|
2019-04-29 18:43:50 +00:00
|
|
|
Port::Data current_chunk;
|
2018-05-23 20:19:33 +00:00
|
|
|
|
2019-02-18 16:36:07 +00:00
|
|
|
virtual Chunk generate() = 0;
|
2018-05-23 20:19:33 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
ISource(Block header);
|
|
|
|
|
|
|
|
Status prepare() override;
|
|
|
|
void work() override;
|
|
|
|
|
|
|
|
OutputPort & getPort() { return output; }
|
2019-02-19 18:41:18 +00:00
|
|
|
const OutputPort & getPort() const { return output; }
|
2018-05-23 20:19:33 +00:00
|
|
|
};
|
|
|
|
|
2019-10-20 09:12:42 +00:00
|
|
|
using SourcePtr = std::shared_ptr<ISource>;
|
|
|
|
|
2018-05-23 20:19:33 +00:00
|
|
|
}
|