GlsMenu
GlsMenuDictionary Class Reference

#include <gls_menu_dictionary.h>

Inheritance diagram for GlsMenuDictionary:

Public Member Functions

std::string Expand (const std::string &str, const char *startDelim="$(", const char *endDelim=")")
 
template<class T >
void Attach (const std::string &name, T *&t)
 
template<class T >
bool Refer (const std::string &name, T &t)
 
template<class T >
bool ReferCopy (const std::string &name, T &t)
 

Detailed Description

The GlsMenuDictionary provides a container for simulation meta-data used within a menuing system (a menu data dictionary). Using the dictionary provides the link between the menu scripts and the program's run-time code. The program can retrieve data items from the dictionary and alter their values programmatically to affect the states of menus. Conversely, the menu scripts can also alter data items within the dictionary that affect the states of menus and the states of displays in the program.

Definition at line 65 of file gls_menu_dictionary.h.

Member Function Documentation

template<class T >
void GlsMenuDictionary::Attach ( const std::string &  name,
T *&  t 
)
inline

Attach a pointer to the dictionary data item. This allows the developer to dereference a "local" pointer to update or read the value of the item without having to perform a dictionary lookup and type cast for every access. t will be 0 upon a failure to attach.

Definition at line 97 of file gls_menu_dictionary.h.

References GlsMenuData_T< T >::Attach().

std::string GlsMenuDictionary::Expand ( const std::string &  str,
const char *  startDelim = "$(",
const char *  endDelim = ")" 
)

Expands any "environment variables" found within the string str parameter. An environment variable is the name of a dictionary data item that should exist within the dictionary. The name should be delimited by startDelim and endDelim.

Eg. would represent a dictionary data item named "VarName" and whose value will be returned if found in the dictionary. If the value of 'VarName' is '1234', then: Expand("$(VarName)") will return the string 1234

Referenced by GlsMFDSubmenu_T< MenuItemId_t >::Label().

template<class T >
bool GlsMenuDictionary::Refer ( const std::string &  name,
T &  t 
)
inline

Changes the dictionary so that an existing dictionary data item will refer to the "local" variable whose reference is passed as a parameter. This allows the developer to reference a "local" variable to update or read the value of the item without having to perform a dictionary lookup and type cast for every access. Changes to the variable will automatically be reflected in the dictionary.

The parameter t will maintain its current value.

Definition at line 118 of file gls_menu_dictionary.h.

References GlsMenuData_T< T >::ReferTo().

template<class T >
bool GlsMenuDictionary::ReferCopy ( const std::string &  name,
T &  t 
)
inline

Changes the dictionary so that an existing dictionary data item will refer to the "local" variable whose reference is passed as a parameter. This allows the developer to reference a "local" variable to update or read the value of the item without having to perform a dictionary lookup and type cast for every access. Changes to the variable will automatically be reflected in the dictionary.

The parameter t will be assigned the current value of the dictionary data item before the dictionary begins to refer to t.

Definition at line 142 of file gls_menu_dictionary.h.

References GlsMenuData_T< T >::ReferTo(), and GlsMenuData_T< T >::Value().


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