15 #ifndef _DATAT_BITS_INCLUDE_TAG
16 #error Must only be included from sag_connectivity_cpp.hpp, use that instead
27 class buffer_t:
protected sag_underlying_buffer_t
53 swap(std::move(other));
60 swap(std::move(other));
65 std::swap(table, other.table);
78 typedef uint8_t *iterator;
79 typedef const uint8_t *const_iterator;
84 return (this->
size() == other.
size() &&
98 iterator
begin() {
return table?table->data:0; }
100 iterator
end() {
return table?table->data+table->length:0; }
102 const_iterator
begin()
const {
return table?table->data:0; }
104 const_iterator
end()
const {
return table?table->data+table->length:0; }
106 const_iterator
cbegin()
const {
return table?table->data:0; }
108 const_iterator
cend()
const {
return table?table->data+table->length:0; }
111 size_t size()
const {
return table ? table->length : 0; }
119 if (n >=
size())
throw std::runtime_error(
"Out of bounds");
120 return table->data[n];
126 if (n >=
size())
throw std::runtime_error(
"Out of bounds");
127 return table->data[n];
bool empty() const
Returns true if the buffer is unallocated (size() == 0)
Definition: buffer_t.hpp:113
~buffer_t()
Free the underlying buffer contents.
Definition: buffer_t.hpp:40
bool operator==(const buffer_t &other) const
Returns true if both buffers are the same size and have the same contents.
Definition: buffer_t.hpp:82
buffer_t(buffer_t &&other)
Move constructor.
Definition: buffer_t.hpp:57
buffer_t & operator=(buffer_t &&other)
Move assignment.
Definition: buffer_t.hpp:47
size_t size() const
Returns the size of the buffer.
Definition: buffer_t.hpp:111
const_iterator end() const
Forward const_iterator end.
Definition: buffer_t.hpp:104
void swap(buffer_t &&other)
Swap the contents of this buffer and other.
Definition: buffer_t.hpp:63
A class that holds an untyped byte buffer.
Definition: buffer_t.hpp:27
bool operator!=(const buffer_t &other) const
Returns true if both buffers are different sizes or have different contents.
Definition: buffer_t.hpp:89
iterator begin()
Forward iterator begin.
Definition: buffer_t.hpp:98
buffer_t()
Construct an empty buffer.
Definition: buffer_t.hpp:32
uint8_t & operator[](size_t n)
Return a reference to the byte at the given offset.
Definition: buffer_t.hpp:117
const_iterator cend() const
Forward const_iterator end.
Definition: buffer_t.hpp:108
iterator end()
Forward iterator end.
Definition: buffer_t.hpp:100
A variant type which can be one of the following:
Definition: data_t.hpp:42
buffer_t copy() const
Return a deep copy of this buffer.
const_iterator begin() const
Forward const_iterator begin.
Definition: buffer_t.hpp:102
const uint8_t & operator[](size_t n) const
Return a reference the byte at the given offset.
Definition: buffer_t.hpp:124
void clear()
Free the underlying buffer;.
const_iterator cbegin() const
Forward const_iterator begin.
Definition: buffer_t.hpp:106