cuSBF
Loading...
Searching...
No Matches
Public Member Functions | List of all members
cusbf::DenseRecordBatchBuilder Class Reference

Accumulates parsed FASTX records into a dense RecordBatchView. More...

#include <Fastx.hpp>

Public Member Functions

 DenseRecordBatchBuilder (uint64_t reserve_bytes=0)
 
std::string_view sequence_view () const noexcept
 Dense sequence buffer backing view (owned or mmap-external).
 
RecordBatchView view () const noexcept
 Non-owning RecordBatchView over the accumulated records.
 
void appendRecord (std::string_view record_sequence)
 Appends one record payload and records its byte range.
 
void push_range (RecordRange range)
 Records a range already present in sequence_view.
 
std::string & sequence_buffer () noexcept
 
std::string_view & external_sequence_slot () noexcept
 
bool empty () const noexcept
 
uint64_t recordCount () const noexcept
 
uint64_t raw_sequence_bytes () const noexcept
 Sum of record payload bytes (ignores mmap storage outside ranges).
 
const std::vector< RecordRange > & ranges () const noexcept
 
void clear ()
 
void clear_and_shrink ()
 

Detailed Description

Accumulates parsed FASTX records into a dense RecordBatchView.

Payloads are stored back-to-back without alphabet separators. Normalization (separator injection and per-record metadata) is performed separately via normalize_record_batch_into.

Definition at line 46 of file Fastx.hpp.

Constructor & Destructor Documentation

◆ DenseRecordBatchBuilder()

cusbf::DenseRecordBatchBuilder::DenseRecordBatchBuilder ( uint64_t  reserve_bytes = 0)
inlineexplicit

Definition at line 48 of file Fastx.hpp.

48 {
49 if (reserve_bytes != 0) {
50 sequence_.reserve(static_cast<size_t>(reserve_bytes));
51 }
52 }

Member Function Documentation

◆ appendRecord()

void cusbf::DenseRecordBatchBuilder::appendRecord ( std::string_view  record_sequence)
inline

Appends one record payload and records its byte range.

Definition at line 68 of file Fastx.hpp.

68 {
69 assert(external_sequence_.empty() && "cannot appendRecord when external_sequence_ is set");
70 ranges_.push_back(
71 RecordRange{
72 static_cast<uint64_t>(sequence_.size()),
73 static_cast<uint64_t>(record_sequence.size()),
74 }
75 );
76 sequence_.append(record_sequence);
77 }

◆ clear()

void cusbf::DenseRecordBatchBuilder::clear ( )
inline

Definition at line 116 of file Fastx.hpp.

116 {
117 sequence_.clear();
118 ranges_.clear();
119 external_sequence_ = {};
120 }
Here is the caller graph for this function:

◆ clear_and_shrink()

void cusbf::DenseRecordBatchBuilder::clear_and_shrink ( )
inline

Definition at line 122 of file Fastx.hpp.

122 {
123 clear();
124 std::string{}.swap(sequence_);
125 std::vector<RecordRange>{}.swap(ranges_);
126 }
Here is the call graph for this function:

◆ empty()

bool cusbf::DenseRecordBatchBuilder::empty ( ) const
inlinenoexcept

Definition at line 92 of file Fastx.hpp.

92 {
93 return ranges_.empty();
94 }

◆ external_sequence_slot()

std::string_view & cusbf::DenseRecordBatchBuilder::external_sequence_slot ( )
inlinenoexcept

Definition at line 88 of file Fastx.hpp.

88 {
89 return external_sequence_;
90 }

◆ push_range()

void cusbf::DenseRecordBatchBuilder::push_range ( RecordRange  range)
inline

Records a range already present in sequence_view.

Definition at line 80 of file Fastx.hpp.

80 {
81 ranges_.push_back(range);
82 }

◆ ranges()

const std::vector< RecordRange > & cusbf::DenseRecordBatchBuilder::ranges ( ) const
inlinenoexcept

Definition at line 112 of file Fastx.hpp.

112 {
113 return ranges_;
114 }

◆ raw_sequence_bytes()

uint64_t cusbf::DenseRecordBatchBuilder::raw_sequence_bytes ( ) const
inlinenoexcept

Sum of record payload bytes (ignores mmap storage outside ranges).

Definition at line 101 of file Fastx.hpp.

101 {
102 if (!external_sequence_.empty()) {
103 uint64_t total = 0;
104 for (const RecordRange& range : ranges_) {
105 total += range.sequenceBytes;
106 }
107 return total;
108 }
109 return static_cast<uint64_t>(sequence_.size());
110 }

◆ recordCount()

uint64_t cusbf::DenseRecordBatchBuilder::recordCount ( ) const
inlinenoexcept

Definition at line 96 of file Fastx.hpp.

96 {
97 return static_cast<uint64_t>(ranges_.size());
98 }

◆ sequence_buffer()

std::string & cusbf::DenseRecordBatchBuilder::sequence_buffer ( )
inlinenoexcept

Definition at line 84 of file Fastx.hpp.

84 {
85 return sequence_;
86 }

◆ sequence_view()

std::string_view cusbf::DenseRecordBatchBuilder::sequence_view ( ) const
inlinenoexcept

Dense sequence buffer backing view (owned or mmap-external).

Definition at line 55 of file Fastx.hpp.

55 {
56 return external_sequence_.empty() ? std::string_view{sequence_} : external_sequence_;
57 }
Here is the caller graph for this function:

◆ view()

RecordBatchView cusbf::DenseRecordBatchBuilder::view ( ) const
inlinenoexcept

Non-owning RecordBatchView over the accumulated records.

Definition at line 60 of file Fastx.hpp.

60 {
61 return RecordBatchView{
63 std::span<const RecordRange>{ranges_.data(), ranges_.size()},
64 };
65 }
std::string_view sequence_view() const noexcept
Dense sequence buffer backing view (owned or mmap-external).
Definition Fastx.hpp:55
Here is the call graph for this function:

The documentation for this class was generated from the following file: