Psyllid
v1.12.4
Project 8 Data Acquisisition Software
|
Handles asynchronous creation of on-deck monarch files and finishing of completed files. More...
#include <monarch3_wrap.hh>
Public Member Functions | |
monarch_on_deck_manager (monarch_wrapper *a_monarch_wrap) | |
~monarch_on_deck_manager () | |
const monarch3::Monarch3 * | od_ptr () const |
const monarch3::Monarch3 * | tf_ptr () const |
bool | pointers_empty () const |
Return true if both f_monarch_on_deck and f_monarch_to_finish are empty. More... | |
bool | mod_exists () const |
Return true if f_monarch_on_deck exists. More... | |
bool | mtf_exists () const |
Return true if f_monarch_to_finish exists. More... | |
void | execute () |
Execute the thread loop: handle the asynchronous processing of the on-deck and to-finish monarch objects. More... | |
void | create_on_deck () |
Create the on-deck monarch object if it doesn't exist already (synchronous) More... | |
void | clear_on_deck () |
Clear the on-deck monarch object (synchronous) More... | |
void | finish_to_finish () |
Finish the to-finish monarch object (synchronous) More... | |
void | notify () |
Notify the manager to process its monarch objects if needed (asynchronous) More... | |
void | set_as_to_finish (std::shared_ptr< monarch3::Monarch3 > &a_monarch) |
Give a monarch object to the on-deck manager with the intent that it be finished asynchronously. More... | |
void | get_on_deck (std::shared_ptr< monarch3::Monarch3 > &a_monarch) |
Get the on-deck monarch object that has been created asynchronously. More... | |
Private Member Functions | |
void | create_on_deck_nolock () |
void | finish_to_finish_nolock () |
Private Attributes | |
const monarch_wrapper * | f_monarch_wrap |
std::shared_ptr< monarch3::Monarch3 > | f_monarch_on_deck |
std::shared_ptr< monarch3::Monarch3 > | f_monarch_to_finish |
std::condition_variable | f_od_condition |
std::condition_variable | f_od_continue_condition |
std::mutex | f_od_mutex |
Handles asynchronous creation of on-deck monarch files and finishing of completed files.
This class allows runs to be spread across multiple files with minimal time needed to switch between files.
The on-deck file is created asynchronously so that, ideally, there's always a new file ready when the currently filling file runs out of space. Switching between files is then as simple as switching file and stream pointers (modululo a bunch of careful thread synchronization).
Similarly, to help speed things along, file completion is also handled asynchronously by the same manager object.
The "on-deck" monarch object is the new file waiting to be used. The "to-finish" monarch object is a recently finished file waiting to be closed.
Definition at line 87 of file monarch3_wrap.hh.
monarch_on_deck_manager | ( | monarch_wrapper * | a_monarch_wrap | ) |
Definition at line 48 of file monarch3_wrap.cc.
Definition at line 57 of file monarch3_wrap.cc.
void clear_on_deck | ( | ) |
Clear the on-deck monarch object (synchronous)
Definition at line 192 of file monarch3_wrap.cc.
|
inline |
Create the on-deck monarch object if it doesn't exist already (synchronous)
Definition at line 388 of file monarch3_wrap.hh.
|
private |
Definition at line 109 of file monarch3_wrap.cc.
void execute | ( | ) |
Execute the thread loop: handle the asynchronous processing of the on-deck and to-finish monarch objects.
Definition at line 60 of file monarch3_wrap.cc.
void finish_to_finish | ( | ) |
Finish the to-finish monarch object (synchronous)
Definition at line 221 of file monarch3_wrap.cc.
|
inlineprivate |
Definition at line 396 of file monarch3_wrap.hh.
|
inline |
Get the on-deck monarch object that has been created asynchronously.
Definition at line 380 of file monarch3_wrap.hh.
|
inline |
Return true if f_monarch_on_deck exists.
Definition at line 357 of file monarch3_wrap.hh.
|
inline |
Return true if f_monarch_to_finish exists.
Definition at line 362 of file monarch3_wrap.hh.
|
inline |
Notify the manager to process its monarch objects if needed (asynchronous)
Definition at line 367 of file monarch3_wrap.hh.
|
inline |
Definition at line 93 of file monarch3_wrap.hh.
|
inline |
Return true if both f_monarch_on_deck and f_monarch_to_finish are empty.
Definition at line 352 of file monarch3_wrap.hh.
|
inline |
Give a monarch object to the on-deck manager with the intent that it be finished asynchronously.
Definition at line 373 of file monarch3_wrap.hh.
|
inline |
Definition at line 94 of file monarch3_wrap.hh.
|
private |
Definition at line 127 of file monarch3_wrap.hh.
|
private |
Definition at line 128 of file monarch3_wrap.hh.
|
private |
Definition at line 125 of file monarch3_wrap.hh.
|
private |
Definition at line 129 of file monarch3_wrap.hh.
|
private |
Definition at line 130 of file monarch3_wrap.hh.
|
private |
Definition at line 131 of file monarch3_wrap.hh.