randolf.ca  1.00
Randolf Richardson's C++ classes
Loading...
Searching...
No Matches
randolf::rring_bam Struct Reference

This structure contains a Block Allocation Map (BAM) of the positions and lengths of data blocks in ring buffer memory. This is part of an advanced feature that's specifically useful for direct memory access to the ring buffer's memory (access operations will likely need to be split into two operations when the buffer straddles the ring buffer's memory boundary, which benefits performance by making direct read/write operations with file and socket I/O, but for most applications it's better to use the other methods provided in the randolf::rring class since this is what they were designed for). More...

#include <rring_bam>

+ Collaboration diagram for randolf::rring_bam:

Public Attributes

void * avail1
 Pointer to first portion of available buffer memory.
 
size_t avail1_size
 Number of elements in avail1.
 
void * avail2
 Pointer to second portion of available buffer memory, if this part of the ring buffer straddles the boundary, otherwise nullptr will be specified.
 
size_t avail2_size
 Number of elements in avail2.
 
void * block1
 Pointer to first portion of utilized buffer memory.
 
size_t block1_size
 Number of elements in block1.
 
void * block2
 Pointer to second portion of utilized buffer memory, if this part of the ring buffer straddles the boundary, otherwise nullptr will be specified.
 
size_t block2_size
 Number of elements in block2.
 

Detailed Description

This structure contains a Block Allocation Map (BAM) of the positions and lengths of data blocks in ring buffer memory. This is part of an advanced feature that's specifically useful for direct memory access to the ring buffer's memory (access operations will likely need to be split into two operations when the buffer straddles the ring buffer's memory boundary, which benefits performance by making direct read/write operations with file and socket I/O, but for most applications it's better to use the other methods provided in the randolf::rring class since this is what they were designed for).

Note
This code demonstrates how to obtain a "bam" and access ring buffer memory by using this structure:
#include <randolf/rring>
#include <randolf/rring_bam>
// ... code that initializes a ring buffer and populates it; documentation
// for the data_bam() method is available in the randolf::rring class ...
char b1 = 0;
char b2 = 0;
char a1 = 0;
char a2 = 0;
randolf::rring_bam bam = rb.data_bam();
if (bam->block1 != nullptr) // Check for pointer (avoids segfault)
b1 = ((char*)bam->block1)[0]; // First byte of utilized buffer memory
if (bam->block2 != nullptr) // Check for pointer (avoids segfault)
b2 = ((char*)bam->block2)[0]; // Second byte of utilized buffer memory
if (bam->avail1 != nullptr) // Check for pointer (avoids segfault)
a1 = ((char*)bam->avail1)[0]; // First byte of available buffer memory
if (bam->avail2 != nullptr) // Check for pointer (avoids segfault)
a2 = ((char*)bam->avail1)[0]; // Second byte of available buffer memory
This structure contains a Block Allocation Map (BAM) of the positions and lengths of data blocks in r...
Definition rring_bam:53
void * avail1
Pointer to first portion of available buffer memory.
Definition rring_bam:72
void * avail2
Pointer to second portion of available buffer memory, if this part of the ring buffer straddles the b...
Definition rring_bam:79
void * block2
Pointer to second portion of utilized buffer memory, if this part of the ring buffer straddles the bo...
Definition rring_bam:66
void * block1
Pointer to first portion of utilized buffer memory.
Definition rring_bam:59
See also
randolf::rring::data_bam
History
  • 2024-Dec-03 v1.00 Initial version
Version
1.00
Author
Randolf Richardson

Member Data Documentation

◆ block1

void* randolf::rring_bam::block1

Pointer to first portion of utilized buffer memory.

◆ block2

void* randolf::rring_bam::block2

Pointer to second portion of utilized buffer memory, if this part of the ring buffer straddles the boundary, otherwise nullptr will be specified.

◆ avail1

void* randolf::rring_bam::avail1

Pointer to first portion of available buffer memory.

◆ avail2

void* randolf::rring_bam::avail2

Pointer to second portion of available buffer memory, if this part of the ring buffer straddles the boundary, otherwise nullptr will be specified.

◆ block1_size

size_t randolf::rring_bam::block1_size

Number of elements in block1.

◆ block2_size

size_t randolf::rring_bam::block2_size

Number of elements in block2.

◆ avail1_size

size_t randolf::rring_bam::avail1_size

Number of elements in avail1.

◆ avail2_size

size_t randolf::rring_bam::avail2_size

Number of elements in avail2.


The documentation for this struct was generated from the following file: