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

CBuffer Class Reference
[Opaque user dataI/O BuffersAsynchronous I/O]

Inheritance diagram for CBuffer:
Collaboration diagram for CBuffer:

List of all members.

Detailed Description

An implementation of the IBuffer interface which includes its own custom new and delete functionality so that the memory for the buffer and the memory for the rest of the class are allocated as a single block of memory. Note that the 'user data' is also allocated as part of the main buffer memory and the class knows how to access the various memory areas correctly. Note that the buffers may be allocated using VirtualAlloc() to align the memory on page boundaries; in this case, it's best to create buffers with a size that is a multiple of the system's page size less the size of the buffer object, see CBufferAllocator for more details.

Public Member Functions

 CBuffer (const CBuffer &rhs)
CBufferoperator= (const CBuffer &rhs)
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=nullptr) const override
bool Consume (BufferSize bytesToConsume) override
bool ConsumeAndRemove (BufferSize bytesToRemove) override
BYTEMakeSpaceAtFront (BufferSize spaceToAdd, BufferSize spaceRequiredAtRear) 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
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


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

Constructor & Destructor Documentation

CBuffer ( const CBuffer rhs  ) 

Member Function Documentation

CBuffer& operator= ( const CBuffer rhs  ) 

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 = nullptr  )  const [override]

bool Consume ( BufferSize  bytesToConsume  )  [override]

bool ConsumeAndRemove ( BufferSize  bytesToRemove  )  [override]

BYTE * MakeSpaceAtFront ( BufferSize  spaceToAdd,
BufferSize  spaceRequiredAtRear 
) [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]

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]

Friends And Related Function Documentation

friend class CBufferAllocator [friend]

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

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