Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sam_builder_data_field.h
Go to the documentation of this file.
1 #ifndef gamgee__sam_builder_data_field__guard
2 #define gamgee__sam_builder_data_field__guard
3 
4 #include <memory>
5 
6 namespace gamgee {
7 
20  public:
22  explicit SamBuilderDataField(const void* copy_source, const uint32_t bytes_to_copy, const uint32_t num_elements);
23  explicit SamBuilderDataField(std::unique_ptr<uint8_t[]>&& move_source, const uint32_t source_bytes, const uint32_t num_elements);
26 
27  // Fields cannot be copied (only moved), and use default destruction
28  SamBuilderDataField(const SamBuilderDataField& other) = delete;
29  SamBuilderDataField& operator=(const SamBuilderDataField& other) = delete;
30  ~SamBuilderDataField() = default;
31 
32  const uint8_t* raw_data_ptr() const { return m_data.get(); }
33  uint32_t num_bytes() const { return m_num_bytes; }
34  uint32_t num_elements() const { return m_num_elements; }
35  bool empty() const { return m_num_bytes == 0; }
36 
37  void update(const void* copy_source, const uint32_t bytes_to_copy, const uint32_t num_elements);
38  void update(std::unique_ptr<uint8_t[]>&& move_source, const uint32_t source_bytes, const uint32_t num_elements);
39  uint8_t* copy_into(uint8_t* destination) const;
40 
41  private:
42  std::unique_ptr<uint8_t[]> m_data;
43  uint32_t m_num_bytes;
44  uint32_t m_num_elements;
45 };
46 
47 }
48 
49 #endif /* gamgee__sam_builder_data_field__guard */
class to hold encoded byte arrays for individual data fields (cigar, bases, etc.) during building of ...
Definition: sam_builder_data_field.h:19
SamBuilderDataField & operator=(SamBuilderDataField &&other)
move an existing SamBuildDataField into this one
Definition: sam_builder_data_field.cpp:54
SamBuilderDataField()
initialize a SamBuilderDataField to an empty value
Definition: sam_builder_data_field.cpp:12
bool empty() const
does this field have any data?
Definition: sam_builder_data_field.h:35
uint32_t num_elements() const
number of elements (cigar operations, bases, etc.) in the data buffer
Definition: sam_builder_data_field.h:34
Definition: exceptions.h:9
uint32_t num_bytes() const
number of bytes in the data buffer
Definition: sam_builder_data_field.h:33
uint8_t * copy_into(uint8_t *destination) const
copy this field's byte array into an arbitrary location
Definition: sam_builder_data_field.cpp:92
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) ...
Definition: sam_builder_data_field.cpp:69
const uint8_t * raw_data_ptr() const
gets a raw pointer to the data buffer
Definition: sam_builder_data_field.h:32