diff --git a/src/process/VisualProcessor.h b/src/process/VisualProcessor.h index df1810a..4441719 100644 --- a/src/process/VisualProcessor.h +++ b/src/process/VisualProcessor.h @@ -8,10 +8,12 @@ #include "IOThread.h" #include #include +#include template class VisualProcessor { - + +public: // typedef std::shared_ptr InputDataTypePtr; typedef std::shared_ptr OutputDataTypePtr; @@ -20,9 +22,8 @@ class VisualProcessor { typedef ThreadBlockingQueue VisualOutputQueueType; typedef typename std::vector< VisualOutputQueueType *>::iterator outputs_i; -public: - virtual ~VisualProcessor() { + virtual ~VisualProcessor() { } bool isInputEmpty() { @@ -133,7 +134,8 @@ template class VisualDataDistributor : public VisualProcessor { protected: virtual void process() { - OutputDataType *inp; + VisualProcessor::OutputDataTypePtr inp; + while (VisualProcessor::input->try_pop(inp)) { if (!VisualProcessor::isAnyOutputEmpty()) { @@ -156,8 +158,12 @@ protected: template class VisualDataReDistributor : public VisualProcessor { protected: + + ReBuffer buffers{ std::string(typeid(*this).name()) }; + virtual void process() { - OutputDataType *inp; + VisualProcessor::OutputDataTypePtr inp; + while (VisualProcessor::input->try_pop(inp)) { if (!VisualProcessor::isAnyOutputEmpty()) { @@ -168,7 +174,7 @@ protected: } if (inp) { - OutputDataTypePtr outp = buffers.getBuffer(); + VisualProcessor::OutputDataTypePtr outp = buffers.getBuffer(); //'deep copy' of the contents (*outp) = (*inp); @@ -177,5 +183,5 @@ protected: } } } - ReBuffer buffers; + };