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::IndividualFieldValueIterator< VALUE_TYPE > Class Template Reference

iterator for FormatFieldGenericValue objects. More...

#include <individual_field_value_iterator.h>

Inheritance diagram for gamgee::IndividualFieldValueIterator< VALUE_TYPE >:

Public Member Functions

 IndividualFieldValueIterator (const std::shared_ptr< bcf1_t > &body, uint8_t *data_ptr, uint8_t *end_ptr, const uint8_t num_bytes, const utils::VariantFieldType &type)
 Constructor with bcf1_t structure and start and end pointers of the array/vector. More...
 
 IndividualFieldValueIterator (const std::shared_ptr< bcf1_t > &body, uint8_t *data_ptr, const uint8_t num_bytes, const utils::VariantFieldType &type)
 Constructor with bcf1_t structure and start pointer of the array/vector. More...
 
 IndividualFieldValueIterator (const IndividualFieldValueIterator &other)
 copy constructor is only meant for internal STL functions use. It makes a shallow copy of the underlying object which is sufficient for an iterator, but not exactly what a user would expect (user should expect copy constructors to make deep copies). But a deep copied iterator makes no sense. More...
 
 IndividualFieldValueIterator (IndividualFieldValueIterator &&other) noexcept
 copy constructor is only meant for internal STL functions use. It makes a shallow copy of the underlying object which is sufficient for an iterator, but not exactly what a user would expect (user should expect copy constructors to make deep copies). But a deep copied iterator makes no sense. More...
 
IndividualFieldValueIteratoroperator= (const IndividualFieldValueIterator &other)
 copy constructor is only meant for internal STL functions use. It makes a shallow copy of the underlying object which is sufficient for an iterator, but not exactly what a user would expect (user should expect copy constructors to make deep copies). But a deep copied iterator makes no sense. More...
 
IndividualFieldValueIteratoroperator= (IndividualFieldValueIterator &&other) noexcept
 safely moves the data from one VariantField to a new one without making any copies More...
 
IndividualFieldValueIteratoroperator+= (const int n)
 simple compound assignment operation for random advances (back/forward) to the iterator More...
 
IndividualFieldValueIteratoroperator-= (const int n)
 simple compound assignment operation for random advances (back/forward) to the iterator More...
 
bool operator== (const IndividualFieldValueIterator &other)
 two iterators are equal if they are in exactly the same state (pointing at the same location in memory More...
 
bool operator!= (const IndividualFieldValueIterator &other)
 the oposite check of IndividualFieldValueIterator::operator==() More...
 
bool operator< (const IndividualFieldValueIterator &other)
 an operator is greater/less than another iterator if it is pointing to a previous element (sample) in the FormatField object. The order is determined by the Variant record. More...
 
bool operator> (const IndividualFieldValueIterator &other)
 an operator is greater/less than another iterator if it is pointing to a previous element (sample) in the FormatField object. The order is determined by the Variant record. More...
 
bool operator<= (const IndividualFieldValueIterator &other)
 an operator is greater/less than another iterator if it is pointing to a previous element (sample) in the FormatField object. The order is determined by the Variant record. More...
 
bool operator>= (const IndividualFieldValueIterator &other)
 an operator is greater/less than another iterator if it is pointing to a previous element (sample) in the FormatField object. The order is determined by the Variant record. More...
 
VALUE_TYPE operator* () const noexcept
 direct access to the value of the current sample More...
 
VALUE_TYPE read_and_cache_current_pointee () noexcept
 
IndividualFieldValueIteratoroperator++ () noexcept
 advances to the next sample More...
 
IndividualFieldValueIterator operator++ (int) noexcept
 postfix operator to advance iterator to the next position More...
 
IndividualFieldValueIteratoroperator-- ()
 advances to the previous sample More...
 
IndividualFieldValueIterator operator-- (int) noexcept
 postfix operator to retreat iterator to the previous position More...
 
VALUE_TYPE operator[] (const uint32_t index) const
 random access to the value of a given index for reading or writing More...
 

Detailed Description

template<class VALUE_TYPE>
class gamgee::IndividualFieldValueIterator< VALUE_TYPE >

iterator for FormatFieldGenericValue objects.

This iterator will walk through all the values for a sample for a given FormatFieldGenericValue object. For example if you want to iterate over all the GQ values of a Variant record you would do so through this iterator.

Note
implements a random access iterator which gives you full performance on STL algorithms that use iterators (mostly every one)
this iterator never makes any copies of the underlying memory. It is implemented with pointer acrobatics behind the scenes for maximum performance while maintaining a friendly interface.
Warning
modifying any elements via this iterator will modify the values in the Variant record.

Constructor & Destructor Documentation

template<class VALUE_TYPE >
gamgee::IndividualFieldValueIterator< VALUE_TYPE >::IndividualFieldValueIterator ( const std::shared_ptr< bcf1_t > &  body,
uint8_t *  data_ptr,
uint8_t *  end_ptr,
const uint8_t  num_bytes,
const utils::VariantFieldType type 
)
inlineexplicit

Constructor with bcf1_t structure and start and end pointers of the array/vector.

Parameters
bodya pointer to the bcf1_t data structure to be held as a shared pointer
data_ptrthe byte array containing the value(s) for this sample
end_ptrpointer to the end of the byte array
num_bytesnumber of bytes in each value
typethe encoding of the value
Note
this constructor is probably only used by IndividualFieldValue::begin() and IndividualFieldValue::end()
template<class VALUE_TYPE >
gamgee::IndividualFieldValueIterator< VALUE_TYPE >::IndividualFieldValueIterator ( const std::shared_ptr< bcf1_t > &  body,
uint8_t *  data_ptr,
const uint8_t  num_bytes,
const utils::VariantFieldType type 
)
inlineexplicit

Constructor with bcf1_t structure and start pointer of the array/vector.

Parameters
bodya pointer to the bcf1_t data structure to be held as a shared pointer
data_ptrthe byte array containing the value(s) for this sample
num_bytesnumber of bytes in each value
typethe encoding of the value
Note
this constructor is probably only used by IndividualFieldValue::begin() and IndividualFieldValue::end()
template<class VALUE_TYPE >
gamgee::IndividualFieldValueIterator< VALUE_TYPE >::IndividualFieldValueIterator ( const IndividualFieldValueIterator< VALUE_TYPE > &  other)
inline

copy constructor is only meant for internal STL functions use. It makes a shallow copy of the underlying object which is sufficient for an iterator, but not exactly what a user would expect (user should expect copy constructors to make deep copies). But a deep copied iterator makes no sense.

Warning
does not deep copy the underlying data! (but the copied iterator will be able to navigate independentely).
template<class VALUE_TYPE >
gamgee::IndividualFieldValueIterator< VALUE_TYPE >::IndividualFieldValueIterator ( IndividualFieldValueIterator< VALUE_TYPE > &&  other)
inlinenoexcept

copy constructor is only meant for internal STL functions use. It makes a shallow copy of the underlying object which is sufficient for an iterator, but not exactly what a user would expect (user should expect copy constructors to make deep copies). But a deep copied iterator makes no sense.

Warning
does not deep copy the underlying data! (but the copied iterator will be able to navigate independentely).

Member Function Documentation

template<class VALUE_TYPE >
bool gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator!= ( const IndividualFieldValueIterator< VALUE_TYPE > &  other)
inline
template<class VALUE_TYPE >
VALUE_TYPE gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator* ( ) const
inlinenoexcept

direct access to the value of the current sample

Returns
the value in its native type
template<class VALUE_TYPE >
IndividualFieldValueIterator& gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator++ ( )
inlinenoexcept

advances to the next sample

Note
mainly designed for iterators
Warning
does not check for bounds exception, you should verify whether or not you've reached the end by comparing the result of operator* with end(). This is the STL way.
Returns
modified iterator
template<class VALUE_TYPE >
IndividualFieldValueIterator gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator++ ( int  )
inlinenoexcept

postfix operator to advance iterator to the next position

Note
mainly designed for iterators
Warning
does not check for bounds exception, you should verify whether or not you've reached the end by comparing the result of operator* with end(). This is the STL way.
Returns
copy of iterator at current position (before the increment)
template<class VALUE_TYPE >
IndividualFieldValueIterator& gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator+= ( const int  n)
inline

simple compound assignment operation for random advances (back/forward) to the iterator

Parameters
nhow much to advance (negative numbers to go the other direction)
Warning
there is no boundary check in this operator
template<class VALUE_TYPE >
IndividualFieldValueIterator& gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator-- ( )
inline

advances to the previous sample

Note
mainly designed for iterators
Warning
does not check for bounds exception, you should verify whether or not you've reached the end by comparing the result of operator* with end(). This is the STL way.
Returns
modified iterator
template<class VALUE_TYPE >
IndividualFieldValueIterator gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator-- ( int  )
inlinenoexcept

postfix operator to retreat iterator to the previous position

Note
mainly designed for iterators
Warning
does not check for bounds exception, you should verify whether or not you've reached the end by comparing the result of operator* with end(). This is the STL way.
Returns
copy of iterator at current position (before the decrement)
template<class VALUE_TYPE >
IndividualFieldValueIterator& gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator-= ( const int  n)
inline

simple compound assignment operation for random advances (back/forward) to the iterator

Parameters
nhow much to advance (negative numbers to go the other direction)
Warning
there is no boundary check in this operator
template<class VALUE_TYPE >
bool gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator< ( const IndividualFieldValueIterator< VALUE_TYPE > &  other)
inline

an operator is greater/less than another iterator if it is pointing to a previous element (sample) in the FormatField object. The order is determined by the Variant record.

template<class VALUE_TYPE >
bool gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator<= ( const IndividualFieldValueIterator< VALUE_TYPE > &  other)
inline

an operator is greater/less than another iterator if it is pointing to a previous element (sample) in the FormatField object. The order is determined by the Variant record.

template<class VALUE_TYPE >
IndividualFieldValueIterator& gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator= ( const IndividualFieldValueIterator< VALUE_TYPE > &  other)
inline

copy constructor is only meant for internal STL functions use. It makes a shallow copy of the underlying object which is sufficient for an iterator, but not exactly what a user would expect (user should expect copy constructors to make deep copies). But a deep copied iterator makes no sense.

Warning
does not deep copy the underlying data! (but the copied iterator will be able to navigate independentely).
template<class VALUE_TYPE >
IndividualFieldValueIterator& gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator= ( IndividualFieldValueIterator< VALUE_TYPE > &&  other)
inlinenoexcept

safely moves the data from one VariantField to a new one without making any copies

Parameters
otheranother VariantField object
template<class VALUE_TYPE >
bool gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator== ( const IndividualFieldValueIterator< VALUE_TYPE > &  other)
inline

two iterators are equal if they are in exactly the same state (pointing at the same location in memory

template<class VALUE_TYPE >
bool gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator> ( const IndividualFieldValueIterator< VALUE_TYPE > &  other)
inline

an operator is greater/less than another iterator if it is pointing to a previous element (sample) in the FormatField object. The order is determined by the Variant record.

template<class VALUE_TYPE >
bool gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator>= ( const IndividualFieldValueIterator< VALUE_TYPE > &  other)
inline

an operator is greater/less than another iterator if it is pointing to a previous element (sample) in the FormatField object. The order is determined by the Variant record.

template<class VALUE_TYPE >
VALUE_TYPE gamgee::IndividualFieldValueIterator< VALUE_TYPE >::operator[] ( const uint32_t  index) const
inline

random access to the value of a given index for reading or writing

Parameters
indexmust be between 0 and the number of indices for this record but no boundary check is done in this implementation
Note
implementation guarantees this operation to be O(1)
Warning
does not check for bounds exception, you should verify whether or not you've reached the end by comparing the result of operator* with end(). This is the STL way.
Returns
the value in it's native type
template<class VALUE_TYPE >
VALUE_TYPE gamgee::IndividualFieldValueIterator< VALUE_TYPE >::read_and_cache_current_pointee ( )
inlinenoexcept

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