oasys::ExpandableBuffer Struct Reference

#include <ExpandableBuffer.h>

Inheritance diagram for oasys::ExpandableBuffer:

oasys::ScratchBuffer< _memory_t, _static_size > oasys::ScratchBuffer< _memory_t, 0 >

List of all members.


Detailed Description

ExpandableBuffer useful for pieces of memory that need to be resizable. It is to be used as an interface and a base class but not directly.

Definition at line 31 of file ExpandableBuffer.h.


Public Member Functions

 ExpandableBuffer (size_t size=0)
 ExpandableBuffer (const ExpandableBuffer &other)
virtual ~ExpandableBuffer ()
char * tail_buf (size_t size)
virtual void reserve (size_t size)
size_t nfree () const
 
Returns:
bytes free

char * raw_buf () const
 
Returns:
raw char buffer

char * at (size_t offset) const
 
Returns:
char* to offset in the buffer, 0 if past the end of the buffer.

char * end () const
 
Returns:
char* to end of len_ bytes in the buffer

size_t buf_len () const
 
Returns:
Length of the scratch buffer

size_t len () const
 
Returns:
Length of the bytes that have been requested

void set_len (size_t len)
 Set the length to this amount.
void incr_len (size_t amt)
 Increase len by this amount.
void clear ()

Protected Attributes

char * buf_
size_t buf_len_
size_t len_

Constructor & Destructor Documentation

oasys::ExpandableBuffer::ExpandableBuffer ( size_t  size = 0  )  [inline]

Definition at line 32 of file ExpandableBuffer.h.

References reserve().

oasys::ExpandableBuffer::ExpandableBuffer ( const ExpandableBuffer other  )  [inline]

Definition at line 40 of file ExpandableBuffer.h.

References buf_, buf_len_, len_, and reserve().

virtual oasys::ExpandableBuffer::~ExpandableBuffer (  )  [inline, virtual]

Definition at line 52 of file ExpandableBuffer.h.

References buf_, buf_len_, and len_.


Member Function Documentation

char* oasys::ExpandableBuffer::tail_buf ( size_t  size  )  [inline]

Return a pointer into the expanded buffer, past data up to len_, and with enough space for the given size.

Definition at line 66 of file ExpandableBuffer.h.

References ASSERT, buf_, buf_len_, len_, and reserve().

Referenced by oasys::BufferedSerializeAction::next_slice().

virtual void oasys::ExpandableBuffer::reserve ( size_t  size  )  [inline, virtual]

Reserve buffer space.

Parameters:
size The size of the buffer desired
Returns:
0 on success.

Reimplemented in oasys::ScratchBuffer< _memory_t, _static_size >, oasys::ScratchBuffer< char *, 512 >, and oasys::ScratchBuffer< u_char * >.

Definition at line 83 of file ExpandableBuffer.h.

References buf_, and buf_len_.

Referenced by oasys::StringBuffer::append(), oasys::StringBuffer::append_int(), oasys::KeyMarshal::border(), oasys::StringBuffer::c_str(), oasys::KeyMarshal::end_action(), ExpandableBuffer(), oasys::FileSystemTable::get_common(), oasys::KeyMarshal::process(), oasys::KeyMarshal::process_int(), oasys::KeyMarshal::process_int64(), oasys::ScratchBuffer< u_char * >::reserve(), oasys::StringBuffer::StringBuffer(), tail_buf(), and oasys::StringBuffer::vappendf().

size_t oasys::ExpandableBuffer::nfree (  )  const [inline]

Returns:
bytes free

Definition at line 94 of file ExpandableBuffer.h.

References ASSERT, buf_len_, and len_.

Referenced by oasys::StringBuffer::c_str(), dtn::BlockProcessor::consume_preamble(), and oasys::StringBuffer::vappendf().

char* oasys::ExpandableBuffer::raw_buf (  )  const [inline]

Returns:
raw char buffer

Definition at line 100 of file ExpandableBuffer.h.

References ASSERT, and buf_.

Referenced by oasys::BufferedSerializeAction::buf(), oasys::MarshalCopy::copy(), and oasys::StringBuffer::data().

char* oasys::ExpandableBuffer::at ( size_t  offset  )  const [inline]

Returns:
char* to offset in the buffer, 0 if past the end of the buffer.

Definition at line 107 of file ExpandableBuffer.h.

References ASSERT, buf_, and buf_len_.

Referenced by oasys::StringBuffer::c_str(), end(), and oasys::FileSystemTable::get_common().

char* oasys::ExpandableBuffer::end (  )  const [inline]

Returns:
char* to end of len_ bytes in the buffer

Definition at line 118 of file ExpandableBuffer.h.

References ASSERT, at(), buf_, buf_len_, and len_.

Referenced by oasys::StringBuffer::append(), oasys::StringBuffer::append_int(), oasys::KeyMarshal::border(), oasys::StringBuffer::c_str(), dtn::BlockProcessor::consume_preamble(), oasys::KeyMarshal::end_action(), oasys::FileSystemTable::get_common(), oasys::KeyMarshal::process(), oasys::KeyMarshal::process_int(), oasys::KeyMarshal::process_int64(), dtntunnel::TCPTunnel::Connection::run(), and oasys::StringBuffer::vappendf().

size_t oasys::ExpandableBuffer::buf_len (  )  const [inline]

Returns:
Length of the scratch buffer

Definition at line 125 of file ExpandableBuffer.h.

References buf_len_.

Referenced by oasys::BufferedSerializeAction::length(), oasys::StringBuffer::set_length(), and oasys::StringBuffer::vappendf().

size_t oasys::ExpandableBuffer::len (  )  const [inline]

Returns:
Length of the bytes that have been requested

Definition at line 130 of file ExpandableBuffer.h.

References len_.

Referenced by oasys::StringBuffer::append(), oasys::StringBuffer::append_int(), oasys::StringBuffer::appendf(), oasys::KeyMarshal::border(), oasys::StringBuffer::c_str(), dtn::BlockProcessor::consume_preamble(), oasys::MarshalCopy::copy(), dtn::BlockInfo::flags(), oasys::MemoryTable::get(), oasys::FileSystemTable::get(), oasys::FileSystemTable::get_common(), oasys::MemoryIterator::get_key(), dtntunnel::UDPTunnel::handle_bundle(), dtntunnel::TCPTunnel::Connection::handle_bundle(), dtntunnel::TCPTunnel::handle_bundle(), oasys::StringBuffer::length(), oasys::BufferedSerializeAction::offset(), oasys::TextUnmarshal::process(), oasys::KeyMarshal::process(), oasys::KeyMarshal::process_int(), oasys::KeyMarshal::process_int64(), oasys::FileSystemTable::put(), dtntunnel::TCPTunnel::Connection::run(), dtntunnel::DTNTunnel::send_bundle(), dtn::BlockInfo::serialize(), dtn::BlockInfo::set_flag(), oasys::StringBuffer::trim(), dtn::BlockInfo::type(), and oasys::StringBuffer::vappendf().

void oasys::ExpandableBuffer::set_len ( size_t  len  )  [inline]

Set the length to this amount.

Definition at line 133 of file ExpandableBuffer.h.

References ASSERT, buf_len_, and len_.

Referenced by oasys::StringBuffer::append(), oasys::StringBuffer::append_int(), oasys::KeyMarshal::border(), oasys::BufferedSerializeAction::BufferedSerializeAction(), clear(), dtn::BlockProcessor::consume_preamble(), dtn::PreviousHopBlockProcessor::generate(), oasys::FileSystemTable::get_common(), dtntunnel::DTNTunnel::handle_bundle(), oasys::KeyMarshal::process(), oasys::KeyMarshal::process_int(), oasys::KeyMarshal::process_int64(), dtntunnel::UDPTunnel::Listener::run(), dtntunnel::TCPTunnel::Connection::run(), dtn::BlockInfo::serialize(), oasys::StringBuffer::set_length(), oasys::StringBuffer::trim(), and oasys::StringBuffer::vappendf().

void oasys::ExpandableBuffer::incr_len ( size_t  amt  )  [inline]

Increase len by this amount.

Definition at line 139 of file ExpandableBuffer.h.

References ASSERT, buf_len_, and len_.

Referenced by oasys::BufferedSerializeAction::next_slice().

void oasys::ExpandableBuffer::clear (  )  [inline]

Definition at line 144 of file ExpandableBuffer.h.

References set_len().


Member Data Documentation

char* oasys::ExpandableBuffer::buf_ [protected]

Definition at line 149 of file ExpandableBuffer.h.

Referenced by at(), oasys::ScratchBuffer< u_char * >::buf(), oasys::ScratchBuffer< _memory_t, 0 >::buf(), end(), ExpandableBuffer(), raw_buf(), oasys::ScratchBuffer< u_char * >::reserve(), reserve(), oasys::ScratchBuffer< u_char * >::ScratchBuffer(), tail_buf(), oasys::ScratchBuffer< u_char * >::using_malloc(), ~ExpandableBuffer(), and oasys::ScratchBuffer< u_char * >::~ScratchBuffer().

size_t oasys::ExpandableBuffer::buf_len_ [protected]

Definition at line 150 of file ExpandableBuffer.h.

Referenced by at(), oasys::ScratchBuffer< _memory_t, 0 >::buf(), buf_len(), end(), ExpandableBuffer(), incr_len(), nfree(), oasys::ScratchBuffer< u_char * >::reserve(), reserve(), oasys::ScratchBuffer< u_char * >::ScratchBuffer(), set_len(), tail_buf(), and ~ExpandableBuffer().

size_t oasys::ExpandableBuffer::len_ [protected]

Definition at line 151 of file ExpandableBuffer.h.

Referenced by end(), ExpandableBuffer(), incr_len(), len(), nfree(), oasys::ScratchBuffer< u_char * >::ScratchBuffer(), set_len(), tail_buf(), and ~ExpandableBuffer().


The documentation for this struct was generated from the following file:
Generated on Sat Sep 8 08:36:26 2007 for DTN Reference Implementation by  doxygen 1.5.3