added
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@880 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#ifndef NULLSOURCE_HPP
|
||||
#define NULLSOURCE_HPP
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Block.hpp>
|
||||
|
||||
class NullSource : public Block
|
||||
{
|
||||
public:
|
||||
NullSource(DType dtype)
|
||||
: Block(0, 1, DType::None, dtype)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual ~NullSource() = default;
|
||||
|
||||
void process(IBuffer &out) override
|
||||
{
|
||||
if (dtype_out() == DType::Double)
|
||||
{
|
||||
auto buf_out = reinterpret_cast<Buffer<double>&>(out);
|
||||
process_double(buf_out);
|
||||
}
|
||||
}
|
||||
|
||||
void process_double(Buffer<double> &out)
|
||||
{
|
||||
double d = 0;
|
||||
for (int i=0; i < (out.capacity() - out.len()); i++)
|
||||
{
|
||||
out.write(&d, 1);
|
||||
}
|
||||
}
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // NULLSOURCE_HPP
|
||||
Reference in New Issue
Block a user