#include <alignedbuilder.h>
Classes | |
struct | AllocationInfo |
Public Member Functions | |
AlignedBuilder (unsigned init_size) | |
void | appendBuf (const void *src, size_t len) |
void | appendChar (char j) |
void | appendNum (unsigned long long j) |
void | appendNum (long long j) |
void | appendNum (double j) |
void | appendNum (bool j) |
void | appendNum (unsigned j) |
void | appendNum (int j) |
void | appendNum (short j) |
void | appendNum (char j) |
void | appendStr (const StringData &str, bool includeEOO=true) |
template<class T > | |
void | appendStruct (const T &s) |
char * | atOfs (unsigned ofs) |
const char * | buf () const |
unsigned | len () const |
void | reset () |
size_t | skip (unsigned n) |
~AlignedBuilder () | |
Private Member Functions | |
void | _free (void *) |
void | _malloc (unsigned sz) |
void | _realloc (unsigned newSize, unsigned oldLenInUse) |
char * | grow (unsigned by) |
void | growReallocate (unsigned oldLenInUse) |
void | kill () |
void | mallocSelfAligned (unsigned sz) |
Private Attributes | |
unsigned | _len |
struct mongo::AlignedBuilder::AllocationInfo | _p |
Static Private Attributes | |
static const unsigned | Alignment = 8192 |
a page-aligned BufBuilder.
Definition at line 26 of file alignedbuilder.h.
mongo::AlignedBuilder::AlignedBuilder | ( | unsigned | init_size | ) |
mongo::AlignedBuilder::~AlignedBuilder | ( | ) | [inline] |
Definition at line 29 of file alignedbuilder.h.
void mongo::AlignedBuilder::_free | ( | void * | ) | [private] |
void mongo::AlignedBuilder::_malloc | ( | unsigned | sz | ) | [private] |
void mongo::AlignedBuilder::_realloc | ( | unsigned | newSize, | |
unsigned | oldLenInUse | |||
) | [private] |
void mongo::AlignedBuilder::appendBuf | ( | const void * | src, | |
size_t | len | |||
) | [inline] |
Definition at line 81 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendChar | ( | char | j | ) | [inline] |
Definition at line 53 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendNum | ( | unsigned long long | j | ) | [inline] |
Definition at line 77 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendNum | ( | long long | j | ) | [inline] |
Definition at line 74 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendNum | ( | double | j | ) | [inline] |
Definition at line 71 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendNum | ( | bool | j | ) | [inline] |
Definition at line 68 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendNum | ( | unsigned | j | ) | [inline] |
Definition at line 65 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendNum | ( | int | j | ) | [inline] |
Definition at line 62 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendNum | ( | short | j | ) | [inline] |
Definition at line 59 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendNum | ( | char | j | ) | [inline] |
Definition at line 56 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendStr | ( | const StringData & | str, | |
bool | includeEOO = true | |||
) | [inline] |
Definition at line 86 of file alignedbuilder.h.
void mongo::AlignedBuilder::appendStruct | ( | const T & | s | ) | [inline] |
Definition at line 84 of file alignedbuilder.h.
char* mongo::AlignedBuilder::atOfs | ( | unsigned | ofs | ) | [inline] |
Definition at line 51 of file alignedbuilder.h.
const char* mongo::AlignedBuilder::buf | ( | ) | const [inline] |
note this may be deallocated (realloced) if you keep writing or reset().
Definition at line 40 of file alignedbuilder.h.
char* mongo::AlignedBuilder::grow | ( | unsigned | by | ) | [inline, private] |
returns the pre-grow write position
Definition at line 99 of file alignedbuilder.h.
void mongo::AlignedBuilder::growReallocate | ( | unsigned | oldLenInUse | ) | [private] |
void mongo::AlignedBuilder::kill | ( | ) | [private] |
unsigned mongo::AlignedBuilder::len | ( | ) | const [inline] |
Definition at line 93 of file alignedbuilder.h.
void mongo::AlignedBuilder::mallocSelfAligned | ( | unsigned | sz | ) | [private] |
void mongo::AlignedBuilder::reset | ( | ) | [inline] |
reset for a re-use. shrinks if > 128MB
Definition at line 32 of file alignedbuilder.h.
size_t mongo::AlignedBuilder::skip | ( | unsigned | n | ) | [inline] |
leave room for some stuff later
Definition at line 45 of file alignedbuilder.h.
unsigned mongo::AlignedBuilder::_len [private] |
Definition at line 120 of file alignedbuilder.h.
struct mongo::AlignedBuilder::AllocationInfo mongo::AlignedBuilder::_p [private] |
const unsigned mongo::AlignedBuilder::Alignment = 8192 [static, private] |
Definition at line 96 of file alignedbuilder.h.