The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
lsl2ac::save_var_t< std::string > Class Reference

Specialication for marker streams. More...

Inheritance diagram for lsl2ac::save_var_t< std::string >:
Inheritance graph

Public Member Functions

 save_var_t (const save_var_t &)=delete
 
 save_var_t (save_var_t &&)=delete
 
virtual ~save_var_t ()=default
 
save_var_toperator= (const save_var_t &)=delete
 
save_var_toperator= (save_var_t &&)=delete
 
 save_var_t (const lsl::stream_info &info_, MHA_AC::algo_comm_t &ac_, overrun_behavior ob_, int buflen_, int chunksize_, int strlen_)
 C'tor of lsl to ac bridge. More...
 
lsl::stream_info info () override
 Get stream info object from stream inlet. More...
 
void receive_frame () override
 Receive a samples from lsl and copy to AC space. More...
 
- Public Member Functions inherited from lsl2ac::save_var_base_t
virtual ~save_var_base_t ()=default
 

Private Member Functions

std::size_t copy_string_safe ()
 Copy string to AC buffer, stop at the latest at buffer end, make sure that the string is always zero-terminated. More...
 
void pull_samples_ignore ()
 Pull new samples, ignore overrun, i.e. More...
 
void pull_samples_discard ()
 Pull new samples as long as there are samples ready for pickup in the LSL buffers. More...
 
void get_time_correction ()
 Refresh time correction value every 5s. More...
 
void insert_vars ()
 Insert stream value, time stamp and time offset into ac space. More...
 

Private Attributes

lsl::stream_inlet stream
 LSL stream outlet. More...
 
std::string str
 Temporary storage for marker string. More...
 
std::vector< char > buf
 Data buffer of the ac variable. More...
 
double ts
 Timestamp. More...
 
MHA_AC::algo_comm_tac
 Handle to AC space. More...
 
MHA_AC::comm_var_t cv
 Timeseries AC variable. More...
 
double tc =0.0
 Current time correction. More...
 
std::string ts_name
 Timestamp AC variable name. More...
 
std::string tc_name
 Time correction AC variable name. More...
 
std::string new_name
 Number of new samples AC variable name. More...
 
std::chrono::time_point< std::chrono::steady_clock > tic
 time point of last time correction pull More...
 
bool skip =false
 Should the variable be skipped in future process calls? Only true when error occured. More...
 
overrun_behavior ob
 Behavior on stream overrun. More...
 
const std::string name
 Name of stream. More...
 

Detailed Description

Specialication for marker streams.

Constructor & Destructor Documentation

◆ save_var_t() [1/3]

lsl2ac::save_var_t< std::string >::save_var_t ( const save_var_t< std::string > &  )
delete

◆ save_var_t() [2/3]

lsl2ac::save_var_t< std::string >::save_var_t ( save_var_t< std::string > &&  )
delete

◆ ~save_var_t()

virtual lsl2ac::save_var_t< std::string >::~save_var_t ( )
virtualdefault

◆ save_var_t() [3/3]

lsl2ac::save_var_t< std::string >::save_var_t ( const lsl::stream_info &  info_,
MHA_AC::algo_comm_t ac_,
overrun_behavior  ob_,
int  buflen_,
int  chunksize_,
int  strlen_ 
)
inline

C'tor of lsl to ac bridge.

Parameters
name_Name of LSL stream to be received
info_LSL stream info object containing metadata
ac_Handle to ac space
ob_Overrun behavior. 0=Discard oldest, 1=Ignore
buflen_LSL buffer size
chunksize_LSL chunk size
strlen_Length string buffer.

Member Function Documentation

◆ operator=() [1/2]

save_var_t& lsl2ac::save_var_t< std::string >::operator= ( const save_var_t< std::string > &  )
delete

◆ operator=() [2/2]

save_var_t& lsl2ac::save_var_t< std::string >::operator= ( save_var_t< std::string > &&  )
delete

◆ info()

lsl::stream_info lsl2ac::save_var_t< std::string >::info ( )
inlineoverridevirtual

Get stream info object from stream inlet.

Implements lsl2ac::save_var_base_t.

◆ receive_frame()

void lsl2ac::save_var_t< std::string >::receive_frame ( )
inlineoverridevirtual

Receive a samples from lsl and copy to AC space.

Handling of underrun is configuration-dependent

Implements lsl2ac::save_var_base_t.

◆ copy_string_safe()

std::size_t lsl2ac::save_var_t< std::string >::copy_string_safe ( )
inlineprivate

Copy string to AC buffer, stop at the latest at buffer end, make sure that the string is always zero-terminated.

Returns
The number of characters copied into the AC buffer, also the number entries in the AC variable

◆ pull_samples_ignore()

void lsl2ac::save_var_t< std::string >::pull_samples_ignore ( )
inlineprivate

Pull new samples, ignore overrun, i.e.

only pull one sample from the buffer, do not check if there are newer ones waiting

◆ pull_samples_discard()

void lsl2ac::save_var_t< std::string >::pull_samples_discard ( )
inlineprivate

Pull new samples as long as there are samples ready for pickup in the LSL buffers.

Overwrite old markers

◆ get_time_correction()

void lsl2ac::save_var_t< std::string >::get_time_correction ( )
inlineprivate

Refresh time correction value every 5s.

◆ insert_vars()

void lsl2ac::save_var_t< std::string >::insert_vars ( )
inlineprivate

Insert stream value, time stamp and time offset into ac space.

Member Data Documentation

◆ stream

lsl::stream_inlet lsl2ac::save_var_t< std::string >::stream
private

LSL stream outlet.

Interface to lsl

◆ str

std::string lsl2ac::save_var_t< std::string >::str
private

Temporary storage for marker string.

◆ buf

std::vector<char> lsl2ac::save_var_t< std::string >::buf
private

Data buffer of the ac variable.

◆ ts

double lsl2ac::save_var_t< std::string >::ts
private

Timestamp.

◆ ac

MHA_AC::algo_comm_t& lsl2ac::save_var_t< std::string >::ac
private

Handle to AC space.

◆ cv

MHA_AC::comm_var_t lsl2ac::save_var_t< std::string >::cv
private

Timeseries AC variable.

◆ tc

double lsl2ac::save_var_t< std::string >::tc =0.0
private

Current time correction.

◆ ts_name

std::string lsl2ac::save_var_t< std::string >::ts_name
private

Timestamp AC variable name.

◆ tc_name

std::string lsl2ac::save_var_t< std::string >::tc_name
private

Time correction AC variable name.

◆ new_name

std::string lsl2ac::save_var_t< std::string >::new_name
private

Number of new samples AC variable name.

◆ tic

std::chrono::time_point<std::chrono::steady_clock> lsl2ac::save_var_t< std::string >::tic
private

time point of last time correction pull

◆ skip

bool lsl2ac::save_var_t< std::string >::skip =false
private

Should the variable be skipped in future process calls? Only true when error occured.

◆ ob

overrun_behavior lsl2ac::save_var_t< std::string >::ob
private

Behavior on stream overrun.

◆ name

const std::string lsl2ac::save_var_t< std::string >::name
private

Name of stream.

Must be saved separately because the stream info might be unrecoverable in error cases


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