dsp::OutputFileShare Class Reference

Share one OutputFile among multiple processing threads. More...

#include <OutputFileShare.h>

Inheritance diagram for dsp::OutputFileShare:
Reference::Able Reference::HeapTracked

Public Member Functions

 OutputFileShare (unsigned contributors)
 Constructor.
 
virtual ~OutputFileShare ()
 Destructor.
 
OutputFileget_output_file () const
 Get the output file.
 
void set_output_file (OutputFile *f)
 Set the output file.
 
void set_context (ThreadContext *t)
 Set the thread context.
 
ThreadContextget_context () const
 Set the thread context.
 
Submit * new_Submit (unsigned contributor)
 Return Submit interface for given contributor.
 
MJD get_next_time () const
 Return next time.
 
void set_next_time (MJD time)
 set next time
 
void signal_ready (unsigned contributor, MJD start_time)
 Call when a contributor is ready to write. More...
 
void signal_done (unsigned contributor)
 Call when a contributor is done. More...
 
- Public Member Functions inherited from Reference::Able
 Able (const Able &)
 
Ableoperator= (const Able &)
 
unsigned get_reference_count () const
 
- Public Member Functions inherited from Reference::HeapTracked
 HeapTracked (const HeapTracked &)
 
HeapTrackedoperator= (const HeapTracked &)
 
bool __is_on_heap () const
 

Protected Attributes

unsigned contributors
 Number of contributors.
 
Reference::To< OutputFileoutput_file
 The actual output file unloader.
 
ThreadContextcontext
 Coordinate various threads.
 
MJD next_time
 Leading edge time of next output sample.
 
std::vector< MJDstart_times
 Current start times of waiting contributors.
 
bool first
 first-time-through flag
 
unsigned nready
 Number of threads currently ready to write data.
 

Additional Inherited Members

- Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
 
- Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 
static void operator delete (void *location, void *ptr)
 
static void operator delete (void *location)
 
static size_t get_heap_queue_size ()
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Detailed Description

Share one OutputFile among multiple processing threads.

Coordinates writing of BitSeries output from multiple threads into a single, correctly time-ordered file.

The algorithm is for each thread to wait its turn, only writing data when it has the expected next piece. If all threads are waiting, the one with the earliest start time is written (should not happen for contiguous data).

Some elements of this class are patterned after UnloaderShare and could potentially be refactored into a common base class.

Member Function Documentation

◆ signal_done()

void dsp::OutputFileShare::signal_done ( unsigned  contributor)

Call when a contributor is done.

Signal that a thread is done.

◆ signal_ready()

void dsp::OutputFileShare::signal_ready ( unsigned  contributor,
MJD  start_time 
)

Call when a contributor is ready to write.

Signal that a thread is ready to write.


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

Generated using doxygen 1.8.17