The C++ framework for developing highly scalable, high performance servers on Windows platforms.

IBufferBase Class Reference
[InterfacesI/O BuffersAsynchronous I/OProtected destructors on abstract base classes]

Inheritance diagram for IBufferBase:
Collaboration diagram for IBufferBase:

List of all members.


Detailed Description

An interface to a I/O buffer (with a partially refactored name!). Initially IBuffer and IBufferBase was one class, it was split to make it easier to mock and in an attempt to remove some of the socket stuff. Classes that implement this interface represent a byte buffer that can be used for overlapped I/O and that consist of a contiguous array of bytes and an insertion point which moves along the buffer as data is added to it. More work needs to be done.

Public Types

typedef DWORD BufferSize

Public Member Functions

virtual BufferSize GetUsed () const =0
 Returns how much space has been used in the buffer. That is, the current position of the insertion point.
virtual BufferSize GetSize () const =0
 Returns the size of the buffer.
virtual BufferSize GetSpace () const =0
 Returns the amount of free space immediately usable in the buffer. This is the same as GetSize() - GetUsed() but does not take into account any potential space at the front of the buffer that has been created by Consume().
virtual const BYTEGetMemory () const =0
 Returns a pointer to the bytes in the buffer.
virtual void AddData (const char *pData, BufferSize dataLength)=0
 Adds data to the buffer at the current insertion point and moves the insertion point forward by the amount of data added. Throws an exception if there isn't enough space left in the buffer to add all of the data.
virtual void AddData (const BYTE *pData, BufferSize dataLength)=0
 Adds data to the buffer at the current insertion point and moves the insertion point forward by the amount of data added. Throws an exception if there isn't enough space left in the buffer to add all of the data.
virtual void AddData (BYTE data)=0
 Adds data to the buffer at the current insertion point and moves the insertion point forward by the amount of data added. Throws an exception if there isn't enough space left in the buffer to add all of the data.
virtual bool AddAsMuchAsPossible (const BYTE *pData, DWORD dataLength, DWORD &bytesAdded)=0
virtual void Use (BufferSize dataUsed)=0
 Move the insertion point without adding any data. Adds 'dataUsed' to the current insertion point.
virtual bool ReduceUsed (BufferSize notUsed)=0
 Move the insertion point 'back' thus removing bytes from the end of the buffer. Returns true if the buffer is now empty.
virtual void Empty ()=0
 Move the insertion point to the start of the buffer; thus emptying it.
DWORD GetOverlappedResult (HANDLE handle)
 Calls GetOverlappedResult() on this OVERLAPPED for the supplied HANDLE and returns the number of bytes transferred. Throws an exception on failure.
DWORD GetOverlappedResult (SOCKET socket)
 Calls GetOverlappedResult() on this OVERLAPPED for the supplied SOCKET and returns the number of bytes transferred. Throws an exception on failure.

Protected Member Functions

virtual ~IBufferBase ()
 We never delete instances of this interface; you must manage the lifetime of the class that implements it.

Member Typedef Documentation

typedef DWORD BufferSize


Constructor & Destructor Documentation

virtual ~IBufferBase (  )  [protected, virtual]

We never delete instances of this interface; you must manage the lifetime of the class that implements it.


Member Function Documentation

virtual BufferSize GetUsed (  )  const [pure virtual]

Returns how much space has been used in the buffer. That is, the current position of the insertion point.

virtual BufferSize GetSize (  )  const [pure virtual]

Returns the size of the buffer.

virtual BufferSize GetSpace (  )  const [pure virtual]

Returns the amount of free space immediately usable in the buffer. This is the same as GetSize() - GetUsed() but does not take into account any potential space at the front of the buffer that has been created by Consume().

virtual const BYTE* GetMemory (  )  const [pure virtual]

Returns a pointer to the bytes in the buffer.

virtual void AddData ( const char *  pData,
BufferSize  dataLength 
) [pure virtual]

Adds data to the buffer at the current insertion point and moves the insertion point forward by the amount of data added. Throws an exception if there isn't enough space left in the buffer to add all of the data.

virtual void AddData ( const BYTE pData,
BufferSize  dataLength 
) [pure virtual]

Adds data to the buffer at the current insertion point and moves the insertion point forward by the amount of data added. Throws an exception if there isn't enough space left in the buffer to add all of the data.

virtual void AddData ( BYTE  data  )  [pure virtual]

Adds data to the buffer at the current insertion point and moves the insertion point forward by the amount of data added. Throws an exception if there isn't enough space left in the buffer to add all of the data.

virtual bool AddAsMuchAsPossible ( const BYTE pData,
DWORD  dataLength,
DWORD bytesAdded 
) [pure virtual]

virtual void Use ( BufferSize  dataUsed  )  [pure virtual]

Move the insertion point without adding any data. Adds 'dataUsed' to the current insertion point.

virtual bool ReduceUsed ( BufferSize  notUsed  )  [pure virtual]

Move the insertion point 'back' thus removing bytes from the end of the buffer. Returns true if the buffer is now empty.

virtual void Empty (  )  [pure virtual]

Move the insertion point to the start of the buffer; thus emptying it.

DWORD GetOverlappedResult ( HANDLE  handle  )  [inherited]

Calls GetOverlappedResult() on this OVERLAPPED for the supplied HANDLE and returns the number of bytes transferred. Throws an exception on failure.

DWORD GetOverlappedResult ( SOCKET  socket  )  [inherited]

Calls GetOverlappedResult() on this OVERLAPPED for the supplied SOCKET and returns the number of bytes transferred. Throws an exception on failure.


Generated on Sun Sep 12 19:09:26 2021 for The Server Framework - v7.4 by doxygen 1.5.3