14 #ifndef THRILL_NET_BUFFER_HEADER 15 #define THRILL_NET_BUFFER_HEADER 81 std::copy(cdata, cdata + size,
data_);
92 other.data_ =
nullptr;
102 other.data_ =
nullptr;
111 {
return Buffer(
true, data, size); }
121 swap(a.data_, b.data_);
122 swap(a.size_, b.size_);
147 return *(
begin() + i);
152 return *(
begin() + i);
195 LOG1 <<
"Warning: resizing non-empty Buffer";
219 assert(
size_ >= begin + length);
225 return os <<
"[Buffer size=" << b.
size() <<
"]";
243 #endif // !THRILL_NET_BUFFER_HEADER std::string PartialToString(size_t begin, size_t length) const
copy part of contents into std::string
value_type * data_
the buffer, typed as character data
void Resize(size_type new_size)
bool IsValid() const noexcept
Check for Buffer contents is valid.
Buffer(Buffer &&other) noexcept
move-construct other buffer into this one
const_iterator data() const noexcept
return iterator to beginning of Buffer
const_iterator cend() const noexcept
return constant iterator beyond last element
Buffer() noexcept
allocate empty buffer
friend void swap(Buffer &a, Buffer &b) noexcept
swap buffer with another one
const value_type & const_reference
simple pointer references
iterator begin() noexcept
return mutable iterator to first element
value_type * iterator
simple pointer iterators
iterator end() noexcept
return mutable iterator beyond last element
iterator data() noexcept
return iterator to beginning of Buffer
static Buffer Acquire(void *data, size_type size)
unsigned char value_type
value type stored in the buffer
void swap(CountingPtr< A, D > &a1, CountingPtr< A, D > &a2) noexcept
Buffer(size_type n) noexcept
allocate buffer containing n bytes
void * malloc(size_t size) NOEXCEPT
exported malloc symbol that overrides loading from libc
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
reference operator[](size_type i)
return the i-th position of the Buffer
value_type & reference
simple pointer references
size_type size_
size of the buffer.
Buffer(bool, void *data, size_type size)
protected constructor used to acquire ownership of a buffer
void Zero()
Zero the whole array content.
std::string ToString() const
copy contents into std::string
Simple buffer of characters without initialization or growing functionality.
Buffer & operator=(const Buffer &)=delete
non-copyable: delete assignment operator
friend std::ostream & operator<<(std::ostream &os, const Buffer &b)
make ostream-able
const_iterator end() const noexcept
return constant iterator beyond last element
const_iterator cbegin() const noexcept
return constant iterator to first element
const value_type * const_iterator
simple pointer iterators
void free(void *ptr) NOEXCEPT
exported free symbol that overrides loading from libc
size_t size_type
size and offset type of buffer
const_iterator begin() const noexcept
return constant iterator to first element
void * realloc(void *ptr, size_t size) NOEXCEPT
exported realloc() symbol that overrides loading from libc
Buffer(const void *data, size_type size)
allocate buffer and COPY data into it.
size_type size() const noexcept
return number of items in Buffer