This commit is contained in:
Shunsuke Kanda 2021-06-27 23:40:26 +09:00
parent acce0ba187
commit 69235e1a87
7 changed files with 25 additions and 25 deletions

View file

@ -17,11 +17,11 @@ class bc_vector_7 {
private:
std::uint64_t m_num_frees = 0;
vector_wrapper<std::uint8_t> m_ints_l1;
vector_wrapper<std::uint16_t> m_ints_l2;
vector_wrapper<std::uint32_t> m_ints_l3;
vector_wrapper<std::uint64_t> m_ints_l4;
std::array<vector_wrapper<std::uint64_t>, max_levels - 1> m_ranks;
immutable_vector<std::uint8_t> m_ints_l1;
immutable_vector<std::uint16_t> m_ints_l2;
immutable_vector<std::uint32_t> m_ints_l3;
immutable_vector<std::uint64_t> m_ints_l4;
std::array<immutable_vector<std::uint64_t>, max_levels - 1> m_ranks;
compact_vector m_links;
bit_vector m_leaves;

View file

@ -15,7 +15,7 @@ class bc_vector_8 {
private:
std::uint32_t m_num_levels = 0;
std::uint64_t m_num_frees = 0;
std::array<vector_wrapper<std::uint8_t>, max_levels> m_bytes;
std::array<immutable_vector<std::uint8_t>, max_levels> m_bytes;
std::array<bit_vector, max_levels - 1> m_nexts;
compact_vector m_links;
bit_vector m_leaves;

View file

@ -7,7 +7,7 @@
#include "essentials/essentials.hpp"
#include "bit_tools.hpp"
#include "vector_wrapper.hpp"
#include "immutable_vector.hpp"
namespace xcdat {
@ -77,9 +77,9 @@ class bit_vector {
private:
std::uint64_t m_size = 0;
std::uint64_t m_num_ones = 0;
vector_wrapper<std::uint64_t> m_bits;
vector_wrapper<std::uint64_t> m_rank_hints;
vector_wrapper<std::uint64_t> m_select_hints;
immutable_vector<std::uint64_t> m_bits;
immutable_vector<std::uint64_t> m_rank_hints;
immutable_vector<std::uint64_t> m_select_hints;
public:
bit_vector() = default;

View file

@ -3,7 +3,7 @@
#include <array>
#include <string_view>
#include "vector_wrapper.hpp"
#include "immutable_vector.hpp"
namespace xcdat {
@ -11,7 +11,7 @@ class code_table {
private:
std::uint64_t m_max_length = 0;
std::array<std::uint8_t, 512> m_table;
vector_wrapper<std::uint8_t> m_alphabet;
immutable_vector<std::uint8_t> m_alphabet;
struct counter_type {
std::uint8_t ch;

View file

@ -4,7 +4,7 @@
#include "bit_tools.hpp"
#include "exception.hpp"
#include "vector_wrapper.hpp"
#include "immutable_vector.hpp"
namespace xcdat {
@ -14,7 +14,7 @@ class compact_vector {
std::uint64_t m_size = 0;
std::uint64_t m_bits = 0;
std::uint64_t m_mask = 0;
vector_wrapper<std::uint64_t> m_chunks;
immutable_vector<std::uint64_t> m_chunks;
public:
compact_vector() = default;

View file

@ -6,21 +6,21 @@
namespace xcdat {
template <class T>
class vector_wrapper {
class immutable_vector {
private:
std::vector<T> m_vec;
public:
vector_wrapper() = default;
virtual ~vector_wrapper() = default;
immutable_vector() = default;
virtual ~immutable_vector() = default;
vector_wrapper(const vector_wrapper&) = delete;
vector_wrapper& operator=(const vector_wrapper&) = delete;
immutable_vector(const immutable_vector&) = delete;
immutable_vector& operator=(const immutable_vector&) = delete;
vector_wrapper(vector_wrapper&&) noexcept = default;
vector_wrapper& operator=(vector_wrapper&&) noexcept = default;
immutable_vector(immutable_vector&&) noexcept = default;
immutable_vector& operator=(immutable_vector&&) noexcept = default;
explicit vector_wrapper(std::vector<T>&& vec) {
explicit immutable_vector(std::vector<T>&& vec) {
steal(vec);
}
@ -34,7 +34,7 @@ class vector_wrapper {
}
void clear() {
*this = vector_wrapper<T>();
*this = immutable_vector<T>();
}
inline std::uint64_t size() const {

View file

@ -8,7 +8,7 @@
#include "bit_vector.hpp"
#include "exception.hpp"
#include "vector_wrapper.hpp"
#include "immutable_vector.hpp"
namespace xcdat {
@ -116,7 +116,7 @@ class tail_vector {
};
private:
vector_wrapper<char> m_chars;
immutable_vector<char> m_chars;
bit_vector m_terms;
public: