1 #ifndef _artdaq_DAQrate_RequestBuffer_hh_
2 #define _artdaq_DAQrate_RequestBuffer_hh_
4 #include <condition_variable>
8 #include "artdaq-core/Data/Fragment.hh"
18 void push(artdaq::Fragment::sequence_id_t seq, artdaq::Fragment::timestamp_t ts);
26 std::map<artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t>
GetRequests()
const;
34 std::pair<artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t>
GetNextRequest();
50 std::map<artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t>
GetAndClearRequests();
69 std::chrono::steady_clock::time_point
GetRequestTime(artdaq::Fragment::sequence_id_t reqID);
71 bool isRunning()
const {
return receiver_running_; }
72 void setRunning(
bool running) { receiver_running_ = running; }
75 std::map<artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t> requests_;
76 std::map<artdaq::Fragment::sequence_id_t, std::chrono::steady_clock::time_point> request_timing_;
77 std::atomic<artdaq::Fragment::sequence_id_t> highest_seen_request_;
78 std::atomic<artdaq::Fragment::sequence_id_t> last_next_request_;
79 std::set<artdaq::Fragment::sequence_id_t> out_of_order_requests_;
80 artdaq::Fragment::sequence_id_t request_increment_;
81 mutable std::mutex request_mutex_;
82 std::condition_variable request_cv_;
84 std::atomic<bool> receiver_running_;
88 #endif // _artdaq_DAQrate_RequestBuffer_hh_
void ClearRequests()
Clear all requests from the map
std::map< artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t > GetAndClearRequests()
Get the current requests, then clear the map
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 GetN...
std::map< artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t > GetRequests() const
Get the current requests
std::chrono::steady_clock::time_point GetRequestTime(artdaq::Fragment::sequence_id_t reqID)
Get the time a given request was received
bool WaitForRequests(int timeout_ms)
Wait for a new request message, up to the timeout given
void RemoveRequest(artdaq::Fragment::sequence_id_t reqID)
Remove the request with the given sequence ID from the request map
size_t size()
Get the number of requests currently stored in the RequestReceiver