MongoDB  2.7.0
Public Member Functions | List of all members
mongo::StackBufBuilder Class Reference

The StackBufBuilder builds smaller datasets on the stack instead of using malloc. More...

#include <builder.h>

Inheritance diagram for mongo::StackBufBuilder:
mongo::_BufBuilder< StackAllocator >

Public Member Functions

void decouple ()
 
- Public Member Functions inherited from mongo::_BufBuilder< StackAllocator >
 _BufBuilder (int initsize=512)
 
void kill ()
 
void reset ()
 
void reset (int maxSize)
 
char * skip (int n)
 leave room for some stuff later More...
 
char * buf ()
 
const char * buf () const
 
void decouple ()
 
void appendUChar (unsigned char j)
 
void appendChar (char j)
 
void appendNum (char j)
 
void appendNum (short j)
 
void appendNum (int j)
 
void appendNum (unsigned j)
 
void appendNum (bool j)
 
void appendNum (double j)
 
void appendNum (long long j)
 
void appendNum (unsigned long long j)
 
void appendBuf (const void *src, size_t len)
 
void appendStruct (const T &s)
 
void appendStr (const StringData &str, bool includeEndingNull=true)
 
int len () const
 
void setlen (int newLen)
 
int getSize () const
 
char * grow (int by)
 

Detailed Description

The StackBufBuilder builds smaller datasets on the stack instead of using malloc.

this can be significantly faster for small bufs. However, you can not decouple() the buffer with StackBufBuilder. While designed to be a variable on the stack, if you were to dynamically allocate one, nothing bad would happen. In fact in some circumstances this might make sense, say, embedded in some other object.


The documentation for this class was generated from the following file: