The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
MHAParser::base_t Class Reference

Base class for all parser items. More...

Inheritance diagram for MHAParser::base_t:
Inheritance graph

Classes

class  replace_t
 

Public Member Functions

 base_t (const std::string &)
 Constructor for base class of all parser nodes. More...
 
 base_t (const base_t &)
 Copy constructor for base_t. More...
 
base_toperator= (const base_t &)=default
 
 base_t (base_t &&)=delete
 
base_toperator= (base_t &&)=delete
 
virtual ~base_t ()
 
virtual std::string parse (const std::string &)
 Causes this node to process a command in the openMHA configuration language. More...
 
virtual void parse (const char *, char *, unsigned int)
 This function parses a command and writes the parsing result into a C character array. More...
 
virtual void parse (const std::vector< std::string > &, std::vector< std::string > &)
 
virtual std::string op_subparse (expression_t &)
 
virtual std::string op_setval (expression_t &)
 
virtual std::string op_query (expression_t &)
 
virtual std::string query_dump (const std::string &)
 
virtual std::string query_entries (const std::string &)
 
virtual std::string query_perm (const std::string &)
 
virtual std::string query_range (const std::string &)
 
virtual std::string query_type (const std::string &)
 
virtual std::string query_val (const std::string &)
 
virtual std::string query_readfile (const std::string &)
 
virtual std::string query_savefile (const std::string &)
 
virtual std::string query_savefile_compact (const std::string &)
 
virtual std::string query_savemons (const std::string &)
 
virtual std::string query_listids (const std::string &)
 
std::string query_version (const std::string &)
 
std::string query_id (const std::string &)
 
std::string query_subst (const std::string &)
 
std::string query_addsubst (const std::string &)
 
std::string query_help (const std::string &)
 
std::string query_cmds (const std::string &)
 
void set_node_id (const std::string &)
 Set the identification string of this parser node. More...
 
void set_help (const std::string &)
 Set the help comment of a variable or parser. More...
 
void add_parent_on_insert (parser_t *, std::string)
 
void rm_parent_on_remove (parser_t *)
 
const std::string & fullname () const
 Return the full dot-separated path name of this parser node in the openMHA configuration tree. More...
 

Public Attributes

MHAEvents::emitter_t writeaccess
 Event emitted on write access. More...
 
MHAEvents::emitter_t valuechanged
 Event emitted if the value has changed. More...
 
MHAEvents::emitter_t readaccess
 Event emitted on read access. More...
 
MHAEvents::emitter_t prereadaccess
 Event emitted on read access, before the data field is accessed. More...
 

Protected Member Functions

void activate_query (const std::string &, query_t)
 
void notify ()
 

Protected Attributes

query_map_t queries
 
bool data_is_initialized
 

Private Types

typedef std::vector< replace_trepl_list_t
 

Private Member Functions

void add_replace_pair (const std::string &, const std::string &)
 
std::string oplist ()
 

Private Attributes

std::string help
 
std::string id_str
 
opact_map_t operators
 
repl_list_t repl_list
 
bool nested_lock
 
parser_tparent
 
std::string thefullname
 

Detailed Description

Base class for all parser items.

The key method of the parser base class is the std::string parse(const std::string&) method. Parser proxy derivatives which overwrite any of the other parse() methods to be the key method must make sure that the original parse() method utilizes the new key method.

Member Typedef Documentation

◆ repl_list_t

typedef std::vector<replace_t> MHAParser::base_t::repl_list_t
private

Constructor & Destructor Documentation

◆ base_t() [1/3]

MHAParser::base_t::base_t ( const std::string &  h)

Constructor for base class of all parser nodes.

Parameters
hHelp text describing this parser node. This help text is accessible to the configuration language through the "?help" query command.

◆ base_t() [2/3]

MHAParser::base_t::base_t ( const base_t src)

Copy constructor for base_t.

Copies help text and id string, but does not insert the new node into the parser tree structure.

Parameters
srcSource parser
Deprecated:
Copying parser nodes makes little sense, avoid wherever possible

◆ base_t() [3/3]

MHAParser::base_t::base_t ( base_t &&  )
delete

◆ ~base_t()

MHAParser::base_t::~base_t ( )
virtual

Member Function Documentation

◆ operator=() [1/2]

base_t& MHAParser::base_t::operator= ( const base_t )
default

◆ operator=() [2/2]

base_t& MHAParser::base_t::operator= ( base_t &&  )
delete

◆ parse() [1/3]

std::string MHAParser::base_t::parse ( const std::string &  cs)
virtual

Causes this node to process a command in the openMHA configuration language.

Parameters
csThe command to parse
Returns
The response to the command, if successful
Exceptions
MHA_ErrorIf the command cannot be executed successfully. The reason for failure is given in the message string of the exception.

Reimplemented in plug_wrapperI, PluginLoader::mhapluginloader_t, plug_wrapper, io_wrapper, and altplugs_t.

◆ parse() [2/3]

void MHAParser::base_t::parse ( const char *  cmd,
char *  retv,
unsigned int  len 
)
virtual

This function parses a command and writes the parsing result into a C character array.

This base class implementation delegates to parse(const std::string &).

Parameters
cmdCommand to be parsed
retvBuffer for the result
lenLength of buffer

Reimplemented in altplugs_t.

◆ parse() [3/3]

void MHAParser::base_t::parse ( const std::vector< std::string > &  cs,
std::vector< std::string > &  retv 
)
virtual

◆ op_subparse()

std::string MHAParser::base_t::op_subparse ( expression_t )
virtual

◆ op_setval()

◆ op_query()

std::string MHAParser::base_t::op_query ( expression_t )
virtual

◆ query_dump()

std::string MHAParser::base_t::query_dump ( const std::string &  )
virtual

Reimplemented in MHAParser::monitor_t, and MHAParser::parser_t.

◆ query_entries()

std::string MHAParser::base_t::query_entries ( const std::string &  )
virtual

Reimplemented in MHAParser::parser_t.

◆ query_perm()

std::string MHAParser::base_t::query_perm ( const std::string &  )
virtual

◆ query_range()

std::string MHAParser::base_t::query_range ( const std::string &  )
virtual

Reimplemented in MHAParser::kw_t, and MHAParser::range_var_t.

◆ query_type()

◆ query_val()

◆ query_readfile()

std::string MHAParser::base_t::query_readfile ( const std::string &  )
virtual

Reimplemented in MHAParser::parser_t.

◆ query_savefile()

std::string MHAParser::base_t::query_savefile ( const std::string &  )
virtual

Reimplemented in MHAParser::parser_t.

◆ query_savefile_compact()

std::string MHAParser::base_t::query_savefile_compact ( const std::string &  )
virtual

Reimplemented in MHAParser::parser_t.

◆ query_savemons()

std::string MHAParser::base_t::query_savemons ( const std::string &  )
virtual

Reimplemented in MHAParser::parser_t.

◆ query_listids()

std::string MHAParser::base_t::query_listids ( const std::string &  )
virtual

Reimplemented in MHAParser::parser_t.

◆ query_version()

std::string MHAParser::base_t::query_version ( const std::string &  )

◆ query_id()

std::string MHAParser::base_t::query_id ( const std::string &  )

◆ query_subst()

std::string MHAParser::base_t::query_subst ( const std::string &  )

◆ query_addsubst()

std::string MHAParser::base_t::query_addsubst ( const std::string &  s)

◆ query_help()

std::string MHAParser::base_t::query_help ( const std::string &  )

◆ query_cmds()

std::string MHAParser::base_t::query_cmds ( const std::string &  )

◆ set_node_id()

void MHAParser::base_t::set_node_id ( const std::string &  s)

Set the identification string of this parser node.

The id can be queried from the configuration language using the ?id query command. Nodes can be found by id using the ?listid query command on a containing parser node.

Parameters
sThe new identification string.

◆ set_help()

void MHAParser::base_t::set_help ( const std::string &  s)

Set the help comment of a variable or parser.

Parameters
sNew help comment.

◆ add_parent_on_insert()

void MHAParser::base_t::add_parent_on_insert ( parser_t p,
std::string  n 
)

◆ rm_parent_on_remove()

void MHAParser::base_t::rm_parent_on_remove ( parser_t )

◆ fullname()

const std::string & MHAParser::base_t::fullname ( ) const

Return the full dot-separated path name of this parser node in the openMHA configuration tree.

◆ activate_query()

void MHAParser::base_t::activate_query ( const std::string &  n,
query_t  a 
)
protected

◆ notify()

void MHAParser::base_t::notify ( )
protected

◆ add_replace_pair()

void MHAParser::base_t::add_replace_pair ( const std::string &  a,
const std::string &  b 
)
private

◆ oplist()

std::string MHAParser::base_t::oplist ( )
private

Member Data Documentation

◆ writeaccess

MHAEvents::emitter_t MHAParser::base_t::writeaccess

Event emitted on write access.

To connect a callback that is invoked on write access to this parser variable, use MHAEvents::patchbay_t<receiver_t> method connect(&writeaccess,&receiver_t::callback) where callback is a method that expects no parameters and returns void.

◆ valuechanged

MHAEvents::emitter_t MHAParser::base_t::valuechanged

Event emitted if the value has changed.

To connect a callback that is invoked when write access to this parser variable actually changes its value, use MHAEvents::patchbay_t<receiver_t> method connect(&valuechanged,&receiver_t::callback) where callback is a method that expects no parameters and returns void.

◆ readaccess

MHAEvents::emitter_t MHAParser::base_t::readaccess

Event emitted on read access.

To connect a callback that is invoked after the value of this variable has been read through the configuration interface, use MHAEvents::patchbay_t<receiver_t> method connect(&readaccess,&receiver_t::callback) where callback is a method that expects no parameters and returns void.

◆ prereadaccess

MHAEvents::emitter_t MHAParser::base_t::prereadaccess

Event emitted on read access, before the data field is accessed.

To connect a callback that is invoked when the value of this variable is about to be read through the configuration interface, so that the callback can influence the value that is reported, use MHAEvents::patchbay_t<receiver_t> method connect(&prereadaccess,&receiver_t::callback) where callback is a method that expects no parameters and returns void.

◆ queries

query_map_t MHAParser::base_t::queries
protected

◆ data_is_initialized

bool MHAParser::base_t::data_is_initialized
protected

◆ help

std::string MHAParser::base_t::help
private

◆ id_str

std::string MHAParser::base_t::id_str
private

◆ operators

opact_map_t MHAParser::base_t::operators
private

◆ repl_list

repl_list_t MHAParser::base_t::repl_list
private

◆ nested_lock

bool MHAParser::base_t::nested_lock
private

◆ parent

parser_t* MHAParser::base_t::parent
private

◆ thefullname

std::string MHAParser::base_t::thefullname
private

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