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

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

Inheritance diagram for CBufferHandleAllocator:
Collaboration diagram for CBufferHandleAllocator:

List of all members.


Detailed Description

An implementation of IAllocateBufferHandles which pools buffer handle instances for later reuse.

Public Types

typedef unsigned long BufferCount

Public Member Functions

 CBufferHandleAllocator (BufferCount maxFreeBuffers, IAllocateBuffers &bufferAllocator)
 Create an allocator for buffer handles and keep up to maxFreeBuffers in a pool for reuse. Use the supplied buffer allocator if a handle ever needs to be converted to a proper buffer.
 CBufferHandleAllocator (IMonitorBufferAllocation &monitor, BufferCount maxFreeBuffers, IAllocateBuffers &bufferAllocator)
 Create an allocator for buffer handles and keep up to maxFreeBuffers in a pool for reuse. Provide monitoring information via the supplied instance of the IMonitorBufferAllocation interface. Use the supplied buffer allocator if a handle ever needs to be converted to a proper buffer.
 CBufferHandleAllocator (const CBufferHandleAllocator &rhs)
 ~CBufferHandleAllocator () override
CBufferHandleAllocatoroperator= (const CBufferHandleAllocator &rhs)
BufferCount EnlargePool (BufferCount buffersToAdd)
 Add buffersToAdd buffer handles to the pool.
CBufferHandleAllocateHandle () override
 Allocate a CBufferHandle, remember to call Release() on it when you're done with it.
IBuffer::BufferSize GetBufferSize () const override
CSmartBuffer Allocate () override
 Allocate an instance of IBuffer, remember to call Release() on it when you're done with it.
CSmartBuffer AllocateCustomSizedBuffer (IBuffer::BufferSize bufferSize) override
CSmartBuffer Allocate (const IBuffer &buffer) override
 Allocate a CBufferHandle and attach the supplied IBuffer to it, return the CBufferHandle's IBuffer interface, remember to call Release() on it when you're done with it.
bool Flush () override
 Flushes the allocator. Use with care as this forces active buffer handles to be released and destroyed! Generally only called as part of process cleanup and even then only to aid in buffer leak tracking.

Member Typedef Documentation

typedef unsigned long BufferCount


Constructor & Destructor Documentation

CBufferHandleAllocator ( BufferCount  maxFreeBuffers,
IAllocateBuffers bufferAllocator 
)

Create an allocator for buffer handles and keep up to maxFreeBuffers in a pool for reuse. Use the supplied buffer allocator if a handle ever needs to be converted to a proper buffer.

CBufferHandleAllocator ( IMonitorBufferAllocation monitor,
BufferCount  maxFreeBuffers,
IAllocateBuffers bufferAllocator 
)

Create an allocator for buffer handles and keep up to maxFreeBuffers in a pool for reuse. Provide monitoring information via the supplied instance of the IMonitorBufferAllocation interface. Use the supplied buffer allocator if a handle ever needs to be converted to a proper buffer.

~CBufferHandleAllocator (  )  [override]

Reimplemented in CBufferHandleAllocator.


Member Function Documentation

CBufferHandleAllocator& operator= ( const CBufferHandleAllocator rhs  ) 

CBufferHandleAllocator::BufferCount EnlargePool ( BufferCount  buffersToAdd  ) 

Add buffersToAdd buffer handles to the pool.

CBufferHandle * AllocateHandle (  )  [override, virtual]

Allocate a CBufferHandle, remember to call Release() on it when you're done with it.

Implements IAllocateBufferHandles.

IBuffer::BufferSize GetBufferSize (  )  const [override, virtual]

CSmartBuffer Allocate (  )  [override, virtual]

Allocate an instance of IBuffer, remember to call Release() on it when you're done with it.

Implements IManageBufferLifeCycle.

CSmartBuffer AllocateCustomSizedBuffer ( IBuffer::BufferSize  bufferSize  )  [override, virtual]

CSmartBuffer Allocate ( const IBuffer &  buffer  )  [override, virtual]

Allocate a CBufferHandle and attach the supplied IBuffer to it, return the CBufferHandle's IBuffer interface, remember to call Release() on it when you're done with it.

Implements IAllocateBufferHandles.

bool Flush (  )  [override, virtual]

Flushes the allocator. Use with care as this forces active buffer handles to be released and destroyed! Generally only called as part of process cleanup and even then only to aid in buffer leak tracking.

Implements IAllocateBufferHandles.


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