Psyllid  v1.12.4
Project 8 Data Acquisisition Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
monarch_on_deck_manager Class Reference

Handles asynchronous creation of on-deck monarch files and finishing of completed files. More...

#include <monarch3_wrap.hh>

Inheritance diagram for monarch_on_deck_manager:
Inheritance graph

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_wrapperf_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
 

Detailed Description

Handles asynchronous creation of on-deck monarch files and finishing of completed files.

Author
N. S. Oblath

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.

Constructor & Destructor Documentation

◆ monarch_on_deck_manager()

Definition at line 48 of file monarch3_wrap.cc.

◆ ~monarch_on_deck_manager()

Definition at line 57 of file monarch3_wrap.cc.

Member Function Documentation

◆ clear_on_deck()

void clear_on_deck ( )

Clear the on-deck monarch object (synchronous)

Definition at line 192 of file monarch3_wrap.cc.

◆ create_on_deck()

void create_on_deck ( )
inline

Create the on-deck monarch object if it doesn't exist already (synchronous)

Definition at line 388 of file monarch3_wrap.hh.

◆ create_on_deck_nolock()

void create_on_deck_nolock ( )
private

Definition at line 109 of file monarch3_wrap.cc.

◆ execute()

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.

◆ finish_to_finish()

void finish_to_finish ( )

Finish the to-finish monarch object (synchronous)

Definition at line 221 of file monarch3_wrap.cc.

◆ finish_to_finish_nolock()

void finish_to_finish_nolock ( )
inlineprivate

Definition at line 396 of file monarch3_wrap.hh.

◆ get_on_deck()

void get_on_deck ( std::shared_ptr< monarch3::Monarch3 > &  a_monarch)
inline

Get the on-deck monarch object that has been created asynchronously.

Definition at line 380 of file monarch3_wrap.hh.

◆ mod_exists()

bool mod_exists ( ) const
inline

Return true if f_monarch_on_deck exists.

Definition at line 357 of file monarch3_wrap.hh.

◆ mtf_exists()

bool mtf_exists ( ) const
inline

Return true if f_monarch_to_finish exists.

Definition at line 362 of file monarch3_wrap.hh.

◆ notify()

void notify ( )
inline

Notify the manager to process its monarch objects if needed (asynchronous)

Definition at line 367 of file monarch3_wrap.hh.

◆ od_ptr()

const monarch3::Monarch3* od_ptr ( ) const
inline

Definition at line 93 of file monarch3_wrap.hh.

◆ pointers_empty()

bool pointers_empty ( ) const
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.

◆ set_as_to_finish()

void set_as_to_finish ( std::shared_ptr< monarch3::Monarch3 > &  a_monarch)
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.

◆ tf_ptr()

const monarch3::Monarch3* tf_ptr ( ) const
inline

Definition at line 94 of file monarch3_wrap.hh.

Member Data Documentation

◆ f_monarch_on_deck

std::shared_ptr< monarch3::Monarch3 > f_monarch_on_deck
private

Definition at line 127 of file monarch3_wrap.hh.

◆ f_monarch_to_finish

std::shared_ptr< monarch3::Monarch3 > f_monarch_to_finish
private

Definition at line 128 of file monarch3_wrap.hh.

◆ f_monarch_wrap

const monarch_wrapper* f_monarch_wrap
private

Definition at line 125 of file monarch3_wrap.hh.

◆ f_od_condition

std::condition_variable f_od_condition
private

Definition at line 129 of file monarch3_wrap.hh.

◆ f_od_continue_condition

std::condition_variable f_od_continue_condition
private

Definition at line 130 of file monarch3_wrap.hh.

◆ f_od_mutex

std::mutex f_od_mutex
private

Definition at line 131 of file monarch3_wrap.hh.


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