Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

strmod::strmod::StrChunk Class Reference

An interface to a reference counted chunk of data. More...

#include <StrMod/StrChunk.h>

Inheritance diagram for strmod::strmod::StrChunk:

Inheritance graph
[legend]
List of all members.

Public Types

typedef __iterator const_iterator
 Give the type an STL name.


Public Methods

 StrChunk ()
 Not much to talk about.

virtual ~StrChunk ()
 Not much to talk about.

virtual int AreYouA (const lcore::ClassIdent &cid) const
 Asks if a class is of a particular type, or publicly derived from that type.

virtual unsigned int Length () const=0
 Number of octets this chunk takes up. May be deprecated.

const_iterator begin ()
 Get an STL style const bidirectional iterator.

const_iterator end ()
 Get an STL style const bidirectional iterator.


Static Public Attributes

const STR_ClassIdent identifier
 A unique identifier for this class.


Protected Methods

virtual const lcore::ClassIdent * i_GetIdent () const
 See class Protocol.

virtual void acceptVisitor (ChunkVisitor &visitor)=0 throw (ChunkVisitor::halt_visitation)
 Accept a ChunkVisitor, and maybe lead it through your children.

void call_visitStrChunk (ChunkVisitor &visitor, const StrChunkPtr &chunk) throw (ChunkVisitor::halt_visitation)
 These are helper functions so derived classes have limited access to ChunkVisitor methods.

void call_visitStrChunk (ChunkVisitor &visitor, const StrChunkPtr &chunk, const LinearExtent &used) throw (ChunkVisitor::halt_visitation)
 These are helper functions so derived classes have limited access to ChunkVisitor methods.

void call_visitDataBlock (ChunkVisitor &visitor, void *start, size_t len) throw (ChunkVisitor::halt_visitation)
 These are helper functions so derived classes have limited access to ChunkVisitor methods.


Friends

class ChunkVisitor
class __iterator

Detailed Description

An interface to a reference counted chunk of data.

The chunk of data is actually held by the derived classes. Some chunks of data even consist of other StrChunks. This is an instance of the Composite design pattern.

StrChunks are supposed to be immutable after they're created. Often derived classes will have methods for updating the data held within, but StrChunks don't, and they're what the outside world sees.

StrChunks are reference counted. Use the StrChunkPtr class if you want a nice smart pointer that will automatically maintain the reference count and delete the chunk when necessary.

StrChunks are reference counted because the containment hierarchy for them is a DAG. Just because the StrChunk is found by traversing a tree rooted at a particular StrChunk doesn't mean that same StrChunk can't be found in a different tree. It might even be found twice in the same tree. This complexity requires reference counts for tractable resource handling.

Definition at line 67 of file StrChunk.h.


Member Function Documentation

int strmod::strmod::StrChunk::AreYouA const lcore::ClassIdent &    cid const [inline, virtual]
 

Asks if a class is of a particular type, or publicly derived from that type.

Overriden in every derived class (with a static identifier member) to compare against the identifier, then call the AreYouA methods of all the superclasses.

Parameters:
cid Usually <class>::identifier for the class you want to ask if the object is an instance of.

Reimplemented from strmod::lcore::Protocol.

Reimplemented in strmod::strmod::BufferChunk, strmod::strmod::DynamicBuffer, strmod::strmod::EOFStrChunk, strmod::strmod::GroupChunk, strmod::strmod::PreAllocBufferBase, strmod::strmod::SocketModuleChunk, strmod::strmod::StaticBuffer, strmod::strmod::StrSubChunk, strmod::strmod::TelnetChunker::TelnetData, strmod::strmod::TelnetChunker::SingleChar, strmod::strmod::TelnetChunker::Suboption, and strmod::strmod::TelnetChunker::OptionNegotiation.

Definition at line 129 of file StrChunk.h.

StrChunk::__iterator strmod::strmod::StrChunk::begin  
 

Get an STL style const bidirectional iterator.

This iterator will range over all the octects of type U1Byte that are in the chunk.

Definition at line 416 of file ChunkIterator.cxx.

StrChunk::__iterator strmod::strmod::StrChunk::end  
 

Get an STL style const bidirectional iterator.

This iterator will range over all the octects of type U1Byte that are in the chunk.

Definition at line 422 of file ChunkIterator.cxx.


The documentation for this class was generated from the following files:
Generated on Wed Jan 29 00:32:55 2003 for libNet by doxygen1.3-rc1