diff options
-rw-r--r-- | generator/feature_builder.cpp | 22 | ||||
-rw-r--r-- | generator/feature_builder.hpp | 42 | ||||
-rw-r--r-- | generator/feature_generator.cpp | 2 | ||||
-rw-r--r-- | generator/feature_sorter.cpp | 2 | ||||
-rw-r--r-- | generator/generator_tests/feature_builder_test.cpp | 4 |
5 files changed, 37 insertions, 35 deletions
diff --git a/generator/feature_builder.cpp b/generator/feature_builder.cpp index 93eabdb8de..8aba7ab405 100644 --- a/generator/feature_builder.cpp +++ b/generator/feature_builder.cpp @@ -326,9 +326,9 @@ bool FeatureBuilder1::CheckValid() const return true; } -void FeatureBuilder1::SerializeBase(buffer_t & data, serial::CodingParams const & params, bool needSerializeAdditionalInfo) const +void FeatureBuilder1::SerializeBase(TBuffer & data, serial::CodingParams const & params, bool needSerializeAdditionalInfo) const { - PushBackByteSink<buffer_t> sink(data); + PushBackByteSink<TBuffer> sink(data); m_params.Write(sink, needSerializeAdditionalInfo); @@ -336,7 +336,7 @@ void FeatureBuilder1::SerializeBase(buffer_t & data, serial::CodingParams const serial::SavePoint(sink, m_center, params); } -void FeatureBuilder1::Serialize(buffer_t & data) const +void FeatureBuilder1::Serialize(TBuffer & data) const { CHECK ( CheckValid(), (*this) ); @@ -346,7 +346,7 @@ void FeatureBuilder1::Serialize(buffer_t & data) const SerializeBase(data, cp); - PushBackByteSink<buffer_t> sink(data); + PushBackByteSink<TBuffer> sink(data); if (m_params.GetGeomType() != GEOM_POINT) { @@ -363,14 +363,14 @@ void FeatureBuilder1::Serialize(buffer_t & data) const // check for correct serialization #ifdef DEBUG - buffer_t tmp(data); + TBuffer tmp(data); FeatureBuilder1 fb; fb.Deserialize(tmp); ASSERT ( fb == *this, ("Source feature: ", *this, "Deserialized feature: ", fb) ); #endif } -void FeatureBuilder1::Deserialize(buffer_t & data) +void FeatureBuilder1::Deserialize(TBuffer & data) { serial::CodingParams cp; @@ -507,7 +507,7 @@ uint64_t FeatureBuilder1::GetWayIDForRouting() const } -bool FeatureBuilder2::PreSerialize(buffers_holder_t const & data) +bool FeatureBuilder2::PreSerialize(SupportingData const & data) { // make flags actual before header serialization EGeomType const geoType = m_params.GetGeomType(); @@ -523,7 +523,7 @@ bool FeatureBuilder2::PreSerialize(buffers_holder_t const & data) } // we don't need empty features without geometry - return base_type::PreSerialize(); + return TBase::PreSerialize(); } namespace @@ -561,14 +561,14 @@ namespace }; } -void FeatureBuilder2::Serialize(buffers_holder_t & data, serial::CodingParams const & params) +void FeatureBuilder2::Serialize(SupportingData & data, serial::CodingParams const & params) { data.m_buffer.clear(); // header data serialization SerializeBase(data.m_buffer, params, false /* don't store additional info from FeatureParams*/); - PushBackByteSink<buffer_t> sink(data.m_buffer); + PushBackByteSink<TBuffer> sink(data.m_buffer); uint8_t const ptsCount = static_cast<uint8_t>(data.m_innerPts.size()); uint8_t trgCount = static_cast<uint8_t>(data.m_innerTrg.size()); @@ -578,7 +578,7 @@ void FeatureBuilder2::Serialize(buffers_holder_t & data, serial::CodingParams co trgCount -= 2; } - BitSink< PushBackByteSink<buffer_t> > bitSink(sink); + BitSink< PushBackByteSink<TBuffer> > bitSink(sink); EGeomType const type = m_params.GetGeomType(); diff --git a/generator/feature_builder.hpp b/generator/feature_builder.hpp index ab45bd0cfb..a85224ae2f 100644 --- a/generator/feature_builder.hpp +++ b/generator/feature_builder.hpp @@ -19,8 +19,10 @@ class FeatureBuilder1 friend string DebugPrint(FeatureBuilder1 const & f); public: - typedef vector<m2::PointD> TPointSeq; - typedef list<TPointSeq> TGeometry; + using TPointSeq = vector<m2::PointD>; + using TGeometry = list<TPointSeq>; + + typedef vector<char> TBuffer; FeatureBuilder1(); @@ -73,14 +75,12 @@ public: return m_params.m_Types.empty(); } - typedef vector<char> buffer_t; - /// @name Serialization. //@{ - void Serialize(buffer_t & data) const; - void SerializeBase(buffer_t & data, serial::CodingParams const & params, bool needSearializeAdditionalInfo = true) const; + void Serialize(TBuffer & data) const; + void SerializeBase(TBuffer & data, serial::CodingParams const & params, bool needSearializeAdditionalInfo = true) const; - void Deserialize(buffer_t & data); + void Deserialize(TBuffer & data); //@} /// @name Selectors. @@ -213,36 +213,38 @@ protected: /// Used for serialization of features during final pass. class FeatureBuilder2 : public FeatureBuilder1 { - typedef FeatureBuilder1 base_type; - - typedef vector<uint32_t> offsets_t; + using TBase = FeatureBuilder1; + using TOffsets = vector<uint32_t>; - static void SerializeOffsets(uint32_t mask, offsets_t const & offsets, buffer_t & buffer); + static void SerializeOffsets(uint32_t mask, TOffsets const & offsets, TBuffer & buffer); public: - struct buffers_holder_t + struct SupportingData { /// @name input //@{ - offsets_t m_ptsOffset, m_trgOffset; - uint8_t m_ptsMask, m_trgMask; + TOffsets m_ptsOffset; + TOffsets m_trgOffset; + uint8_t m_ptsMask; + uint8_t m_trgMask; uint32_t m_ptsSimpMask; - TPointSeq m_innerPts, m_innerTrg; + TPointSeq m_innerPts; + TPointSeq m_innerTrg; //@} /// @name output - base_type::buffer_t m_buffer; + TBase::TBuffer m_buffer; - buffers_holder_t() : m_ptsMask(0), m_trgMask(0), m_ptsSimpMask(0) {} + SupportingData() : m_ptsMask(0), m_trgMask(0), m_ptsSimpMask(0) {} }; /// @name Overwrite from base_type. //@{ - bool PreSerialize(buffers_holder_t const & data); - void Serialize(buffers_holder_t & data, serial::CodingParams const & params); + bool PreSerialize(SupportingData const & data); + void Serialize(SupportingData & data, serial::CodingParams const & params); //@} }; @@ -253,7 +255,7 @@ namespace feature void ReadFromSourceRowFormat(TSource & src, FeatureBuilder1 & fb) { uint32_t const sz = ReadVarUint<uint32_t>(src); - typename FeatureBuilder1::buffer_t buffer(sz); + typename FeatureBuilder1::TBuffer buffer(sz); src.Read(&buffer[0], sz); fb.Deserialize(buffer); } diff --git a/generator/feature_generator.cpp b/generator/feature_generator.cpp index 8e6b3c8172..5dda06a183 100644 --- a/generator/feature_generator.cpp +++ b/generator/feature_generator.cpp @@ -105,7 +105,7 @@ uint32_t FeaturesCollector::WriteFeatureBase(vector<char> const & bytes, Feature void FeaturesCollector::operator()(FeatureBuilder1 const & fb) { - FeatureBuilder1::buffer_t bytes; + FeatureBuilder1::TBuffer bytes; fb.Serialize(bytes); (void)WriteFeatureBase(bytes, fb); } diff --git a/generator/feature_sorter.cpp b/generator/feature_sorter.cpp index ba97d6a995..f906c21255 100644 --- a/generator/feature_sorter.cpp +++ b/generator/feature_sorter.cpp @@ -185,7 +185,7 @@ namespace feature class GeometryHolder { public: - FeatureBuilder2::buffers_holder_t m_buffer; + FeatureBuilder2::SupportingData m_buffer; private: FeaturesCollector2 & m_rMain; diff --git a/generator/generator_tests/feature_builder_test.cpp b/generator/generator_tests/feature_builder_test.cpp index 2d19331cbc..880b027d96 100644 --- a/generator/generator_tests/feature_builder_test.cpp +++ b/generator/generator_tests/feature_builder_test.cpp @@ -53,7 +53,7 @@ UNIT_TEST(FBuilder_ManyTypes) TEST(fb1.RemoveInvalidTypes(), ()); TEST(fb1.CheckValid(), ()); - FeatureBuilder1::buffer_t buffer; + FeatureBuilder1::TBuffer buffer; TEST(fb1.PreSerialize(), ()); fb1.Serialize(buffer); @@ -88,7 +88,7 @@ UNIT_TEST(FBuilder_LineTypes) TEST(fb1.RemoveInvalidTypes(), ()); TEST(fb1.CheckValid(), ()); - FeatureBuilder1::buffer_t buffer; + FeatureBuilder1::TBuffer buffer; TEST(fb1.PreSerialize(), ()); fb1.Serialize(buffer); |