forked from microsoft/DiskANN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabstract_data_store.cpp
46 lines (38 loc) · 1.05 KB
/
abstract_data_store.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#include <vector>
#include "abstract_data_store.h"
namespace diskann
{
template <typename data_t>
AbstractDataStore<data_t>::AbstractDataStore(const location_t capacity, const size_t dim)
: _capacity(capacity), _dim(dim)
{
}
template <typename data_t> location_t AbstractDataStore<data_t>::capacity() const
{
return _capacity;
}
template <typename data_t> size_t AbstractDataStore<data_t>::get_dims() const
{
return _dim;
}
template <typename data_t> location_t AbstractDataStore<data_t>::resize(const location_t new_num_points)
{
if (new_num_points > _capacity)
{
return expand(new_num_points);
}
else if (new_num_points < _capacity)
{
return shrink(new_num_points);
}
else
{
return _capacity;
}
}
template DISKANN_DLLEXPORT class AbstractDataStore<float>;
template DISKANN_DLLEXPORT class AbstractDataStore<int8_t>;
template DISKANN_DLLEXPORT class AbstractDataStore<uint8_t>;
} // namespace diskann