cuSBF
Loading...
Searching...
No Matches
query_layout.cuh
Go to the documentation of this file.
1#pragma once
2
3#include <span>
4#include <vector>
5
6#include <cstddef>
7#include <cstdint>
10
11namespace cusbf::detail {
12
21
23 public:
24 [[nodiscard]] std::span<const QueryLayoutRecord> records() const noexcept {
25 return std::span<const QueryLayoutRecord>{records_.data(), records_.size()};
26 }
27
29 return total_hit_count_;
30 }
31
32 [[nodiscard]] std::span<const uint8_t>
33 hits_for_record(std::span<const uint8_t> hits, size_t layout_index) const noexcept {
34 const QueryLayoutRecord& record = records_[layout_index];
35 return std::span<const uint8_t>{
36 hits.data() + static_cast<ptrdiff_t>(record.hit_offset),
37 static_cast<size_t>(record.hit_count)
38 };
39 }
40
41 template <typename Config>
42 [[nodiscard]] static QueryLayout build(std::span<const NormalizedRecord> records) {
44 layout.records_.reserve(records.size());
45
47 for (const NormalizedRecord& record : records) {
48 if (logical_size != 0) {
50 if (remainder != 0) {
52 }
54 }
55
56 const uint64_t hit_count = record_kmer_count<Config>(record.size);
57 layout.records_.push_back(
60 record.input_offset,
61 record.size,
62 record.valid_kmers,
64 hit_count,
65 }
66 );
67 logical_size += record.size;
68 }
69
71 return layout;
72 }
73
74 private:
75 std::vector<QueryLayoutRecord> records_{};
76 uint64_t total_hit_count_{};
77};
78
79} // namespace cusbf::detail
std::span< const uint8_t > hits_for_record(std::span< const uint8_t > hits, size_t layout_index) const noexcept
static QueryLayout build(std::span< const NormalizedRecord > records)
std::span< const QueryLayoutRecord > records() const noexcept
uint64_t total_hit_count() const noexcept
consteval bool separatorPositionAlwaysEncodesInvalid(char *input, uint64_t separatorPosition, uint64_t index)
Recursively tests whether placing the separator byte at any position in an input of valid bytes alway...
Definition Alphabet.cuh:37
static constexpr uint64_t symbolWidth
Input bytes per symbol.
Definition config.cuh:49
Per-record metadata inside a normalized record batch.