Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
gamgee::SamBuilderDataField Class Reference

class to hold encoded byte arrays for individual data fields (cigar, bases, etc.) during building of a Sam More...

#include <sam_builder_data_field.h>

Public Member Functions

 SamBuilderDataField ()
 initialize a SamBuilderDataField to an empty value More...
 
 SamBuilderDataField (const void *copy_source, const uint32_t bytes_to_copy, const uint32_t num_elements)
 initialize a SamBuilderDataField by copying data from a raw pointer (takes no ownership of copy_source) More...
 
 SamBuilderDataField (std::unique_ptr< uint8_t[]> &&move_source, const uint32_t source_bytes, const uint32_t num_elements)
 initialize a SamBuilderDataField by moving an existing unique_ptr into it and taking ownership (without copying the existing data) More...
 
 SamBuilderDataField (SamBuilderDataField &&other)
 initialize a SamBuilderDataField via move from an existing field More...
 
SamBuilderDataFieldoperator= (SamBuilderDataField &&other)
 move an existing SamBuildDataField into this one More...
 
 SamBuilderDataField (const SamBuilderDataField &other)=delete
 
SamBuilderDataFieldoperator= (const SamBuilderDataField &other)=delete
 
 ~SamBuilderDataField ()=default
 
const uint8_t * raw_data_ptr () const
 gets a raw pointer to the data buffer More...
 
uint32_t num_bytes () const
 number of bytes in the data buffer More...
 
uint32_t num_elements () const
 number of elements (cigar operations, bases, etc.) in the data buffer More...
 
bool empty () const
 does this field have any data? More...
 
void update (const void *copy_source, const uint32_t bytes_to_copy, const uint32_t num_elements)
 update the field by copying data from a raw pointer (takes no ownership of copy_source) More...
 
void update (std::unique_ptr< uint8_t[]> &&move_source, const uint32_t source_bytes, const uint32_t num_elements)
 update the field by moving an existing unique_ptr into it and taking ownership (without copying the existing data) More...
 
uint8_t * copy_into (uint8_t *destination) const
 copy this field's byte array into an arbitrary location More...
 

Detailed Description

class to hold encoded byte arrays for individual data fields (cigar, bases, etc.) during building of a Sam

Fields can be created/updated either by copying data from raw pointers, or by moving managed pointers into them without copying. Eg.,

auto field = SamBuilderDataField{raw_pointer, num_bytes, num_elements}; // does a copy auto field = SamBuilderDataField{move(unique_ptr), num_bytes, num_elements}; // no copy

After construction, a field's value can be altered via the update() functions

Constructor & Destructor Documentation

gamgee::SamBuilderDataField::SamBuilderDataField ( )

initialize a SamBuilderDataField to an empty value

gamgee::SamBuilderDataField::SamBuilderDataField ( const void *  copy_source,
const uint32_t  bytes_to_copy,
const uint32_t  num_elements 
)
explicit

initialize a SamBuilderDataField by copying data from a raw pointer (takes no ownership of copy_source)

initialize a SamBuilderDataField by copying data from a raw pointer

Note
takes no ownership of copy_source
gamgee::SamBuilderDataField::SamBuilderDataField ( std::unique_ptr< uint8_t[]> &&  move_source,
const uint32_t  source_bytes,
const uint32_t  num_elements 
)
explicit

initialize a SamBuilderDataField by moving an existing unique_ptr into it and taking ownership (without copying the existing data)

initialize a SamBuilderDataField by moving an existing unique_ptr into it (without copying the existing data)

Note
takes ownership of the memory managed by move_source
gamgee::SamBuilderDataField::SamBuilderDataField ( SamBuilderDataField &&  other)

initialize a SamBuilderDataField via move from an existing field

gamgee::SamBuilderDataField::SamBuilderDataField ( const SamBuilderDataField other)
delete
gamgee::SamBuilderDataField::~SamBuilderDataField ( )
default

Member Function Documentation

uint8_t * gamgee::SamBuilderDataField::copy_into ( uint8_t *  destination) const

copy this field's byte array into an arbitrary location

Returns
pointer to the byte just AFTER the end of the copied data
bool gamgee::SamBuilderDataField::empty ( ) const
inline

does this field have any data?

uint32_t gamgee::SamBuilderDataField::num_bytes ( ) const
inline

number of bytes in the data buffer

uint32_t gamgee::SamBuilderDataField::num_elements ( ) const
inline

number of elements (cigar operations, bases, etc.) in the data buffer

SamBuilderDataField & gamgee::SamBuilderDataField::operator= ( SamBuilderDataField &&  other)

move an existing SamBuildDataField into this one

SamBuilderDataField& gamgee::SamBuilderDataField::operator= ( const SamBuilderDataField other)
delete
const uint8_t* gamgee::SamBuilderDataField::raw_data_ptr ( ) const
inline

gets a raw pointer to the data buffer

void gamgee::SamBuilderDataField::update ( const void *  copy_source,
const uint32_t  bytes_to_copy,
const uint32_t  num_elements 
)

update the field by copying data from a raw pointer (takes no ownership of copy_source)

Note
any previous value of m_data is destroyed via the unique_ptr assignment
void gamgee::SamBuilderDataField::update ( std::unique_ptr< uint8_t[]> &&  move_source,
const uint32_t  source_bytes,
const uint32_t  num_elements 
)

update the field by moving an existing unique_ptr into it and taking ownership (without copying the existing data)

Note
any previous value of m_data is destroyed via the unique_ptr assignment

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