The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE > Class Template Reference

Template for convenience classes for inserting a numeric scalar into the AC space. More...

Public Member Functions

 scalar_t (algo_comm_t &ac, const std::string &name, numeric_t val=0, bool insert_now=true)
 Initialize memory and metadata of the AC variable. More...
 
 ~scalar_t ()
 Destroy the AC variable: deallocate its memory. More...
 
void insert ()
 Insert or re-insert AC variable into AC space. More...
 
void remove ()
 Remove the AC variable by reference from the AC variable space. More...
 

Public Attributes

numeric_t data
 Numeric value of this AC variable. More...
 

Private Attributes

algo_comm_tac
 AC variable space. More...
 
const std::string name
 Name of this AC variable in the AC variable space. More...
 
const bool remove_during_destructor
 flag whether to remove from AC variable space in destructor. More...
 

Detailed Description

template<typename numeric_t, unsigned int MHA_AC_TYPECODE>
class MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE >

Template for convenience classes for inserting a numeric scalar into the AC space.

Constructor & Destructor Documentation

◆ scalar_t()

template<typename numeric_t , unsigned int MHA_AC_TYPECODE>
MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE >::scalar_t ( algo_comm_t ac,
const std::string &  name,
numeric_t  val = 0,
bool  insert_now = true 
)
inline

Initialize memory and metadata of the AC variable.

Parameters
acAC handle
nameName of variable in AC space
valInitial value
insert_nowIf true, then the constructor inserts the new variable into the AC space, and the destructor will remove the variable from AC space when it executes.

◆ ~scalar_t()

template<typename numeric_t , unsigned int MHA_AC_TYPECODE>
MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE >::~scalar_t ( )
inline

Destroy the AC variable: deallocate its memory.

If the constructor parameter insert_now was true, then the destruc- tor removes the AC variable from AC space when it executes.

Member Function Documentation

◆ insert()

template<typename numeric_t , unsigned int MHA_AC_TYPECODE>
void MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE >::insert ( )
inline

Insert or re-insert AC variable into AC space.

Plugins should call this method from their prepare() and process() functions.

◆ remove()

template<typename numeric_t , unsigned int MHA_AC_TYPECODE>
void MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE >::remove ( )
inline

Remove the AC variable by reference from the AC variable space.

Plugins may call this method only from their prepare(), release() methods or their plugin destructor. It is not necessary to remove the AC variable from AC space at all if either another AC variable with the same name has replaced this variable before this variable is destroyed, or if no plugin will access this variable between its destruction and either its replacement or the MHA exit.

Member Data Documentation

◆ data

template<typename numeric_t , unsigned int MHA_AC_TYPECODE>
numeric_t MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE >::data

Numeric value of this AC variable.

◆ ac

template<typename numeric_t , unsigned int MHA_AC_TYPECODE>
algo_comm_t& MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE >::ac
private

AC variable space.

◆ name

template<typename numeric_t , unsigned int MHA_AC_TYPECODE>
const std::string MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE >::name
private

Name of this AC variable in the AC variable space.

◆ remove_during_destructor

template<typename numeric_t , unsigned int MHA_AC_TYPECODE>
const bool MHA_AC::scalar_t< numeric_t, MHA_AC_TYPECODE >::remove_during_destructor
private

flag whether to remove from AC variable space in destructor.


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