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:
authorMaxim Pimenov <m@maps.me>2015-11-06 18:45:54 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:02:38 +0300
commitef97e8dbaf2356802381e96ef0f4ce61bced7616 (patch)
tree06c7fcbdc0627302163f1180f8eed5b6f15fe0c8 /coding/compressed_bit_vector.hpp
parenta818bb4b37e4de58fe6a251c4a6cfcce53b34c6a (diff)
Review fixes.
Diffstat (limited to 'coding/compressed_bit_vector.hpp')
-rw-r--r--coding/compressed_bit_vector.hpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/coding/compressed_bit_vector.hpp b/coding/compressed_bit_vector.hpp
index 18fd8f6982..837e35015f 100644
--- a/coding/compressed_bit_vector.hpp
+++ b/coding/compressed_bit_vector.hpp
@@ -63,6 +63,9 @@ public:
// todo(@pimenov). Think about rewriting Serialize and Deserialize to use the
// code in old_compressed_bit_vector.{c,h}pp.
virtual void Serialize(Writer & writer) const = 0;
+
+ // Copies a bit vector and returns a pointer to the copy.
+ virtual unique_ptr<CompressedBitVector> Clone() const = 0;
};
string DebugPrint(CompressedBitVector::StorageStrategy strat);
@@ -105,6 +108,7 @@ public:
bool GetBit(uint64_t pos) const override;
StorageStrategy GetStorageStrategy() const override;
void Serialize(Writer & writer) const override;
+ unique_ptr<CompressedBitVector> Clone() const override;
private:
vector<uint64_t> m_bitGroups;
@@ -117,6 +121,8 @@ public:
friend class CompressedBitVectorBuilder;
using TIterator = vector<uint64_t>::const_iterator;
+ SparseCBV() = default;
+
explicit SparseCBV(vector<uint64_t> const & setBits);
explicit SparseCBV(vector<uint64_t> && setBits);
@@ -136,6 +142,7 @@ public:
bool GetBit(uint64_t pos) const override;
StorageStrategy GetStorageStrategy() const override;
void Serialize(Writer & writer) const override;
+ unique_ptr<CompressedBitVector> Clone() const override;
inline TIterator Begin() const { return m_positions.cbegin(); }
inline TIterator End() const { return m_positions.cend(); }
@@ -155,15 +162,13 @@ public:
// Chooses a strategy to store the bit vector with bits from a bitmap obtained
// by concatenating the elements of bitGroups.
+ static unique_ptr<CompressedBitVector> FromBitGroups(vector<uint64_t> & bitGroups);
static unique_ptr<CompressedBitVector> FromBitGroups(vector<uint64_t> && bitGroups);
- // Copies a CBV.
- static unique_ptr<CompressedBitVector> FromCBV(CompressedBitVector const & cbv);
-
// Reads a bit vector from reader which must contain a valid
// bit vector representation (see CompressedBitVector::Serialize for the format).
template <typename TReader>
- static unique_ptr<CompressedBitVector> Deserialize(TReader & reader)
+ static unique_ptr<CompressedBitVector> DeserializeFromReader(TReader & reader)
{
ReaderSource<TReader> src(reader);
return DeserializeFromSource(src);