asio 0.1.5 Main Page | Class Index | Member Index | Tutorial

fixed_buffer Class Template Reference

The fixed_buffer class template can be used as a byte buffer. More...

List of all members.

Public Types

typedef char byte_type
 The type of the bytes stored in the buffer.

typedef byte_typeiterator
 Iterator type for this container.

typedef const byte_typeconst_iterator
 Constant iterator type for this container.

typedef size_t size_type
 The type used for offsets into the buffer.


Public Member Functions

 fixed_buffer ()
 Constructor.

void clear ()
 Clear the buffer.

iterator begin ()
 Return a pointer to the beginning of the unread data.

const_iterator begin () const
 Return a pointer to the beginning of the unread data.

byte_typefront ()
 Get the byte at the front of the buffer.

const byte_typefront () const
 Get the byte at the front of the buffer.

iterator end ()
 Return a pointer to one past the end of the unread data.

const_iterator end () const
 Return a pointer to one past the end of the unread data.

byte_typeback ()
 Get the byte at the back of the buffer.

const byte_typeback () const
 Get the byte at the back of the buffer.

byte_typeoperator[] (size_type offset)
 Get the byte at the given offset in the buffer.

const byte_typeoperator[] (size_type offset) const
 Get the byte at the given offset in the buffer.

bool empty () const
 Is there no unread data in the buffer.

size_type size () const
 Return the amount of unread data the is in the buffer.

void resize (size_type length)
 Resize the buffer to the specified length.

size_type capacity () const
 Return the maximum size for data in the buffer.

void pop ()
 Pop a single byte from the beginning of the buffer.

void pop (size_type count)
 Pop multiple bytes from the beginning of the buffer.

void push (const byte_type &b)
 Push a single byte on to the end of the buffer.

void push (const byte_type &b, size_t count)
 Push the same byte on to the buffer a certain number of times.


Private Attributes

byte_type buffer_ [Buffer_Size]
 The data in the buffer.

size_type begin_offset_
 The offset to the beginning of the unread data.

size_type end_offset_
 The offset to the end of the unread data.


Detailed Description

template<int Buffer_Size>
class asio::fixed_buffer< Buffer_Size >

The fixed_buffer class template can be used as a byte buffer.


Member Typedef Documentation

typedef char byte_type
 

The type of the bytes stored in the buffer.

typedef byte_type* iterator
 

Iterator type for this container.

typedef const byte_type* const_iterator
 

Constant iterator type for this container.

typedef size_t size_type
 

The type used for offsets into the buffer.


Constructor & Destructor Documentation

fixed_buffer  ) 
 

Constructor.


Member Function Documentation

void clear  ) 
 

Clear the buffer.

iterator begin  ) 
 

Return a pointer to the beginning of the unread data.

const_iterator begin  )  const
 

Return a pointer to the beginning of the unread data.

byte_type& front  ) 
 

Get the byte at the front of the buffer.

const byte_type& front  )  const
 

Get the byte at the front of the buffer.

iterator end  ) 
 

Return a pointer to one past the end of the unread data.

const_iterator end  )  const
 

Return a pointer to one past the end of the unread data.

byte_type& back  ) 
 

Get the byte at the back of the buffer.

const byte_type& back  )  const
 

Get the byte at the back of the buffer.

byte_type& operator[] size_type  offset  ) 
 

Get the byte at the given offset in the buffer.

const byte_type& operator[] size_type  offset  )  const
 

Get the byte at the given offset in the buffer.

bool empty  )  const
 

Is there no unread data in the buffer.

size_type size  )  const
 

Return the amount of unread data the is in the buffer.

void resize size_type  length  ) 
 

Resize the buffer to the specified length.

size_type capacity  )  const
 

Return the maximum size for data in the buffer.

void pop  ) 
 

Pop a single byte from the beginning of the buffer.

void pop size_type  count  ) 
 

Pop multiple bytes from the beginning of the buffer.

void push const byte_type b  ) 
 

Push a single byte on to the end of the buffer.

void push const byte_type b,
size_t  count
 

Push the same byte on to the buffer a certain number of times.


Member Data Documentation

byte_type buffer_[Buffer_Size] [private]
 

The data in the buffer.

size_type begin_offset_ [private]
 

The offset to the beginning of the unread data.

size_type end_offset_ [private]
 

The offset to the end of the unread data.