FARGOS/VISTA Object Management Environment Core
..
|
Impose a circular buffer on a BufferRegion. More...
#include <circular_bfr.hpp>
Public Member Functions | |
CircularBufferManager (unsigned char *ptr, size_t len, size_t blk_size, const char *component="", const char *magicNumber=DEFAULT_CIRCULAR_BFR_MAGIC_NUMBER) | |
CircularBufferManager (unsigned char *ptr, size_t len) | |
~CircularBufferManager () | |
virtual SharedBufferAllocRecord * | allocateBlock (size_t len) VIRTUAL_OVERRIDE |
virtual void | returnBlock (SharedBufferAllocRecord *record) VIRTUAL_OVERRIDE |
virtual BufferRegion_Overhead_t | getBlockOverhead () const VIRTUAL_OVERRIDE |
Interface to return the per-block overhead associated with an allocator. More... | |
![]() | |
BufferRegion (unsigned char *ptr, size_t len, size_t blk_size, OwnershipState ownedBy=NOT_OWNER) | |
virtual | ~BufferRegion () |
Destructor for a BufferRegion. More... | |
void | replaceRegion (unsigned char *ptr, size_t len, size_t blk_size, OwnershipState ownedBy=NOT_OWNER) |
Reconstruct the buffer using a new region. More... | |
void | setOwnership (OwnershipState newOwnership) |
Change administrative ownership of region. More... | |
OwnershipState | getOwnership () const |
Return the administrative ownership state of the region. More... | |
size_t | getRegionLength () const OME_ALWAYS_INLINE |
Return the number of bytes in the region. More... | |
size_t | getBlockSize () const OME_ALWAYS_INLINE |
Return the block size set for the region. More... | |
unsigned char * | getBufferBase () const OME_ALWAYS_INLINE |
Return the address of the buffer region. More... | |
virtual SharedBufferAllocRecord * | getActiveListHead () |
Return first active allocation record. More... | |
virtual SharedBufferAllocRecord * | getFreeListHead () |
Return first free allocation record. More... | |
virtual SharedBufferAllocRecord * | traverseNextBlock (SharedBufferAllocRecord *record) |
Traverse to next allocation record on current chain. More... | |
virtual unsigned char * | blockAddress (const SharedBufferAllocRecord *record) |
int | checkLists (int displayFlag) |
Debug routine used to verify integrity of block lists. More... | |
Static Public Attributes | |
static int32_t | TOTAL_allocation_wait_spins |
static int32_t | TOTAL_return_wait_spins |
Additional Inherited Members | |
![]() | |
enum | OwnershipState { NOT_OWNER = 0, OWN_BLOCK = 1, OWN_MAP = 2, OWN_RECORD = 3 } |
typedef uint_fast8_t | BufferRegion_Overhead_t |
![]() | |
unsigned char * | region |
size_t | regionLength |
size_t | blockSize |
size_t | availableBlocks |
OwnershipState | ownership |
Impose a circular buffer on a BufferRegion.
CircularBufferManager::CircularBufferManager | ( | unsigned char * | ptr, |
size_t | len, | ||
size_t | blk_size, | ||
const char * | component = "" , |
||
const char * | magicNumber = DEFAULT_CIRCULAR_BFR_MAGIC_NUMBER |
||
) |
References BufferRegion::availableBlocks, SharedBufferAllocRecord_32::blockLen, BufferRegion::blockSize, SharedBufferRegionHeader_32::initialize(), SharedBufferAllocRecord_32::offset_allocRecord, SharedBufferAllocRecord_32::offset_block, SharedBufferAllocRecord_32::offset_nextInChain, SharedBufferRegionHeader_32::offset_startFreeList, BufferRegion::region, BufferRegion::regionLength, and SharedBufferAllocRecord_32::usedLen.
CircularBufferManager::CircularBufferManager | ( | unsigned char * | ptr, |
size_t | len | ||
) |
|
inline |
|
virtual |
Interface to allocate a block of storage from the buffer region.
len | specifies the number of bytes needed for the block. |
nullptr | indicates a block could not be allocated. |
Implements BufferRegion.
References BufferRegion::blockAddress(), SharedBufferAllocRecord_32::blockLen, BufferRegion::checkLists(), DID_COMPARE_SWAP_OFFSET, SharedBufferRegionHeader_32::offset_endActiveList, SharedBufferAllocRecord_32::offset_nextInChain, SharedBufferRegionHeader_32::offset_startActiveList, SharedBufferRegionHeader_32::offset_startFreeList, OME_EXPECT_FALSE, OME_EXPECT_TRUE, OME_PREFETCH, OME_YIELD_THREAD, BufferRegion::region, TOTAL_allocation_wait_spins, SharedBufferRegionHeader_32::updatingThread, and SharedBufferAllocRecord_32::usedLen.
|
inlinevirtual |
Interface to return the per-block overhead associated with an allocator.
Implements BufferRegion.
|
virtual |
Interface to return a block of storage previously obtained by an allocateBlock() call.
record | points to the SharedBufferAllocRecord representing the block to be returned. |
NOTE: not all subclasses can do something useful with a returned block.
Implements BufferRegion.
References BufferRegion::blockAddress(), BufferRegion::checkLists(), DID_COMPARE_SWAP_OFFSET, SharedBufferAllocRecord_32::offset_allocRecord, SharedBufferRegionHeader_32::offset_endActiveList, SharedBufferAllocRecord_32::offset_nextInChain, SharedBufferRegionHeader_32::offset_startActiveList, SharedBufferRegionHeader_32::offset_startFreeList, OME_EXPECT_FALSE, OME_PREFETCH, BufferRegion::region, TOTAL_return_wait_spins, and SharedBufferRegionHeader_32::updatingThread.
|
static |
Referenced by allocateBlock().
|
static |
Referenced by returnBlock().
![]() | Generated: Tue Jul 28 2020 16:03:27
Support Information |