LLSegment Class Reference

A segment is a single, contiguous chunk of memory in a buffer. More...

#include <llbuffer.h>

List of all members.

Public Member Functions

 LLSegment ()
 LLSegment (S32 channel, U8 *data, S32 data_len)
 ~LLSegment ()
bool isOnChannel (S32 channel) const
 Check if this segment is on the given channel.
S32 getChannel () const
 Get the channel.
void setChannel (S32 channel)
 Set the channel.
U8data () const
 Return a raw pointer to the current data set.
S32 size () const
 Return the size of the segment.
bool operator== (const LLSegment &rhs) const
 Check if two segments are the same.

Protected Attributes

S32 mChannel
U8mData
S32 mSize


Detailed Description

A segment is a single, contiguous chunk of memory in a buffer.

Each segment represents a contiguous addressable piece of memory which is located inside a buffer. The segment is not responsible for allocation or deallcoation of the data. Each segment is a light weight object, and simple enough to copy around, use, and generate as necessary. This is the preferred interface for working with memory blocks, since it is the only way to safely, inexpensively, and directly access linear blocks of memory.

Definition at line 79 of file llbuffer.h.


Constructor & Destructor Documentation

LLSegment::LLSegment (  ) 

LLSegment

Definition at line 44 of file llbuffer.cpp.

References LLMemType::MTYPE_IO_BUFFER.

LLSegment::LLSegment ( S32  channel,
U8 data,
S32  data_len 
)

Definition at line 52 of file llbuffer.cpp.

References LLMemType::MTYPE_IO_BUFFER.

LLSegment::~LLSegment (  ) 

Definition at line 60 of file llbuffer.cpp.

References LLMemType::MTYPE_IO_BUFFER.


Member Function Documentation

U8 * LLSegment::data (  )  const

Return a raw pointer to the current data set.

The pointer returned can be used for reading or even adjustment if you are a bit crazy up to size() bytes into memory.

Returns:
A potentially NULL pointer to the raw buffer data

Definition at line 81 of file llbuffer.cpp.

References mData.

Referenced by LLHeapBuffer::containsSegment(), LLBufferArray::copyIntoBuffers(), LLIOSocketWriter::process_impl(), and LLBufferStreamBuf::underflow().

S32 LLSegment::getChannel (  )  const

Get the channel.

Definition at line 70 of file llbuffer.cpp.

References mChannel.

bool LLSegment::isOnChannel ( S32  channel  )  const

Check if this segment is on the given channel.

Definition at line 65 of file llbuffer.cpp.

References mChannel.

Referenced by LLChangeChannel::operator()(), and LLBufferStreamBuf::underflow().

bool LLSegment::operator== ( const LLSegment rhs  )  const

Check if two segments are the same.

Two segments are considered equal if they are on the same channel and cover the exact same address range.

Parameters:
rhs the segment to compare with this segment.
Returns:
Returns true if they are equal.

Definition at line 91 of file llbuffer.cpp.

References mChannel, mData, and mSize.

void LLSegment::setChannel ( S32  channel  ) 

Set the channel.

Definition at line 75 of file llbuffer.cpp.

References mChannel.

Referenced by LLChangeChannel::operator()().

S32 LLSegment::size (  )  const

Return the size of the segment.

Definition at line 86 of file llbuffer.cpp.

References mSize.

Referenced by LLHeapBuffer::containsSegment(), LLBufferArray::copyIntoBuffers(), LLIOSocketWriter::process_impl(), LLHeapBuffer::reclaimSegment(), and LLBufferStreamBuf::underflow().


Member Data Documentation

S32 LLSegment::mChannel [protected]

Definition at line 127 of file llbuffer.h.

Referenced by getChannel(), isOnChannel(), operator==(), and setChannel().

U8* LLSegment::mData [protected]

Definition at line 128 of file llbuffer.h.

Referenced by data(), and operator==().

S32 LLSegment::mSize [protected]

Definition at line 129 of file llbuffer.h.

Referenced by operator==(), and size().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:46 2010 for Second Life Viewer by  doxygen 1.4.7