forked from mapsme/omim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeatures_vector.cpp
36 lines (29 loc) · 1.12 KB
/
features_vector.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
#include "features_vector.hpp"
#include "features_offsets_table.hpp"
#include "data_factory.hpp"
#include "platform/constants.hpp"
#include "platform/mwm_version.hpp"
void FeaturesVector::GetByIndex(uint32_t index, FeatureType & ft) const
{
uint32_t offset = 0, size = 0;
auto const ftOffset = m_table ? m_table->GetFeatureOffset(index) : index;
m_RecordReader.ReadRecord(ftOffset, m_buffer, offset, size);
ft.Deserialize(m_LoadInfo.GetLoader(), &m_buffer[offset]);
}
FeaturesVectorTest::FeaturesVectorTest(string const & filePath)
: FeaturesVectorTest((FilesContainerR(filePath, READER_CHUNK_LOG_SIZE, READER_CHUNK_LOG_COUNT)))
{
}
FeaturesVectorTest::FeaturesVectorTest(FilesContainerR const & cont)
: m_cont(cont), m_header(m_cont), m_vector(m_cont, m_header, 0)
{
auto const version = m_header.GetFormat();
if (version == version::v5)
m_vector.m_table = feature::FeaturesOffsetsTable::CreateIfNotExistsAndLoad(m_cont).release();
else if (version >= version::v6)
m_vector.m_table = feature::FeaturesOffsetsTable::Load(m_cont).release();
}
FeaturesVectorTest::~FeaturesVectorTest()
{
delete m_vector.m_table;
}