forked from organicmaps/organicmaps
[coding] fixes related to file container writers refactoring.
This commit is contained in:
parent
d2b1fc8d30
commit
d162b877e8
4 changed files with 13 additions and 14 deletions
|
@ -1,6 +1,5 @@
|
|||
#include "coding/file_container.hpp"
|
||||
|
||||
#include "coding/file_container_writers.hpp"
|
||||
#include "coding/internal/file_data.hpp"
|
||||
#include "coding/read_write_utils.hpp"
|
||||
#include "coding/varint.hpp"
|
||||
|
@ -386,7 +385,7 @@ void FilesContainerW::DeleteSection(Tag const & tag)
|
|||
Open(FileWriter::OP_WRITE_EXISTING);
|
||||
}
|
||||
|
||||
std::unique_ptr<FileWriter> FilesContainerW::GetWriter(Tag const & tag)
|
||||
std::unique_ptr<FileContainerWriter> FilesContainerW::GetWriter(Tag const & tag)
|
||||
{
|
||||
ASSERT(!m_finished, ());
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "coding/file_reader.hpp"
|
||||
#include "coding/file_writer.hpp"
|
||||
#include "coding/file_container_writers.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
#include "base/macros.hpp"
|
||||
|
@ -241,7 +241,7 @@ public:
|
|||
FileWriter::Op op = FileWriter::OP_WRITE_TRUNCATE);
|
||||
~FilesContainerW();
|
||||
|
||||
std::unique_ptr<FileWriter> GetWriter(Tag const & tag);
|
||||
std::unique_ptr<FileContainerWriter> GetWriter(Tag const & tag);
|
||||
|
||||
void Write(std::string const & fPath, Tag const & tag);
|
||||
void Write(ModelReaderPtr reader, Tag const & tag);
|
||||
|
|
|
@ -184,7 +184,7 @@ void BuildRoadAltitudes(std::string const & mwmPath, AltitudeGetter & altitudeGe
|
|||
succinct::bit_vector_builder & builder = processor.GetAltitudeAvailabilityBuilder();
|
||||
succinct::rs_bit_vector(&builder).map(visitor);
|
||||
}
|
||||
header.m_featureTableOffset = base::checked_cast<uint32_t>(w.Pos() - startOffset);
|
||||
header.m_featureTableOffset = base::checked_cast<uint32_t>(w->Pos() - startOffset);
|
||||
|
||||
std::vector<uint32_t> offsets;
|
||||
std::vector<uint8_t> deltas;
|
||||
|
@ -207,20 +207,20 @@ void BuildRoadAltitudes(std::string const & mwmPath, AltitudeGetter & altitudeGe
|
|||
for (uint32_t offset : offsets)
|
||||
builder.push_back(offset);
|
||||
|
||||
coding::FreezeVisitor<Writer> visitor(w);
|
||||
coding::FreezeVisitor<Writer> visitor(*w);
|
||||
succinct::elias_fano(&builder).map(visitor);
|
||||
}
|
||||
// Writing altitude info.
|
||||
header.m_altitudesOffset = base::checked_cast<uint32_t>(w.Pos() - startOffset);
|
||||
w.Write(deltas.data(), deltas.size());
|
||||
w.WritePaddingByEnd(8);
|
||||
header.m_endOffset = base::checked_cast<uint32_t>(w.Pos() - startOffset);
|
||||
header.m_altitudesOffset = base::checked_cast<uint32_t>(w->Pos() - startOffset);
|
||||
w->Write(deltas.data(), deltas.size());
|
||||
w->WritePaddingByEnd(8);
|
||||
header.m_endOffset = base::checked_cast<uint32_t>(w->Pos() - startOffset);
|
||||
|
||||
// Rewriting header info.
|
||||
auto const endOffset = w.Pos();
|
||||
w.Seek(startOffset);
|
||||
auto const endOffset = w->Pos();
|
||||
w->Seek(startOffset);
|
||||
header.Serialize(w);
|
||||
w.Seek(endOffset);
|
||||
w->Seek(endOffset);
|
||||
LOG(LINFO, (ALTITUDES_FILE_TAG, "section is ready. The size is", header.m_endOffset));
|
||||
if (processor.HasAltitudeInfo())
|
||||
LOG(LINFO, ("Min altitude is", processor.GetMinAltitude()));
|
||||
|
|
|
@ -121,7 +121,7 @@ void SerializeRestrictions(RestrictionCollector & restrictionCollector,
|
|||
header.Serialize(*w);
|
||||
|
||||
base::SortUnique(restrictions);
|
||||
RestrictionSerializer::Serialize(header, restrictions.begin(), restrictions.end(), w);
|
||||
RestrictionSerializer::Serialize(header, restrictions.begin(), restrictions.end(), *w);
|
||||
}
|
||||
|
||||
bool BuildRoadRestrictions(std::string const & targetPath,
|
||||
|
|
Loading…
Add table
Reference in a new issue