Psyllid
v1.12.4
Project 8 Data Acquisisition Software
|
Wrapper class for a monarch3::M3Monarch object. More...
#include <monarch3_wrap.hh>
Public Member Functions | |
monarch_wrapper (const std::string &a_filename) | |
~monarch_wrapper () | |
unsigned | get_and_increment_file_count () const |
As it says, return the current value to, and then increment, the file count. More... | |
header_wrap_ptr | get_header () |
Returns the header wrapped in a header_wrap_ptr to be filled at the beginning of file writing. More... | |
const header_wrap_ptr | get_header () const |
Returns the header wrapped in a header_wrap_ptr for read-only use anytime. More... | |
stream_wrap_ptr | get_stream (unsigned a_stream_no) |
void | start_using () |
Make the wrapper available for use; starts parallel on-deck thread. More... | |
void | execute_switch_loop () |
void | trigger_switch () |
bool | okay_to_write () |
Ensure that the file is available to write to (via a stream) More... | |
void | switch_to_new_file () |
void | stop_using () |
Make the wrapper unavailable for use; stops the parallel on-deck thread. More... | |
void | finish_stream (unsigned a_stream_no) |
Finish the given stream. The stream object will be deleted. More... | |
void | finish_file () |
Finish the file. More... | |
monarch_time_point_t | get_run_start_time () const |
void | set_stage (monarch_stage a_stage) |
Override the stage value. More... | |
void | set_max_file_size (double a_size) |
Set the maximum file size used to determine when a new file is automatically started. More... | |
void | record_file_contribution (double a_size) |
Private Member Functions | |
void | do_cancellation (int a_code) |
monarch_wrapper (const monarch_wrapper &)=delete | |
monarch_wrapper & | operator= (const monarch_wrapper &)=delete |
Private Attributes | |
std::string | f_orig_filename |
std::string | f_filename_base |
std::string | f_filename_ext |
unsigned | f_file_count |
double | f_max_file_size_mb |
std::atomic< double > | f_file_size_est_mb |
std::condition_variable | f_wait_to_write |
std::thread * | f_switch_thread |
std::atomic< bool > | f_ok_to_write |
std::atomic< bool > | f_do_switch_flag |
std::condition_variable | f_do_switch_trig |
std::shared_ptr< monarch3::Monarch3 > | f_monarch |
std::mutex | f_monarch_mutex |
header_wrap_ptr | f_header_wrap |
std::map< unsigned, stream_wrap_ptr > | f_stream_wraps |
monarch_time_point_t | f_run_start_time |
monarch_stage | f_stage |
std::thread * | f_od_thread |
monarch_on_deck_manager | f_monarch_od_manager |
Friends | |
class | monarch_on_deck_manager |
Wrapper class for a monarch3::M3Monarch object.
Provides the thread-safe, synchronized access to the Monarch object. All thread safety is handled by the interface functions.
Also owns a monarch_on_deck_manager object to handle asynchronous creation of on-deck files and finishing of completed files.
Definition at line 152 of file monarch3_wrap.hh.
monarch_wrapper | ( | const std::string & | a_filename | ) |
Definition at line 239 of file monarch3_wrap.cc.
~monarch_wrapper | ( | ) |
Definition at line 284 of file monarch3_wrap.cc.
|
privatedelete |
|
inlineprivate |
Definition at line 428 of file monarch3_wrap.hh.
void execute_switch_loop | ( | ) |
Definition at line 427 of file monarch3_wrap.cc.
void finish_file | ( | ) |
Finish the file.
Definition at line 519 of file monarch3_wrap.cc.
void finish_stream | ( | unsigned | a_stream_no | ) |
Finish the given stream. The stream object will be deleted.
Definition at line 500 of file monarch3_wrap.cc.
|
inline |
As it says, return the current value to, and then increment, the file count.
Definition at line 417 of file monarch3_wrap.hh.
header_wrap_ptr get_header | ( | ) |
Returns the header wrapped in a header_wrap_ptr to be filled at the beginning of file writing.
Definition at line 330 of file monarch3_wrap.cc.
|
inline |
Returns the header wrapped in a header_wrap_ptr for read-only use anytime.
Definition at line 407 of file monarch3_wrap.hh.
|
inline |
Definition at line 412 of file monarch3_wrap.hh.
stream_wrap_ptr get_stream | ( | unsigned | a_stream_no | ) |
Returns the requested stream wrapped in a stream_wrap_ptr to be used to write records to the file. If the header had not been written, this writes the header to the file.
Definition at line 351 of file monarch3_wrap.cc.
|
inline |
Ensure that the file is available to write to (via a stream)
Definition at line 660 of file monarch3_wrap.cc.
|
privatedelete |
void record_file_contribution | ( | double | a_size | ) |
If keeping track of file sizes for automatically creating new files, use this to inform the monarch_wrapper that a given number of bytes was written to the file. This should be called every time a record is written to the file.
Definition at line 647 of file monarch3_wrap.cc.
|
inline |
Set the maximum file size used to determine when a new file is automatically started.
Definition at line 422 of file monarch3_wrap.hh.
void set_stage | ( | monarch_stage | a_stage | ) |
Override the stage value.
Definition at line 640 of file monarch3_wrap.cc.
void start_using | ( | ) |
Make the wrapper available for use; starts parallel on-deck thread.
Definition at line 374 of file monarch3_wrap.cc.
void stop_using | ( | ) |
Make the wrapper unavailable for use; stops the parallel on-deck thread.
Definition at line 477 of file monarch3_wrap.cc.
void switch_to_new_file | ( | ) |
Switch to a new file that continues the first file. The filename is automatically determine from the original filename by appending an integer count of the number of continuation files. If file contributions are being recorded, this is done automatically when the maximum file size is exceeded.
Definition at line 579 of file monarch3_wrap.cc.
void trigger_switch | ( | ) |
Definition at line 468 of file monarch3_wrap.cc.
|
friend |
Definition at line 207 of file monarch3_wrap.hh.
|
private |
Definition at line 224 of file monarch3_wrap.hh.
|
private |
Definition at line 225 of file monarch3_wrap.hh.
|
mutableprivate |
Definition at line 217 of file monarch3_wrap.hh.
|
private |
Definition at line 220 of file monarch3_wrap.hh.
|
private |
Definition at line 215 of file monarch3_wrap.hh.
|
private |
Definition at line 216 of file monarch3_wrap.hh.
|
private |
Definition at line 230 of file monarch3_wrap.hh.
|
private |
Definition at line 219 of file monarch3_wrap.hh.
|
private |
Definition at line 227 of file monarch3_wrap.hh.
|
mutableprivate |
Definition at line 228 of file monarch3_wrap.hh.
|
private |
Definition at line 239 of file monarch3_wrap.hh.
|
private |
Definition at line 238 of file monarch3_wrap.hh.
|
private |
Definition at line 223 of file monarch3_wrap.hh.
|
private |
Definition at line 214 of file monarch3_wrap.hh.
|
private |
Definition at line 234 of file monarch3_wrap.hh.
|
private |
Definition at line 236 of file monarch3_wrap.hh.
|
private |
Definition at line 232 of file monarch3_wrap.hh.
|
private |
Definition at line 222 of file monarch3_wrap.hh.
|
private |
Definition at line 221 of file monarch3_wrap.hh.