Gamgee
You miserable little maggot. I'll stove your head in!
|
A class template to hold the values a format field for a particular sample. More...
#include <individual_field_value.h>
Public Member Functions | |
IndividualFieldValue (const std::shared_ptr< bcf1_t > &body, const bcf_fmt_t *const format_ptr, uint8_t *const data_ptr) | |
creates a new IndividualFieldValue poiinting to the shared byte array inside the variant object More... | |
IndividualFieldValue (const IndividualFieldValue &other)=delete | |
copying of the IndividualFieldValue object is not allowed. More... | |
IndividualFieldValue (IndividualFieldValue &&other) | |
safely moves the data from one IndividualFieldValue to a new one without making any copies More... | |
IndividualFieldValue & | operator= (const IndividualFieldValue &other)=delete |
IndividualFieldValue & | operator= (IndividualFieldValue &&other) |
safely moves the data from one IndividualField to the other without making any copies More... | |
bool | operator== (const IndividualFieldValue &other) const |
compares two IndividualFieldValue objects in the following order: memory address, size and values. More... | |
bool | operator!= (const IndividualFieldValue &other) const |
compares two IndividualFieldValue objects in the following order: memory address, size and values. More... | |
VALUE_TYPE | operator[] (const uint32_t index) const |
random access to the value of a given sample for reading or writing More... | |
IndividualFieldValueIterator < VALUE_TYPE > | begin () const |
create a new begin iterator over the values for this sample More... | |
IndividualFieldValueIterator < VALUE_TYPE > | end () const |
create a new end iterator over the values for this sample More... | |
uint32_t | size () const |
the number of values in this IndividualFieldValue (values per sample) More... | |
VALUE_TYPE | front () const |
convenience function to access the first element More... | |
VALUE_TYPE | back () const |
convenience function to access the last element More... | |
bool | missing () const |
returns true if all of the values are missing More... | |
template<> | |
std::string | operator[] (const uint32_t index) const |
A class template to hold the values a format field for a particular sample.
The role of this class is to perform the pointer manipulations behind the scenes that permit the user to navigate the values of a field in a sample without making any copies and benefiting from data locality (all the data is stored contiguously in memory).
A typical use of the IndividualFieldValue can be exemplified by the phred likelihood accessor in Variant:
IndividualFieldValue objects can also be used in for loops like so:
While the IndividualFieldValue objects are not really intended to be created by the user, they are the returned by the IndividualField iterator for types that don't have a specialized object. Utilizing them correctly can really simplify your work by leveraging the power of the STL functions.
TYPE | the object type that holds the values for each sample. For example for GQ it's a uint8_t, some types like GT can have specialized classes like Genotype. For all other types it can be the IndividualFieldValue. |
|
inline |
creates a new IndividualFieldValue poiinting to the shared byte array inside the variant object
body | the full Variant object where all the values of the field are stored (shared ownership) |
format_ptr | a structure with a pointer to the location in the raw byte array (m_body->indiv) where the format field starts and information about the values (size, type, number,...) |
body | the the bcf1_t structure to hold a shared pointer to |
format_ptr | the format field pointer inside the body |
data_ptr | the location in the specific value inside the format_ptr byte array |
|
delete |
copying of the IndividualFieldValue object is not allowed.
|
inline |
safely moves the data from one IndividualFieldValue to a new one without making any copies
other | another IndividualFieldValue object |
|
inline |
convenience function to access the last element
|
inline |
create a new begin iterator over the values for this sample
|
inline |
create a new end iterator over the values for this sample
|
inline |
convenience function to access the first element
|
inline |
returns true if all of the values are missing
|
inline |
compares two IndividualFieldValue objects in the following order: memory address, size and values.
other | something to compare to |
|
delete |
|
inline |
safely moves the data from one IndividualField to the other without making any copies
other | another IndividualFieldValue object |
|
inline |
compares two IndividualFieldValue objects in the following order: memory address, size and values.
other | something to compare to |
|
inline |
random access to the value of a given sample for reading or writing
index | must be between 0 and the number of values per sample for this record |
std::out_of_range | if sample is out of range |
|
inline |
|
inline |
the number of values in this IndividualFieldValue (values per sample)