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

Read-only contiguous file payload for in-memory FASTX parsing. More...

#include <fastx_file_buffer.hpp>

Public Member Functions

 FastxFileBuffer ()=default
 
 FastxFileBuffer (const FastxFileBuffer &)=delete
 
FastxFileBufferoperator= (const FastxFileBuffer &)=delete
 
 FastxFileBuffer (FastxFileBuffer &&other) noexcept
 
FastxFileBufferoperator= (FastxFileBuffer &&other) noexcept
 
 ~FastxFileBuffer ()
 
std::string_view data () const noexcept
 Contiguous read-only file bytes.
 
bool empty () const noexcept
 True when the file is empty or load produced no bytes.
 

Static Public Member Functions

static Result< std::unique_ptr< FastxFileBuffer > > load (const std::filesystem::path &path)
 Loads an uncompressed file via mmap (Linux) or read into memory.
 

Detailed Description

Read-only contiguous file payload for in-memory FASTX parsing.

Definition at line 26 of file fastx_file_buffer.hpp.

Constructor & Destructor Documentation

◆ FastxFileBuffer() [1/3]

cusbf::detail::FastxFileBuffer::FastxFileBuffer ( )
default

◆ FastxFileBuffer() [2/3]

cusbf::detail::FastxFileBuffer::FastxFileBuffer ( const FastxFileBuffer )
delete

◆ FastxFileBuffer() [3/3]

cusbf::detail::FastxFileBuffer::FastxFileBuffer ( FastxFileBuffer &&  other)
inlinenoexcept

Definition at line 31 of file fastx_file_buffer.hpp.

31 {
32 *this = std::move(other);
33 }
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
Here is the call graph for this function:

◆ ~FastxFileBuffer()

cusbf::detail::FastxFileBuffer::~FastxFileBuffer ( )
inline

Definition at line 53 of file fastx_file_buffer.hpp.

53 {
54 release();
55 }

Member Function Documentation

◆ data()

std::string_view cusbf::detail::FastxFileBuffer::data ( ) const
inlinenoexcept

Contiguous read-only file bytes.

Definition at line 72 of file fastx_file_buffer.hpp.

72 {
73 return std::string_view{data_, size_};
74 }

◆ empty()

bool cusbf::detail::FastxFileBuffer::empty ( ) const
inlinenoexcept

True when the file is empty or load produced no bytes.

Definition at line 77 of file fastx_file_buffer.hpp.

77 {
78 return size_ == 0;
79 }

◆ load()

static Result< std::unique_ptr< FastxFileBuffer > > cusbf::detail::FastxFileBuffer::load ( const std::filesystem::path &  path)
inlinestatic

Loads an uncompressed file via mmap (Linux) or read into memory.

Parameters
pathPath to a non-gzip FASTA/FASTQ file.
Returns
Owning buffer with data() spanning the full file.

Definition at line 63 of file fastx_file_buffer.hpp.

65 {
66 auto buffer = std::make_unique<FastxFileBuffer>();
67 CUSBF_TRY(buffer->load_from_path(path));
68 return buffer;
69 }
#define CUSBF_TRY(expr)
Propagates a cusbf::Result failure from the enclosing function (GNU statement expression).
Definition error.hpp:246
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

FastxFileBuffer & cusbf::detail::FastxFileBuffer::operator= ( const FastxFileBuffer )
delete

◆ operator=() [2/2]

FastxFileBuffer & cusbf::detail::FastxFileBuffer::operator= ( FastxFileBuffer &&  other)
inlinenoexcept

Definition at line 35 of file fastx_file_buffer.hpp.

35 {
36 if (this != &other) {
37 release();
38 owned_storage_ = std::move(other.owned_storage_);
39 data_ = other.data_;
40 size_ = other.size_;
41#if defined(__linux__)
42 mapped_ = other.mapped_;
43 mapped_size_ = other.mapped_size_;
44 other.mapped_ = nullptr;
45 other.mapped_size_ = 0;
46#endif
47 other.data_ = nullptr;
48 other.size_ = 0;
49 }
50 return *this;
51 }
Here is the call graph for this function:

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