35 const std::uint8_t* data,
37 std::size_t byte_size,
38 std::size_t offset = 0
55 template <typename SizeType =
std::
size_t>
78 template <std::
integral BlockType>
80 const BlockType* data,
107 template <std::
integral BlockType>
111 const auto* byte_data =
reinterpret_cast<const std::uint8_t*
>(data);
112 const std::size_t byte_size = block_count *
sizeof(BlockType);
113 m_null_count =
static_cast<size_type>(bit_size)
116 static_cast<std::size_t
>(bit_size),
118 static_cast<std::size_t
>(offset)
124 if (new_value && !old_value)
128 else if (!new_value && old_value)
136 std::swap(m_null_count, other.m_null_count);
146 size_type m_null_count = 0;
163 template <
typename SizeType = std::
size_t>
181 template <std::
integral BlockType>
197 template <std::
integral BlockType>
232 template <
typename P>
233 concept null_count_policy =
requires(P p, P other,
bool b,
typename P::size_type s,
const std::uint8_t* data) {
234 { P::track_null_count } -> std::convertible_to<bool>;
235 { p.update_null_count(b, b) } -> std::same_as<void>;
236 { p.swap_null_count(other) } -> std::same_as<void>;
237 { p.clear_null_count() } -> std::same_as<void>;
238 { p.set_null_count(s) } -> std::same_as<void>;
239 { p.initialize_null_count(data, s, s) } -> std::same_as<void>;
240 { p.recompute_null_count(data, s, s) } -> std::same_as<void>;
constexpr void initialize_null_count(const BlockType *, size_type, size_type, size_type=0) noexcept
constexpr void recompute_null_count(const BlockType *, size_type, size_type, size_type=0) noexcept
constexpr void set_null_count(size_type) noexcept
constexpr void clear_null_count() noexcept
constexpr void update_null_count(bool, bool) noexcept
static constexpr bool track_null_count
constexpr non_tracking_null_count() noexcept=default
constexpr void swap_null_count(non_tracking_null_count &) noexcept
void initialize_null_count(const BlockType *data, size_type bit_size, size_type block_count, size_type offset=0) noexcept
Initializes the null count by counting bits in the buffer.
constexpr size_type null_count() const noexcept
constexpr void set_null_count(size_type count) noexcept
constexpr void swap_null_count(tracking_null_count &other) noexcept
constexpr tracking_null_count() noexcept=default
void recompute_null_count(const BlockType *data, size_type bit_size, size_type block_count, size_type offset=0) noexcept
Recomputes the null count from the buffer.
constexpr void clear_null_count() noexcept
constexpr void update_null_count(bool old_value, bool new_value) noexcept
static constexpr bool track_null_count
Concept that checks if a type is a valid null count policy.
SPARROW_API std::size_t count_non_null(const std::uint8_t *data, std::size_t bit_size, std::size_t byte_size, std::size_t offset=0) noexcept
Counts the number of bits set to true in a buffer.
Extensions to the C++ standard library.