artdaq  v3_12_02
artdaq::RequestBuffer Class Reference

Holds requests from RequestReceiver while they are being processed. More...

#include <artdaq/DAQrate/RequestBuffer.hh>

Public Member Functions

 RequestBuffer (Fragment::sequence_id_t request_increment=1)
 RequestBuffer Constructor. More...
 
virtual ~RequestBuffer ()
 RequestBuffer Destructor.
 
void push (artdaq::Fragment::sequence_id_t seq, artdaq::Fragment::timestamp_t ts)
 Add a Request to the buffer. More...
 
void reset ()
 Reset RequestBuffer, discarding all requests and tracking information.
 
std::map
< artdaq::Fragment::sequence_id_t,
artdaq::Fragment::timestamp_t > 
GetRequests () const
 Get the current requests More...
 
std::pair
< artdaq::Fragment::sequence_id_t,
artdaq::Fragment::timestamp_t > 
GetNextRequest ()
 Get the "next" request, i.e. the first unsatisfied request that has not already been returned by GetNextRequest More...
 
void RemoveRequest (artdaq::Fragment::sequence_id_t reqID)
 Remove the request with the given sequence ID from the request map More...
 
void ClearRequests ()
 Clear all requests from the map More...
 
std::map
< artdaq::Fragment::sequence_id_t,
artdaq::Fragment::timestamp_t > 
GetAndClearRequests ()
 Get the current requests, then clear the map More...
 
size_t size ()
 Get the number of requests currently stored in the RequestReceiver More...
 
bool WaitForRequests (int timeout_ms)
 Wait for a new request message, up to the timeout given More...
 
std::chrono::steady_clock::time_point GetRequestTime (artdaq::Fragment::sequence_id_t reqID)
 Get the time a given request was received More...
 
bool isRunning () const
 Determine whether the RequestBuffer is active. More...
 
void setRunning (bool running)
 Set whether the RequestBuffer is active. More...
 

Detailed Description

Holds requests from RequestReceiver while they are being processed.

Definition at line 15 of file RequestBuffer.hh.

Constructor & Destructor Documentation

artdaq::RequestBuffer::RequestBuffer ( Fragment::sequence_id_t  request_increment = 1)
explicit

RequestBuffer Constructor.

Parameters
request_incrementExpected increase in request sequence ID each request

Definition at line 6 of file RequestBuffer.cc.

Member Function Documentation

void artdaq::RequestBuffer::ClearRequests ( )

Clear all requests from the map

Definition at line 134 of file RequestBuffer.cc.

std::map< artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t > artdaq::RequestBuffer::GetAndClearRequests ( )

Get the current requests, then clear the map

Returns
Map relating sequence IDs to timestamps

Definition at line 145 of file RequestBuffer.cc.

std::pair< artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t > artdaq::RequestBuffer::GetNextRequest ( )

Get the "next" request, i.e. the first unsatisfied request that has not already been returned by GetNextRequest

Returns
Request data for "next" request. Will return (0,0) if there is no "next" request

This function uses last_next_request_ to ensure that it does not return the same request more than once

Definition at line 74 of file RequestBuffer.cc.

std::map< artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t > artdaq::RequestBuffer::GetRequests ( ) const

Get the current requests

Returns
Map relating sequence IDs to timestamps

Definition at line 63 of file RequestBuffer.cc.

std::chrono::steady_clock::time_point artdaq::RequestBuffer::GetRequestTime ( artdaq::Fragment::sequence_id_t  reqID)

Get the time a given request was received

Parameters
reqIDRequest ID of the request
Returns
steady_clock::time_point corresponding to when the request was received

Definition at line 192 of file RequestBuffer.cc.

bool artdaq::RequestBuffer::isRunning ( ) const
inline

Determine whether the RequestBuffer is active.

Returns

Definition at line 94 of file RequestBuffer.hh.

void artdaq::RequestBuffer::push ( artdaq::Fragment::sequence_id_t  seq,
artdaq::Fragment::timestamp_t  ts 
)

Add a Request to the buffer.

Parameters
seqSequence ID of the request
tsTimestamp for the request

Definition at line 20 of file RequestBuffer.cc.

void artdaq::RequestBuffer::RemoveRequest ( artdaq::Fragment::sequence_id_t  reqID)

Remove the request with the given sequence ID from the request map

Parameters
reqIDRequest ID to remove

Definition at line 90 of file RequestBuffer.cc.

void artdaq::RequestBuffer::setRunning ( bool  running)
inline

Set whether the RequestBuffer is active.

Parameters
runningWhether the RequestBuffer is active

Definition at line 99 of file RequestBuffer.hh.

size_t artdaq::RequestBuffer::size ( )

Get the number of requests currently stored in the RequestReceiver

Returns
The number of requests stored in the RequestReceiver

Definition at line 165 of file RequestBuffer.cc.

bool artdaq::RequestBuffer::WaitForRequests ( int  timeout_ms)

Wait for a new request message, up to the timeout given

Parameters
timeout_msMilliseconds to wait for a new request to arrive
Returns
True if any requests are present in the request map

Definition at line 177 of file RequestBuffer.cc.


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