aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/blob_sequence_reader.h
blob: 34ba11b9204fa9223b5d17b370133a8078f87602 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchlib/attribute/readerbase.h>

namespace search::attribute {

/**
 *  Utility for reading an attribute data file where
 *  the format is a sequence of blobs (size, byte[size]).
 **/
class BlobSequenceReader : public ReaderBase
{
private:
    FileReader<uint32_t> _sizeReader;
public:
    BlobSequenceReader(AttributeVector &attr)
        : ReaderBase(attr),
          _sizeReader(&_datFile.file())
    { }
    uint32_t getNextSize() { return _sizeReader.readHostOrder(); }
    void readBlob(void *buf, size_t len);
};

} // namespace