diff --git a/src/process/VisualProcessor.h b/src/process/VisualProcessor.h index 620cdfa..f7ec6f5 100644 --- a/src/process/VisualProcessor.h +++ b/src/process/VisualProcessor.h @@ -32,16 +32,18 @@ public: void run() { busy_update.lock(); - process(); + if (input && !input->empty()) { + process(); + } busy_update.unlock(); } +protected: virtual void process() { // process inputs to output // distribute(output); } - -protected: + void distribute(ReferenceCounter *output) { // distribute outputs output->setRefCount(outputs.size()); @@ -56,3 +58,17 @@ protected: std::mutex busy_update; }; + +class VisualDataDistributor : public VisualProcessor { +protected: + virtual void process() { + while (!input->empty()) { + ReferenceCounter *inp; + input->pop(inp); + if (inp) { + distribute(inp); + } + } + } +}; +