diff --git a/generator/features_processing_helpers.hpp b/generator/features_processing_helpers.hpp new file mode 100644 index 0000000000..9d152f4196 --- /dev/null +++ b/generator/features_processing_helpers.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include "generator/feature_builder.hpp" + +#include "base/thread_safe_queue.hpp" + +#include +#include +#include +#include + +namespace generator +{ +size_t static const kAffilationsBufferSize = 512; + +struct ProcessedData +{ + explicit ProcessedData(feature::FeatureBuilder::Buffer && buffer, + std::vector && affiliations) + : m_buffer(std::move(buffer)), m_affiliations(std::move(affiliations)) {} + + feature::FeatureBuilder::Buffer m_buffer; + std::vector m_affiliations; +}; + +using FeatureProcessorChank = base::threads::DataWrapper>; +using FeatureProcessorQueue = base::threads::ThreadSafeQueue; +} // namespace generator diff --git a/generator/processor_booking.hpp b/generator/processor_booking.hpp index 091c3aecc4..7e78ae0dc2 100644 --- a/generator/processor_booking.hpp +++ b/generator/processor_booking.hpp @@ -36,7 +36,7 @@ public: m_features.emplace(fb.GetMostGenericOsmId(), fb); } - void Flush() override {} + void Finish() override {} void Merge(FeatureProcessorInterface const &) override { diff --git a/generator/processor_coastline.cpp b/generator/processor_coastline.cpp index 0ffdca64de..bd014e9a4c 100644 --- a/generator/processor_coastline.cpp +++ b/generator/processor_coastline.cpp @@ -35,7 +35,7 @@ void ProcessorCoastline::Process(feature::FeatureBuilder & feature) m_affilationsLayer->AddBufferToQueueIfFull(m_queue); } -void ProcessorCoastline::Flush() +void ProcessorCoastline::Finish() { m_affilationsLayer->AddBufferToQueue(m_queue); } diff --git a/generator/processor_coastline.hpp b/generator/processor_coastline.hpp index d13eed9ef9..56dfe52669 100644 --- a/generator/processor_coastline.hpp +++ b/generator/processor_coastline.hpp @@ -18,7 +18,7 @@ public: std::shared_ptr Clone() const override; void Process(feature::FeatureBuilder & feature) override; - void Flush() override; + void Finish() override; void Merge(FeatureProcessorInterface const & other) override; void MergeInto(ProcessorCoastline & other) const override; diff --git a/generator/processor_country.cpp b/generator/processor_country.cpp index 476e8b1c46..1cfed5a633 100644 --- a/generator/processor_country.cpp +++ b/generator/processor_country.cpp @@ -37,7 +37,7 @@ void ProcessorCountry::Process(feature::FeatureBuilder & feature) m_affilationsLayer->AddBufferToQueueIfFull(m_queue); } -void ProcessorCountry::Flush() +void ProcessorCountry::Finish() { m_affilationsLayer->AddBufferToQueue(m_queue); } diff --git a/generator/processor_country.hpp b/generator/processor_country.hpp index 9481668771..69a3bd95bd 100644 --- a/generator/processor_country.hpp +++ b/generator/processor_country.hpp @@ -27,7 +27,7 @@ public: std::shared_ptr Clone() const override; void Process(feature::FeatureBuilder & feature) override; - void Flush() override; + void Finish() override; void Merge(FeatureProcessorInterface const & other) override; void MergeInto(ProcessorCountry & other) const override; diff --git a/generator/processor_interface.hpp b/generator/processor_interface.hpp index e0eae37ba0..dcd67083f1 100644 --- a/generator/processor_interface.hpp +++ b/generator/processor_interface.hpp @@ -29,7 +29,7 @@ public: // This method is used by OsmTranslator to pass |fb| to Processor for further processing. virtual void Process(feature::FeatureBuilder & fb) = 0; - virtual void Flush() = 0; + virtual void Finish() = 0; virtual void Merge(FeatureProcessorInterface const &) = 0; @@ -42,21 +42,4 @@ public: private: void FailIfMethodUnsupported() const { CHECK(false, ("This method is unsupported.")); } }; - -size_t static const kAffilationsBufferSize = 128; - -struct ProcessedData -{ - explicit ProcessedData(feature::FeatureBuilder::Buffer && buffer, std::vector && affiliations) - : m_buffer(std::move(buffer)), m_affiliations(std::move(affiliations)) - { - } - - feature::FeatureBuilder::Buffer m_buffer; - std::vector m_affiliations; -}; - -using FeatureProcessorChank = base::threads::DataWrapper>; -using FeatureProcessorQueue = base::threads::ThreadSafeQueue; - } // namespace generator diff --git a/generator/processor_noop.hpp b/generator/processor_noop.hpp index 2660613477..d47ed6dd96 100644 --- a/generator/processor_noop.hpp +++ b/generator/processor_noop.hpp @@ -19,7 +19,7 @@ public: } void Process(feature::FeatureBuilder &) override {} - void Flush() override {} + void Finish() override {} void Merge(FeatureProcessorInterface const &) override {} void MergeInto(ProcessorNoop &) const override {} diff --git a/generator/processor_simple.cpp b/generator/processor_simple.cpp index 17ff0089b4..5da4508eec 100644 --- a/generator/processor_simple.cpp +++ b/generator/processor_simple.cpp @@ -29,7 +29,7 @@ void ProcessorSimple::Process(feature::FeatureBuilder & fb) m_affilationsLayer->AddBufferToQueueIfFull(m_queue); } -void ProcessorSimple::Flush() +void ProcessorSimple::Finish() { m_affilationsLayer->AddBufferToQueue(m_queue); } diff --git a/generator/processor_simple.hpp b/generator/processor_simple.hpp index e8b92983ad..4b30063fec 100644 --- a/generator/processor_simple.hpp +++ b/generator/processor_simple.hpp @@ -21,7 +21,7 @@ public: std::shared_ptr Clone() const override; void Process(feature::FeatureBuilder & fb) override; - void Flush() override; + void Finish() override; void Merge(FeatureProcessorInterface const & other) override; void MergeInto(ProcessorSimple & other) const override; diff --git a/generator/processor_world.cpp b/generator/processor_world.cpp index 54b4059139..48a6f64c98 100644 --- a/generator/processor_world.cpp +++ b/generator/processor_world.cpp @@ -32,7 +32,7 @@ void ProcessorWorld::Process(feature::FeatureBuilder & feature) m_affilationsLayer->AddBufferToQueueIfFull(m_queue); } -void ProcessorWorld::Flush() +void ProcessorWorld::Finish() { m_affilationsLayer->AddBufferToQueue(m_queue); } diff --git a/generator/processor_world.hpp b/generator/processor_world.hpp index f1ee0eeb3a..53e27e3e02 100644 --- a/generator/processor_world.hpp +++ b/generator/processor_world.hpp @@ -26,7 +26,7 @@ public: std::shared_ptr Clone() const override; void Process(feature::FeatureBuilder & feature) override; - void Flush() override; + void Finish() override; void Merge(FeatureProcessorInterface const & other) override; void MergeInto(ProcessorWorld & other) const override;