artdaq  v3_08_00
artdaq::RequestReceiver Class Reference

Receive data requests and make them available to CommandableFragmentGenerator or other interested parties. Track received requests and report errors when inconsistency is detected. More...

#include <artdaq/DAQrate/RequestReceiver.hh>

Classes

struct  Config
 Configuration of the RequestReceiver. May be used for parameter validation More...
 

Public Types

using Parameters = fhicl::WrappedTable< Config >
 Used for ParameterSet validation (if desired)
 

Public Member Functions

 RequestReceiver ()
 RequestReceiver Default Constructor.
 
 RequestReceiver (const fhicl::ParameterSet &ps)
 RequestReceiver Constructor. More...
 
void setupRequestListener ()
 Opens the socket used to listen for data requests.
 
void stopRequestReception (bool force=false)
 Disables (stops) the reception of data requests. More...
 
void startRequestReception ()
 Enables (starts) the reception of data requests.
 
void receiveRequestsLoop ()
 This function receives data request packets, adding new requests to the request list.
 
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...
 
bool isRunning ()
 Determine if the RequestReceiver is receiving requests 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...
 
void SetRunNumber (uint32_t run)
 Sets the current run number More...
 

Detailed Description

Receive data requests and make them available to CommandableFragmentGenerator or other interested parties. Track received requests and report errors when inconsistency is detected.

Definition at line 17 of file RequestReceiver.hh.

Constructor & Destructor Documentation

artdaq::RequestReceiver::RequestReceiver ( const fhicl::ParameterSet &  ps)

RequestReceiver Constructor.

Parameters
psParameterSet used to configure RequestReceiver. See artdaq::RequestReceiver::Config

Definition at line 52 of file RequestReceiver.cc.

Member Function Documentation

void artdaq::RequestReceiver::ClearRequests ( )
inline

Clear all requests from the map

Definition at line 110 of file RequestReceiver.hh.

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

Get the current requests, then clear the map

Returns
Map relating sequence IDs to timestamps

Definition at line 120 of file RequestReceiver.hh.

std::pair< artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t > artdaq::RequestReceiver::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 304 of file RequestReceiver.cc.

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

Get the current requests

Returns
Map relating sequence IDs to timestamps

Definition at line 76 of file RequestReceiver.hh.

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

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 164 of file RequestReceiver.hh.

bool artdaq::RequestReceiver::isRunning ( )
inline

Determine if the RequestReceiver is receiving requests

Returns
True if the request receiver is running

Definition at line 105 of file RequestReceiver.hh.

void artdaq::RequestReceiver::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 320 of file RequestReceiver.cc.

void artdaq::RequestReceiver::SetRunNumber ( uint32_t  run)
inline

Sets the current run number

Parameters
runThe current run number

Definition at line 174 of file RequestReceiver.hh.

size_t artdaq::RequestReceiver::size ( )
inline

Get the number of requests currently stored in the RequestReceiver

Returns
The number of requests stored in the RequestReceiver

Definition at line 139 of file RequestReceiver.hh.

void artdaq::RequestReceiver::stopRequestReception ( bool  force = false)

Disables (stops) the reception of data requests.

Parameters
forceWhether to suppress any error messages (used if called from destructor)

Definition at line 134 of file RequestReceiver.cc.

bool artdaq::RequestReceiver::WaitForRequests ( int  timeout_ms)
inline

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 150 of file RequestReceiver.hh.


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