blob: b1a4428155541f71d1d219c4eb86f52d9e1eb729 (
plain)
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
|
#include "indexer/index_builder.hpp"
#include "indexer/features_vector.hpp"
#include "defines.hpp"
#include "base/logging.hpp"
namespace indexer
{
bool BuildIndexFromDataFile(string const & datFile, string const & tmpFile)
{
try
{
string const idxFileName(tmpFile + GEOM_INDEX_TMP_EXT);
{
FeaturesVectorTest features(datFile);
FileWriter writer(idxFileName);
BuildIndex(features.GetHeader(), features.GetVector(), writer, tmpFile);
}
FilesContainerW(datFile, FileWriter::OP_WRITE_EXISTING).Write(idxFileName, INDEX_FILE_TAG);
FileWriter::DeleteFileX(idxFileName);
}
catch (Reader::Exception const & e)
{
LOG(LERROR, ("Error while reading file: ", e.Msg()));
return false;
}
catch (Writer::Exception const & e)
{
LOG(LERROR, ("Error writing index file: ", e.Msg()));
return false;
}
return true;
}
} // namespace indexer
|