aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/CompressedReadBufferWrapper.h
blob: bb58a7bfeb3ec3176168d421ae265f47295df0ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include <IO/BufferWithOwnMemory.h>
#include <IO/ReadBuffer.h>

namespace DB
{

class CompressedReadBufferWrapper : public BufferWithOwnMemory<ReadBuffer>
{
public:
    CompressedReadBufferWrapper(
      std::unique_ptr<ReadBuffer> in_,
      size_t buf_size,
      char * existing_memory,
      size_t alignment)
    : BufferWithOwnMemory<ReadBuffer>(buf_size, existing_memory, alignment)
    , in(std::move(in_)) {}

    const ReadBuffer & getWrappedReadBuffer() const { return *in; }
    ReadBuffer & getWrappedReadBuffer() { return *in; }

    void prefetch(Priority priority) override { in->prefetch(priority); }

protected:
    std::unique_ptr<ReadBuffer> in;
};

}