git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@884 b431acfa-c32f-4a4a-93f1-934dc6c82436
40 lines
566 B
C++
40 lines
566 B
C++
#ifndef NULLSOURCE_HPP
|
|
#define NULLSOURCE_HPP
|
|
|
|
#pragma once
|
|
|
|
#include <Block.hpp>
|
|
|
|
template <typename T>
|
|
class NullSource : public Block
|
|
{
|
|
public:
|
|
NullSource(size_t bufSize)
|
|
: Block(0, 1, DType::None, DType::Double)
|
|
{
|
|
|
|
}
|
|
|
|
virtual ~NullSource() = default;
|
|
|
|
void process()
|
|
{
|
|
Buffer<T> *buf_out = dynamic_cast<Buffer<T>*>(m_buf_out);
|
|
process(*buf_out);
|
|
}
|
|
|
|
void process(Buffer<T> &out)
|
|
{
|
|
double d = 0;
|
|
size_t toWrite = out.capacity() - out.len();
|
|
|
|
for (int i=0; i < toWrite; i++)
|
|
{
|
|
out.write(&d, 1);
|
|
}
|
|
}
|
|
private:
|
|
|
|
};
|
|
|
|
#endif // NULLSOURCE_HPP
|