blob: b40e39bb452a57e0454318d33912af8e0937cd41 (
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
29
30
31
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <cstddef>
#include <cstdint>
#include <vector>
namespace vespalib::datastore {
/*
* This class provides mapping between type ids and array sizes needed for
* storing a value with size smaller than or equal to the array size.
*
* The array sizes vector is a monotonic strictly increasing sequence that might end
* with exponential growth.
*/
class ArrayStoreTypeMapper
{
protected:
std::vector<uint32_t> _array_sizes;
public:
ArrayStoreTypeMapper();
~ArrayStoreTypeMapper();
uint32_t get_type_id(size_t array_size) const;
size_t get_array_size(uint32_t type_id) const;
uint32_t get_max_type_id(uint32_t max_type_id) const noexcept;
};
}
|