proxygen
|
#include <TypedIOBuf.h>
Public Types | |
typedef T | value_type |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef uint32_t | size_type |
typedef value_type * | iterator |
typedef const value_type * | const_iterator |
Public Member Functions | |
TypedIOBuf (IOBuf *buf) | |
IOBuf * | ioBuf () |
const IOBuf * | ioBuf () const |
bool | empty () const |
const T * | data () const |
T * | writableData () |
const T * | tail () const |
T * | writableTail () |
uint32_t | length () const |
uint32_t | size () const |
uint32_t | headroom () const |
uint32_t | tailroom () const |
const T * | buffer () const |
T * | writableBuffer () |
const T * | bufferEnd () const |
uint32_t | capacity () const |
void | advance (uint32_t n) |
void | retreat (uint32_t n) |
void | prepend (uint32_t n) |
void | append (uint32_t n) |
void | trimStart (uint32_t n) |
void | trimEnd (uint32_t n) |
void | clear () |
void | reserve (uint32_t minHeadroom, uint32_t minTailroom) |
void | reserve (uint32_t minTailroom) |
const T * | cbegin () const |
const T * | cend () const |
const T * | begin () const |
const T * | end () const |
T * | begin () |
T * | end () |
const T & | front () const |
T & | front () |
const T & | back () const |
T & | back () |
const T & | operator[] (ssize_t idx) const |
T & | operator[] (ssize_t idx) |
void | push (const T &data) |
void | push_back (const T &data) |
template<class IT > | |
void | push (IT begin, IT end) |
TypedIOBuf (TypedIOBuf &&)=default | |
TypedIOBuf & | operator= (TypedIOBuf &&)=default |
Private Member Functions | |
TypedIOBuf (const TypedIOBuf &)=delete | |
TypedIOBuf & | operator= (const TypedIOBuf &)=delete |
Static Private Member Functions | |
static T * | cast (uint8_t *p) |
static const T * | cast (const uint8_t *p) |
static uint32_t | sdiv (uint32_t n) |
static uint32_t | smul (uint32_t n) |
Private Attributes | |
IOBuf * | buf_ |
Wrapper class to handle a IOBuf as a typed buffer (to a standard layout class).
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.
Definition at line 39 of file TypedIOBuf.h.
typedef const value_type* folly::TypedIOBuf< T >::const_iterator |
Definition at line 48 of file TypedIOBuf.h.
typedef const value_type& folly::TypedIOBuf< T >::const_reference |
Definition at line 45 of file TypedIOBuf.h.
typedef value_type* folly::TypedIOBuf< T >::iterator |
Definition at line 47 of file TypedIOBuf.h.
typedef value_type& folly::TypedIOBuf< T >::reference |
Definition at line 44 of file TypedIOBuf.h.
typedef uint32_t folly::TypedIOBuf< T >::size_type |
Definition at line 46 of file TypedIOBuf.h.
typedef T folly::TypedIOBuf< T >::value_type |
Definition at line 40 of file TypedIOBuf.h.
|
inlineexplicit |
|
default |
|
privatedelete |
|
inline |
Definition at line 99 of file TypedIOBuf.h.
References folly::IOBuf::advance(), folly::TypedIOBuf< T >::buf_, and folly::TypedIOBuf< T >::smul().
|
inline |
Definition at line 108 of file TypedIOBuf.h.
References folly::IOBuf::append(), folly::TypedIOBuf< T >::buf_, and folly::TypedIOBuf< T >::smul().
Referenced by folly::TypedIOBuf< T >::push().
|
inline |
Definition at line 154 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::empty(), and folly::TypedIOBuf< T >::end().
|
inline |
Definition at line 158 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::empty(), and folly::TypedIOBuf< T >::end().
|
inline |
Definition at line 133 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::cbegin().
Referenced by folly::TypedIOBuf< T >::front().
|
inline |
|
inline |
Definition at line 87 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::IOBuf::buffer(), and folly::TypedIOBuf< T >::cast().
|
inline |
Definition at line 93 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::IOBuf::bufferEnd(), and folly::TypedIOBuf< T >::cast().
|
inline |
Definition at line 96 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::IOBuf::capacity(), and folly::TypedIOBuf< T >::sdiv().
Referenced by TEST().
|
inlinestaticprivate |
Definition at line 214 of file TypedIOBuf.h.
References folly::T.
Referenced by folly::TypedIOBuf< T >::buffer(), folly::TypedIOBuf< T >::bufferEnd(), folly::TypedIOBuf< T >::data(), folly::TypedIOBuf< T >::tail(), folly::TypedIOBuf< T >::writableBuffer(), folly::TypedIOBuf< T >::writableData(), and folly::TypedIOBuf< T >::writableTail().
|
inlinestaticprivate |
Definition at line 217 of file TypedIOBuf.h.
References folly::T.
|
inline |
Definition at line 127 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::data().
Referenced by folly::TypedIOBuf< T >::begin().
|
inline |
Definition at line 130 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::tail().
Referenced by folly::TypedIOBuf< T >::end().
|
inline |
Definition at line 117 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, and folly::IOBuf::clear().
|
inline |
Definition at line 62 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::TypedIOBuf< T >::cast(), and folly::IOBuf::data().
Referenced by folly::TypedIOBuf< T >::cbegin(), and folly::TypedIOBuf< T >::operator[]().
|
inline |
Definition at line 59 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, and folly::IOBuf::empty().
Referenced by folly::TypedIOBuf< T >::back(), and folly::TypedIOBuf< T >::front().
|
inline |
Definition at line 136 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::cend().
Referenced by folly::TypedIOBuf< T >::back().
|
inline |
|
inline |
Definition at line 146 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::begin(), and folly::TypedIOBuf< T >::empty().
|
inline |
Definition at line 150 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::begin(), and folly::TypedIOBuf< T >::empty().
|
inline |
Definition at line 81 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::IOBuf::headroom(), and folly::TypedIOBuf< T >::sdiv().
Referenced by folly::TypedIOBuf< T >::push().
|
inline |
Definition at line 52 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_.
|
inline |
Definition at line 55 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_.
|
inline |
Definition at line 74 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::IOBuf::length(), and folly::TypedIOBuf< T >::sdiv().
Referenced by folly::TypedIOBuf< T >::operator[](), and folly::TypedIOBuf< T >::size().
|
default |
Referenced by folly::TypedIOBuf< T >::push().
|
privatedelete |
|
inline |
Simple wrapper to make it easier to treat this TypedIOBuf as an array of T.
Definition at line 167 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::data(), and folly::TypedIOBuf< T >::length().
|
inline |
Definition at line 172 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::length(), and folly::TypedIOBuf< T >::writableData().
|
inline |
Definition at line 105 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::IOBuf::prepend(), and folly::TypedIOBuf< T >::smul().
|
inline |
Append one element.
Definition at line 180 of file TypedIOBuf.h.
Referenced by folly::TypedIOBuf< T >::push_back().
Append multiple elements in a sequence; will call distance().
Definition at line 191 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::append(), folly::copy(), folly::TypedIOBuf< T >::headroom(), max, folly::TypedIOBuf< T >::operator=(), folly::TypedIOBuf< T >::reserve(), folly::TypedIOBuf< T >::size(), folly::TypedIOBuf< T >::tailroom(), folly::TypedIOBuf< T >::TypedIOBuf(), uint32_t, folly::usingJEMalloc(), and folly::TypedIOBuf< T >::writableTail().
|
inline |
|
inline |
Definition at line 120 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::IOBuf::reserve(), and folly::TypedIOBuf< T >::smul().
Referenced by folly::TypedIOBuf< T >::push(), folly::TypedIOBuf< T >::reserve(), and TEST().
|
inline |
Definition at line 123 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::reserve().
|
inline |
Definition at line 102 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::IOBuf::retreat(), and folly::TypedIOBuf< T >::smul().
|
inlinestaticprivate |
Definition at line 221 of file TypedIOBuf.h.
References folly::T.
Referenced by folly::TypedIOBuf< T >::capacity(), folly::TypedIOBuf< T >::headroom(), folly::TypedIOBuf< T >::length(), and folly::TypedIOBuf< T >::tailroom().
|
inline |
Definition at line 77 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::length().
Referenced by folly::TypedIOBuf< T >::push().
|
inlinestaticprivate |
Definition at line 225 of file TypedIOBuf.h.
References folly::T, and uint64_t.
Referenced by folly::TypedIOBuf< T >::advance(), folly::TypedIOBuf< T >::append(), folly::TypedIOBuf< T >::prepend(), folly::TypedIOBuf< T >::reserve(), folly::TypedIOBuf< T >::retreat(), folly::TypedIOBuf< T >::trimEnd(), and folly::TypedIOBuf< T >::trimStart().
|
inline |
Definition at line 68 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::TypedIOBuf< T >::cast(), and folly::IOBuf::tail().
Referenced by folly::TypedIOBuf< T >::cend().
|
inline |
Definition at line 84 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::TypedIOBuf< T >::sdiv(), and folly::IOBuf::tailroom().
Referenced by folly::TypedIOBuf< T >::push().
|
inline |
Definition at line 114 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::TypedIOBuf< T >::smul(), and folly::IOBuf::trimEnd().
|
inline |
Definition at line 111 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::TypedIOBuf< T >::smul(), and folly::IOBuf::trimStart().
|
inline |
Definition at line 90 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::TypedIOBuf< T >::cast(), and folly::IOBuf::writableBuffer().
|
inline |
Definition at line 65 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::TypedIOBuf< T >::cast(), and folly::IOBuf::writableData().
Referenced by folly::TypedIOBuf< T >::begin(), and folly::TypedIOBuf< T >::operator[]().
|
inline |
Definition at line 71 of file TypedIOBuf.h.
References folly::TypedIOBuf< T >::buf_, folly::TypedIOBuf< T >::cast(), and folly::IOBuf::writableTail().
Referenced by folly::TypedIOBuf< T >::end(), and folly::TypedIOBuf< T >::push().
|
private |
Definition at line 231 of file TypedIOBuf.h.
Referenced by folly::TypedIOBuf< T >::advance(), folly::TypedIOBuf< T >::append(), folly::TypedIOBuf< T >::buffer(), folly::TypedIOBuf< T >::bufferEnd(), folly::TypedIOBuf< T >::capacity(), folly::TypedIOBuf< T >::clear(), folly::TypedIOBuf< T >::data(), folly::TypedIOBuf< T >::empty(), folly::TypedIOBuf< T >::headroom(), folly::TypedIOBuf< T >::ioBuf(), folly::TypedIOBuf< T >::length(), folly::TypedIOBuf< T >::prepend(), folly::TypedIOBuf< T >::reserve(), folly::TypedIOBuf< T >::retreat(), folly::TypedIOBuf< T >::tail(), folly::TypedIOBuf< T >::tailroom(), folly::TypedIOBuf< T >::trimEnd(), folly::TypedIOBuf< T >::trimStart(), folly::TypedIOBuf< T >::writableBuffer(), folly::TypedIOBuf< T >::writableData(), and folly::TypedIOBuf< T >::writableTail().