Na endlich :/
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@884 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -5,34 +5,34 @@
|
||||
|
||||
#include <Block.hpp>
|
||||
|
||||
template <typename T>
|
||||
class NullSource : public Block
|
||||
{
|
||||
public:
|
||||
NullSource(DType dtype)
|
||||
: Block(0, 1, DType::None, dtype)
|
||||
{
|
||||
NullSource(size_t bufSize)
|
||||
: Block(0, 1, DType::None, DType::Double)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~NullSource() = default;
|
||||
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()
|
||||
{
|
||||
Buffer<T> *buf_out = dynamic_cast<Buffer<T>*>(m_buf_out);
|
||||
process(*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);
|
||||
}
|
||||
}
|
||||
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:
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user