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

CBufferHandle Class Reference
[I/O BuffersAsynchronous I/O]

Inheritance diagram for CBufferHandle:
Collaboration diagram for CBufferHandle:

List of all members.

Detailed Description

An implementation of IBuffer that provides a separate WSABUF for another implementation of IBuffer. This is used to broadcast the contents of an IBuffer to multiple receivers without needing to copy the data in the buffer. Each receiver has a CBufferHandle allocated which is attached to the IBuffer that contains the data that needs to be broadcast. When the final send completes the references held by the CBufferHandle objects on the IBuffer will fall to 0 and the buffer will be released.

Public Member Functions

 CBufferHandle (const CBufferHandle &rhs)
CBufferHandleoperator= (const CBufferHandle &rhs)
virtual void Attach (const IBuffer &buffer)
void Validate () const
 Throws an exception if the buffer handle is not attached to a buffer.
BufferSize GetUsed () const override
BufferSize GetSize () const override
BufferSize GetSpace () const override
BufferSize GetTotalSpace () const override
BufferSize GetSpaceAtFront () const override
void RemoveSpaceAtFront () override
const BYTEGetMemory () const override
void SetMaxRead (BufferSize maxBytesToRead) override
void ReadCompleted (BufferSize bytesRead) override
void AddData (const char *pData, BufferSize dataLength) override
void AddData (const BYTE *pData, BufferSize dataLength) override
void AddData (BYTE data) override
bool AddAsMuchAsPossible (const BYTE *pData, DWORD dataLength, DWORD &bytesAdded) override
void Use (BufferSize dataUsed) override
bool ReduceUsed (BufferSize notUsed) override
CSmartBuffer SplitBufferFromFront (BufferSize startOffset, BufferSize bytesToRemove, IPoolBuffers *pPool) override
CSmartBuffer SplitBufferFromBack (BufferSize bytesToRemove, IPoolBuffers *pPool) override
CSmartBuffer AllocateNewBuffer () const override
CSmartBuffer AllocateCustomSizedBuffer (BufferSize bufferSize) const override
CSmartBuffer DuplicateBuffer (IPoolBuffers *pPool) const override
bool Consume (BufferSize bytesToConsume) override
bool ConsumeAndRemove (BufferSize bytesToRemove) override
BYTEMakeSpaceAtFront (BufferSize spaceToAdd) override
BYTEMakeSpaceAtFront (BufferSize spaceToAdd, BufferSize spaceRequiredAtRear) override
BYTEMakeSpaceAtFrontIfPossible (BufferSize spaceToAdd) override
BYTEMakeSpaceAtFrontIfPossible (BufferSize spaceToAdd, BufferSize spaceRequiredAtRear) override
void Empty () override
void AddRef () override
void Release () override
void Release (IAddBuffersToPool &pool) override
bool WeOwnOnlyReference () const override
void OnBufferAddedToPool () override
void OnBufferRemovedFromPool () override
Operation GetOperation () const override
void SetOperation (Operation operation) override
SequenceNumber GetSequenceNumber () const override
void SetSequenceNumber (SequenceNumber sequenceNumber) override
void SetOperationData (DWORD ioSize, DWORD lastError, SequenceNumber operationSequenceNumber) override
void GetOperationData (DWORD &ioSize, DWORD &lastError) override
SequenceNumber GetOperationSequenceNumber () const override
bool IsReadOnly () const override
CSmartBuffer GetWritableBuffer () const override
void * GetUserPointer (UserDataIndex index) const override
void SetUserPointer (UserDataIndex index, void *pData) override
ULONG_PTR GetUserData (UserDataIndex index) const override
void SetUserData (UserDataIndex index, ULONG_PTR data) override
virtual void InvalidateAndRemoveFromList ()
Node * Next () const
 Return the next node in the list.
void Next (Node *pNext)
 Set the given node to be this nodes 'next node'.
void RemoveFromList ()
 If this node is currently in a list then it is removed.
bool InList (const CNodeList &list) const
 Returns true if this node is currently in the specified list.
bool InList () const
 Returns true if this node is currently in any list.

Protected Member Functions

 CBufferHandle ()
 CBufferHandle (const void *pMem)
 ~CBufferHandle () override


class CBufferHandleAllocator
 Needs to be a friend so that it can new and delete us.

Constructor & Destructor Documentation

CBufferHandle ( const CBufferHandle rhs  ) 

CBufferHandle (  )  [protected]

CBufferHandle ( const void *  pMem  )  [explicit, protected]

~CBufferHandle (  )  [override, protected]

Member Function Documentation

CBufferHandle& operator= ( const CBufferHandle rhs  ) 

void Attach ( const IBuffer &  buffer  )  [virtual]

void Validate (  )  const

Throws an exception if the buffer handle is not attached to a buffer.

IBufferBase::BufferSize GetUsed (  )  const [override]

IBufferBase::BufferSize GetSize (  )  const [override]

IBufferBase::BufferSize GetSpace (  )  const [override]

IBufferBase::BufferSize GetTotalSpace (  )  const [override]

IBufferBase::BufferSize GetSpaceAtFront (  )  const [override]

void RemoveSpaceAtFront (  )  [override]

const BYTE * GetMemory (  )  const [override]

void SetMaxRead ( BufferSize  maxBytesToRead  )  [override]

void ReadCompleted ( BufferSize  bytesRead  )  [override]

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

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

void AddData ( BYTE  data  )  [override]

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

void Use ( BufferSize  dataUsed  )  [override]

bool ReduceUsed ( BufferSize  notUsed  )  [override]

CSmartBuffer SplitBufferFromFront ( BufferSize  startOffset,
BufferSize  bytesToRemove,
IPoolBuffers pPool 
) [override]

CSmartBuffer SplitBufferFromBack ( BufferSize  bytesToRemove,
IPoolBuffers pPool 
) [override]

CSmartBuffer AllocateNewBuffer (  )  const [override]

CSmartBuffer AllocateCustomSizedBuffer ( BufferSize  bufferSize  )  const [override]

CSmartBuffer DuplicateBuffer ( IPoolBuffers pPool  )  const [override]

bool Consume ( BufferSize  bytesToConsume  )  [override]

bool ConsumeAndRemove ( BufferSize  bytesToRemove  )  [override]

BYTE * MakeSpaceAtFront ( BufferSize  spaceToAdd  )  [override]

BYTE * MakeSpaceAtFront ( BufferSize  spaceToAdd,
BufferSize  spaceRequiredAtRear 
) [override]

BYTE * MakeSpaceAtFrontIfPossible ( BufferSize  spaceToAdd  )  [override]

BYTE * MakeSpaceAtFrontIfPossible ( BufferSize  spaceToAdd,
BufferSize  spaceRequiredAtRear 
) [override]

void Empty (  )  [override]

void AddRef (  )  [override]

void Release (  )  [override]

void Release ( IAddBuffersToPool pool  )  [override]

bool WeOwnOnlyReference (  )  const [override]

void OnBufferAddedToPool (  )  [override]

void OnBufferRemovedFromPool (  )  [override]

IBuffer::Operation GetOperation (  )  const [override]

void SetOperation ( Operation  operation  )  [override]

IBuffer::SequenceNumber GetSequenceNumber (  )  const [override]

void SetSequenceNumber ( SequenceNumber  sequenceNumber  )  [override]

void SetOperationData ( DWORD  ioSize,
DWORD  lastError,
SequenceNumber  operationSequenceNumber 
) [override]

void GetOperationData ( DWORD ioSize,
DWORD lastError 
) [override]

IBuffer::SequenceNumber GetOperationSequenceNumber (  )  const [override]

bool IsReadOnly (  )  const [override]

CSmartBuffer GetWritableBuffer (  )  const [override]

void * GetUserPointer ( UserDataIndex  index  )  const [override]

void SetUserPointer ( UserDataIndex  index,
void *  pData 
) [override]

ULONG_PTR GetUserData ( UserDataIndex  index  )  const [override]

void SetUserData ( UserDataIndex  index,
ULONG_PTR  data 
) [override]

virtual void InvalidateAndRemoveFromList (  )  [inline, virtual, inherited]

CNodeList::Node * Next (  )  const [inherited]

Return the next node in the list.

void Next ( Node pNext  )  [inherited]

Set the given node to be this nodes 'next node'.

void RemoveFromList (  )  [inherited]

If this node is currently in a list then it is removed.

bool InList ( const CNodeList list  )  const [inherited]

Returns true if this node is currently in the specified list.

bool InList (  )  const [inherited]

Returns true if this node is currently in any list.

Friends And Related Function Documentation

friend class CBufferHandleAllocator [friend]

Needs to be a friend so that it can new and delete us.

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