Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::CsvDumper Class Reference

Asynchronous CSV dumper. Writes entries to CSV file from background thread. Recommended to be used from a single thread. More...

#include <csv_dumper.h>

Inheritance diagram for roc::core::CsvDumper:
Collaboration diagram for roc::core::CsvDumper:

Public Member Functions

 CsvDumper (const char *path, const CsvConfig &config, IArena &arena)
 Open file. path - output file. max_interval - maximum number of writes per second for each entry type. More...
 
 ~CsvDumper ()
 Close file. More...
 
bool is_valid () const
 Check if opened without errors. More...
 
bool would_write (char type)
 Check whether write() would enqueue or drop entry. Lock-free operation. More...
 
void write (const CsvEntry &entry)
 Enqueue entry for writing. Makes a copy of entry and pushes it to a lock-free ring buffer. If buffer size limit or rate limit is exceeded, entry is dropped. Lock-free operation. More...
 
void stop ()
 Stop background thread. More...
 
- Public Member Functions inherited from roc::core::Thread
bool is_joinable () const
 Check if thread was started and can be joined. More...
 
ROC_ATTR_NODISCARD bool start ()
 Start thread. More...
 
void join ()
 Join thread. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from roc::core::Thread
static uint64_t get_pid ()
 Get numeric identifier of current process. More...
 
static uint64_t get_tid ()
 Get numeric identifier of current thread. More...
 
static ROC_ATTR_NODISCARD bool enable_realtime ()
 Raise current thread priority to realtime. More...
 

Detailed Description

Asynchronous CSV dumper. Writes entries to CSV file from background thread. Recommended to be used from a single thread.

Definition at line 64 of file csv_dumper.h.

Constructor & Destructor Documentation

◆ CsvDumper()

roc::core::CsvDumper::CsvDumper ( const char *  path,
const CsvConfig config,
IArena arena 
)

Open file. path - output file. max_interval - maximum number of writes per second for each entry type.

◆ ~CsvDumper()

roc::core::CsvDumper::~CsvDumper ( )

Close file.

Member Function Documentation

◆ is_valid()

bool roc::core::CsvDumper::is_valid ( ) const

Check if opened without errors.

◆ stop()

void roc::core::CsvDumper::stop ( )

Stop background thread.

◆ would_write()

bool roc::core::CsvDumper::would_write ( char  type)

Check whether write() would enqueue or drop entry. Lock-free operation.

◆ write()

void roc::core::CsvDumper::write ( const CsvEntry entry)

Enqueue entry for writing. Makes a copy of entry and pushes it to a lock-free ring buffer. If buffer size limit or rate limit is exceeded, entry is dropped. Lock-free operation.


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