mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-06 07:07:48 -04:00
Potential fix for #548, to be tested in Nix-like environnements
This commit is contained in:
parent
a0526f757e
commit
fcf9f0bb82
@ -8,10 +8,12 @@
|
|||||||
#include "IOThread.h"
|
#include "IOThread.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
template<typename InputDataType, typename OutputDataType>
|
template<typename InputDataType, typename OutputDataType>
|
||||||
class VisualProcessor {
|
class VisualProcessor {
|
||||||
|
|
||||||
|
public:
|
||||||
//
|
//
|
||||||
typedef std::shared_ptr<InputDataType> InputDataTypePtr;
|
typedef std::shared_ptr<InputDataType> InputDataTypePtr;
|
||||||
typedef std::shared_ptr<OutputDataType> OutputDataTypePtr;
|
typedef std::shared_ptr<OutputDataType> OutputDataTypePtr;
|
||||||
@ -20,9 +22,8 @@ class VisualProcessor {
|
|||||||
typedef ThreadBlockingQueue<OutputDataTypePtr> VisualOutputQueueType;
|
typedef ThreadBlockingQueue<OutputDataTypePtr> VisualOutputQueueType;
|
||||||
|
|
||||||
typedef typename std::vector< VisualOutputQueueType *>::iterator outputs_i;
|
typedef typename std::vector< VisualOutputQueueType *>::iterator outputs_i;
|
||||||
public:
|
|
||||||
virtual ~VisualProcessor() {
|
|
||||||
|
|
||||||
|
virtual ~VisualProcessor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInputEmpty() {
|
bool isInputEmpty() {
|
||||||
@ -133,7 +134,8 @@ template<typename OutputDataType>
|
|||||||
class VisualDataDistributor : public VisualProcessor<OutputDataType, OutputDataType> {
|
class VisualDataDistributor : public VisualProcessor<OutputDataType, OutputDataType> {
|
||||||
protected:
|
protected:
|
||||||
virtual void process() {
|
virtual void process() {
|
||||||
OutputDataType *inp;
|
VisualProcessor<OutputDataType, OutputDataType>::OutputDataTypePtr inp;
|
||||||
|
|
||||||
while (VisualProcessor<OutputDataType, OutputDataType>::input->try_pop(inp)) {
|
while (VisualProcessor<OutputDataType, OutputDataType>::input->try_pop(inp)) {
|
||||||
|
|
||||||
if (!VisualProcessor<OutputDataType, OutputDataType>::isAnyOutputEmpty()) {
|
if (!VisualProcessor<OutputDataType, OutputDataType>::isAnyOutputEmpty()) {
|
||||||
@ -156,8 +158,12 @@ protected:
|
|||||||
template<typename OutputDataType>
|
template<typename OutputDataType>
|
||||||
class VisualDataReDistributor : public VisualProcessor<OutputDataType, OutputDataType> {
|
class VisualDataReDistributor : public VisualProcessor<OutputDataType, OutputDataType> {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
ReBuffer<OutputDataType> buffers{ std::string(typeid(*this).name()) };
|
||||||
|
|
||||||
virtual void process() {
|
virtual void process() {
|
||||||
OutputDataType *inp;
|
VisualProcessor<OutputDataType, OutputDataType>::OutputDataTypePtr inp;
|
||||||
|
|
||||||
while (VisualProcessor<OutputDataType, OutputDataType>::input->try_pop(inp)) {
|
while (VisualProcessor<OutputDataType, OutputDataType>::input->try_pop(inp)) {
|
||||||
|
|
||||||
if (!VisualProcessor<OutputDataType, OutputDataType>::isAnyOutputEmpty()) {
|
if (!VisualProcessor<OutputDataType, OutputDataType>::isAnyOutputEmpty()) {
|
||||||
@ -168,7 +174,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inp) {
|
if (inp) {
|
||||||
OutputDataTypePtr outp = buffers.getBuffer();
|
VisualProcessor<OutputDataType, OutputDataType>::OutputDataTypePtr outp = buffers.getBuffer();
|
||||||
|
|
||||||
//'deep copy' of the contents
|
//'deep copy' of the contents
|
||||||
(*outp) = (*inp);
|
(*outp) = (*inp);
|
||||||
@ -177,5 +183,5 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ReBuffer<OutputDataType> buffers;
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user