lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Eb::Batch Class Reference

One batch of fixed-size entries in an RDMA region: its start pulse ID, its buffer (chosen from the pulse ID) and its current extent. More...

#include <Batch.hh>

Public Member Functions

 Batch ()
 Construct with zero entry size, ID and extent; the buffer pointer is left uninitialized.
 
int initialize (size_t bufSize)
 Set the entry size to bufSize; returns 0.
 
Pds::EbDgram * allocate ()
 Return the next entry (buffer plus current extent) as an EbDgram pointer and advance the extent by one entry size.
 
Batch * initialize (void *region, uint64_t pid)
 Start the batch for pulse ID pid: the buffer becomes region plus index(pid) entries and the extent is reset to 0.
 
size_t extent () const
 Return the current extent in bytes (number of allocated entries times the entry size).
 
uint64_t id () const
 Return the full pulse ID the batch was initialized with.
 
unsigned index () const
 Return index(id()).
 
const void * buffer () const
 Return the start of this batch in the region.
 
void dump () const
 Print the batch and one line per entry (up to MAX_ENTRIES, stopping at an entry whose pulse ID is 0) to stderr, or a short message if the buffer is null.
 

Static Public Member Functions

static uint64_t index (uint64_t pid)
 Return pid modulo MAX_LATENCY (its low bits), used as the slot index of a batch.
 

Detailed Description

One batch of fixed-size entries in an RDMA region: its start pulse ID, its buffer (chosen from the pulse ID) and its current extent.

Constructor & Destructor Documentation

◆ Batch()

Pds::Eb::Batch::Batch ( )

Construct with zero entry size, ID and extent; the buffer pointer is left uninitialized.

Member Function Documentation

◆ allocate()

Pds::EbDgram * Pds::Eb::Batch::allocate ( )
inline

Return the next entry (buffer plus current extent) as an EbDgram pointer and advance the extent by one entry size.

There is no bounds check.

◆ buffer()

const void * Pds::Eb::Batch::buffer ( ) const
inline

Return the start of this batch in the region.

◆ dump()

void Pds::Eb::Batch::dump ( ) const

Print the batch and one line per entry (up to MAX_ENTRIES, stopping at an entry whose pulse ID is 0) to stderr, or a short message if the buffer is null.

◆ extent()

size_t Pds::Eb::Batch::extent ( ) const
inline

Return the current extent in bytes (number of allocated entries times the entry size).

◆ id()

uint64_t Pds::Eb::Batch::id ( ) const
inline

Return the full pulse ID the batch was initialized with.

◆ index() [1/2]

unsigned Pds::Eb::Batch::index ( ) const
inline

Return index(id()).

◆ index() [2/2]

uint64_t Pds::Eb::Batch::index ( uint64_t  pid)
inlinestatic

Return pid modulo MAX_LATENCY (its low bits), used as the slot index of a batch.

◆ initialize() [1/2]

int Pds::Eb::Batch::initialize ( size_t  bufSize)

Set the entry size to bufSize; returns 0.

◆ initialize() [2/2]

Pds::Eb::Batch * Pds::Eb::Batch::initialize ( void *  region,
uint64_t  pid 
)
inline

Start the batch for pulse ID pid: the buffer becomes region plus index(pid) entries and the extent is reset to 0.

Returns this.


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