Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2011-01-02 23:25:06 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:09:04 +0300
commitd9133a2d9fd2445033d1e16b5e9c625ebd80b494 (patch)
treed99ea74eb439a89197b5a6399a1ac06143459d3a /indexer/feature_processor.hpp
parentb33ae08c7968744e969f9e75dcd0e8bd7a58f400 (diff)
Add files container everywere for dat, geom, trg, idx.
Diffstat (limited to 'indexer/feature_processor.hpp')
-rw-r--r--indexer/feature_processor.hpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/indexer/feature_processor.hpp b/indexer/feature_processor.hpp
index 1045f6593a..b71e56f4b7 100644
--- a/indexer/feature_processor.hpp
+++ b/indexer/feature_processor.hpp
@@ -1,18 +1,25 @@
#pragma once
-#include "feature.hpp"
-#include "data_header_reader.hpp"
+#include "features_vector.hpp"
-#include "../coding/varint.hpp"
-#include "../coding/file_reader.hpp"
+#include "../coding/file_container.hpp"
+
+#include "../std/bind.hpp"
-#include "../std/vector.hpp"
namespace feature
{
- /// Read feature from feature source.
- template <class TSource, class TFeature>
- void ReadFromSource(TSource & src, TFeature & f, typename TFeature::read_source_t & buffer)
+ template <class ToDo>
+ void ForEachFromDat(string const & fName, ToDo & toDo)
+ {
+ FilesContainerR container(fName);
+ FeaturesVector<FileReader> featureSource(container);
+ featureSource.ForEachOffset(bind<void>(ref(toDo), _1, _2));
+ }
+
+ /// Read feature from feature source.
+ template <class TSource>
+ void ReadFromSource(TSource & src, FeatureGeom & f, typename FeatureGeom::read_source_t & buffer)
{
uint32_t const sz = ReadVarUint<uint32_t>(src);
buffer.m_data.resize(sz);
@@ -21,14 +28,14 @@ namespace feature
}
/// Process features in .dat file.
- template <class TFeature, class ToDo>
- void ForEachFromDat(string const & fName, ToDo & toDo)
+ template <class ToDo>
+ void ForEachFromDatRawFormat(string const & fName, ToDo & toDo)
{
typedef ReaderSource<FileReader> source_t;
FileReader reader(fName);
source_t src(reader);
- typename TFeature::read_source_t buffer(fName);
+ typename FeatureGeom::read_source_t buffer(fName);
// skip header
uint64_t currPos = feature::GetSkipHeaderSize(reader);
@@ -38,7 +45,7 @@ namespace feature
// read features one by one
while (currPos < fSize)
{
- TFeature f;
+ FeatureGeom f;
ReadFromSource(src, f, buffer);
toDo(f, currPos);
currPos = src.Pos();