Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
net_instaweb::CircularBuffer Class Reference

#include "circular_buffer.h"

Public Member Functions

void Clear ()
bool Write (const StringPiece &message)
 Write message to buffer.
GoogleString ToString (MessageHandler *handler)
 Return data content as string.

Static Public Member Functions

static CircularBufferCreate (const int capacity)
 Instantiate buffer with malloc.
static CircularBufferInit (bool parent, void *block, const int block_size, const int capacity)
static int Sizeof (const int capacity)

Detailed Description

CircularBuffer which can be instantiated using malloc or with a pre-allocated buffer.

Member Function Documentation

void net_instaweb::CircularBuffer::Clear ( )

Reset offset of data segment and wrapped flag. The old content is not cleared but shouldn't be print out again.

static CircularBuffer* net_instaweb::CircularBuffer::Init ( bool  parent,
void *  block,
const int  block_size,
const int  capacity 

Instantiate buffer with pre-allocated block. parent = true if this is invoked in root process (ie, this call should initialize the fields of the segment). block is a pointer to a pre-allocated segment. block_size is the size of the block, it must be equal to Sizeof(capacity). capacity is the size of the data buffer (the maximum amount of data which we can buffer at one time).

static int net_instaweb::CircularBuffer::Sizeof ( const int  capacity)

Return the size in bytes of the memory block to allocate to hold a buffer with size equal to capacity. capacity is the size of data buffer.

buffer[1] is double counted, so -1 here.

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