aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/data/memory_input.h
blob: 2c553029e763344a71378c781dc0a6c298e67ab3 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "input.h"

namespace vespalib {

/**
 * Thin wrapper presenting a single chunk of Memory as an Input.
 **/
class MemoryInput : public Input
{
private:
    Memory _data;
    size_t _pos;

public:
    MemoryInput(const Memory data) : _data(data), _pos(0) {}
    Memory obtain() override;
    Input &evict(size_t bytes) override;
};

} // namespace vespalib