folly::TypedIOBuf

Wrapper class to handle a IOBuf as a typed buffer (to a standard layout class).

Synopsis

Declared in <folly/io/TypedIOBuf.h>

template<class T>
class TypedIOBuf;

Description

This class punts on alignment, and assumes that you know what you're doing.

All methods are wrappers around the corresponding IOBuf methods. The TypedIOBuf object is stateless, so it's perfectly okay to access the underlying IOBuf in between TypedIOBuf method calls.

Type Aliases

NameDescription
const_iterator Const element iterator.
const_reference Const reference to an element.
iterator Mutable element iterator.
reference Reference to an element.
size_type Type used for element counts.
value_type The element type stored in the buffer.

Member Functions

NameDescription
TypedIOBuf [constructor]Constructors
operator= Move assignment operator.
advance Advances the data pointer forward by n elements.
append Appends n elements from the tailroom.
back Returns the last element.
begin begin overloads
buffer Returns a pointer to the start of the allocated buffer.
bufferEnd Returns a pointer just past the end of the allocated buffer.
capacity Returns the buffer capacity, in elements.
cbegin Returns a const iterator to the first element.
cend Returns a const iterator just past the last element.
clear Resets the buffer to empty.
data Returns a pointer to the first element.
empty Returns true if the buffer holds no elements.
end end overloads
front Returns the first element.
headroom Returns the available headroom, in elements.
ioBuf Returns the underlying IOBuf.
length Returns the number of elements in the buffer.
operator[] Subscript operators
prepend Prepends n elements from the headroom.
push push overloads
push_back Appends one element.
reserve reserve overloads
retreat Moves the data pointer backward by n elements.
size Returns the number of elements in the buffer.
tail Returns a pointer just past the last element.
tailroom Returns the available tailroom, in elements.
trimEnd Removes n elements from the end.
trimStart Removes n elements from the start.
writableBuffer Returns a writable pointer to the start of the allocated buffer.
writableData Returns a writable pointer to the first element.
writableTail Returns a writable pointer just past the last element.