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::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE > Class Template Reference

Helper class for VariantBuilder to manage the storage and encoding of a single multi-sample individual field. More...

#include <variant_builder_individual_field.h>

Public Member Functions

 VariantBuilderIndividualField (const uint32_t num_samples, const uint32_t field_index, const int32_t field_type, const ENCODED_TYPE missing_value, const ENCODED_TYPE end_of_vector_value, const uint32_t short_value_upper_bound)
 
 VariantBuilderIndividualField (VariantBuilderIndividualField &&other)=default
 
VariantBuilderIndividualFieldoperator= (VariantBuilderIndividualField &&other)=default
 
 VariantBuilderIndividualField (const VariantBuilderIndividualField &other)=delete
 
VariantBuilderIndividualFieldoperator= (const VariantBuilderIndividualField &other)=delete
 
 ~VariantBuilderIndividualField ()=default
 
void set_entire_field (std::vector< BULK_CHANGE_TYPE > &&bulk_changes)
 
void set_entire_field (const std::vector< BULK_CHANGE_TYPE > &bulk_changes)
 
void set_entire_field (std::vector< std::vector< BULK_CHANGE_TYPE >> &&bulk_changes)
 
void set_entire_field (const std::vector< std::vector< BULK_CHANGE_TYPE >> &bulk_changes)
 
void set_sample_field_value (const uint32_t sample_index, const ENCODED_TYPE *values, const uint32_t num_values)
 Stores a value for just a single sample efficiently using the ShortValueOptimizedStorage layer. More...
 
uint32_t field_index () const
 
int32_t field_type () const
 
void remove ()
 
bool removed () const
 
bool missing () const
 
bool present () const
 
bool has_bulk_changes () const
 
bool has_per_sample_changes () const
 
void clear ()
 Reset this field to a pristine state with no data. More...
 
uint32_t estimated_encoded_size () const
 Provide an estimate (typically an overestimate) of the number of bytes this field will require when encoded. More...
 
void encode_into (kstring_t *destination) const
 Encode this field's data into the provided buffer. If field has no data or was removed, do nothing. More...
 

Detailed Description

template<class ENCODED_TYPE, class BULK_CHANGE_TYPE>
class gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >

Helper class for VariantBuilder to manage the storage and encoding of a single multi-sample individual field.

Prior to build time, field data is stored in un-encoded form in one of two ways:

-in vectors moved or copied from the user (these represent bulk changes to the entire field)

-in ShortValueOptimizedStorage when there are per-sample changes – this allows us to efficiently handle the setting of many small per-sample values without performing any extra dynamic memory allocation most of the time

There cannot be both bulk and per-sample changes – this is treated as an error, since it would be far too expensive to reconcile the two.

At build time, the raw, un-encoded field data is passed to htslib for encoding into the final byte array for insertion into a Variant object.

Constructor & Destructor Documentation

template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::VariantBuilderIndividualField ( const uint32_t  num_samples,
const uint32_t  field_index,
const int32_t  field_type,
const ENCODED_TYPE  missing_value,
const ENCODED_TYPE  end_of_vector_value,
const uint32_t  short_value_upper_bound 
)
inlineexplicit
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::VariantBuilderIndividualField ( VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE > &&  other)
default
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::VariantBuilderIndividualField ( const VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE > &  other)
delete
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::~VariantBuilderIndividualField ( )
default

Member Function Documentation

template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
void gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::clear ( )
inline

Reset this field to a pristine state with no data.

template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
void gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::encode_into ( kstring_t destination) const
inline

Encode this field's data into the provided buffer. If field has no data or was removed, do nothing.

template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
uint32_t gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::estimated_encoded_size ( ) const
inline

Provide an estimate (typically an overestimate) of the number of bytes this field will require when encoded.

template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
uint32_t gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::field_index ( ) const
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
int32_t gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::field_type ( ) const
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
bool gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::has_bulk_changes ( ) const
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
bool gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::has_per_sample_changes ( ) const
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
bool gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::missing ( ) const
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
VariantBuilderIndividualField& gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::operator= ( VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE > &&  other)
default
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
VariantBuilderIndividualField& gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::operator= ( const VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE > &  other)
delete
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
bool gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::present ( ) const
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
void gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::remove ( )
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
bool gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::removed ( ) const
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
void gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::set_entire_field ( std::vector< BULK_CHANGE_TYPE > &&  bulk_changes)
inline

Bulk setters, allowing field to be set for all samples using one- or two-dimensional vectors, and by move or by copy

template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
void gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::set_entire_field ( const std::vector< BULK_CHANGE_TYPE > &  bulk_changes)
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
void gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::set_entire_field ( std::vector< std::vector< BULK_CHANGE_TYPE >> &&  bulk_changes)
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
void gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::set_entire_field ( const std::vector< std::vector< BULK_CHANGE_TYPE >> &  bulk_changes)
inline
template<class ENCODED_TYPE , class BULK_CHANGE_TYPE >
void gamgee::VariantBuilderIndividualField< ENCODED_TYPE, BULK_CHANGE_TYPE >::set_sample_field_value ( const uint32_t  sample_index,
const ENCODED_TYPE *  values,
const uint32_t  num_values 
)
inline

Stores a value for just a single sample efficiently using the ShortValueOptimizedStorage layer.


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