GlsMenuAction Class Reference

#include <gls_menu_action.h>

Inheritance diagram for GlsMenuAction:
GlsMenuLine GlsMenuData_T< std::string > GlsMenuData GlsMenuActionGroup GlsMenuTimer

Public Types

typedef GlsFunctor1_T< std::istream & > ActionHandler_t
typedef std::map< std::string, ActionHandler_t * > HandlerCont_t

Public Member Functions

 GlsMenuAction (const std::string &name, GlsMenuDictionary &dataDict, HandlerCont_t &actionHandlers)
virtual ~GlsMenuAction ()
virtual void Execute () const
virtual bool OkToWrite ()
virtual std::istream & ReadValue (std::istream &instr)
virtual void Attach (std::string *&data)
virtual bool ReferTo (std::string &data)
virtual bool ValueChanged ()
virtual void ResetValueChanged ()
virtual std::ostream & WriteValue (std::ostream &outstr)
void SetPrecision (int outputPrecision)
virtual const std::string & Value () const
virtual std::string & Value ()
virtual void Value (const std::string &val)
virtual void Inc (long amount=1)

Static Public Member Functions

static void Register (const std::string &name, ActionHandler_t *handler)

Protected Member Functions

bool CanExecute (std::string &statement) const

Protected Attributes

std::string * _data
 Storage for the meta-data. More...
std::string _prevValue
 The previous meta-data value. More...
bool _prevValueValid
 Whether or not the previous value should be considered. More...
int _precision
 Allows for setting of precision for floating point numbers. More...

Static Protected Attributes

static HandlerCont_t _globalHandlers

Detailed Description

The GlsMenuAction class provides a meta-data action (callback) containing an identifier of the action to perform as a meta-data item name and whose value is the parameters to pass to the action.

The static portions of the class provide the mechanism for registering handlers for specific actions.

If an action has no handler, it is a no-op.

Definition at line 71 of file gls_menu_action.h.

Member Typedef Documentation

Definition at line 76 of file gls_menu_action.h.

typedef std::map<std::string, ActionHandler_t*> GlsMenuAction::HandlerCont_t

Definition at line 78 of file gls_menu_action.h.

Constructor & Destructor Documentation

GlsMenuAction::GlsMenuAction ( const std::string &  name,
GlsMenuDictionary dataDict,
HandlerCont_t actionHandlers 

Class constructor.

namethe name of the group of data items.
dataDictthe menu data dictionary used to evaluate menu data variables
actionHandlersThese are handlers for menu actions passed in by the creator. These are considered local to the menu set.
virtual GlsMenuAction::~GlsMenuAction ( )

Class destructor.

Member Function Documentation

virtual void GlsMenuData_T< std::string >::Attach ( std::string *&  data)

Attaches an external pointer to the data so that dereferencing the pointer will allow access to the data item's value without performing dictionary lookups and data value retrievals.

bool GlsMenuAction::CanExecute ( std::string &  statement) const

Determine if there is a condition in front of the action to perform and if so, evaluate the condition and return the result. If there is no condition, true is returned.

virtual void GlsMenuAction::Execute ( ) const

Invoke all actions associated with the instance. Derived classes can override this method to add new action types.

dictdata dictionary to use for evaluating action parameters.

Reimplemented in GlsMenuActionGroup.

virtual void GlsMenuData::Inc ( long  amount = 1)

Increment the data item. Derived classes must override this as the default is a no-op.

Reimplemented in GlsMenuDiscrete_T< T >.

Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::IncData().

virtual bool GlsMenuLine::OkToWrite ( )

Returns false if the string is empty.

virtual std::istream& GlsMenuLine::ReadValue ( std::istream &  instr)

Read the stream until an end of line is encountered.

Reimplemented from GlsMenuData_T< std::string >.

Reimplemented in GlsMenuActionGroup.

virtual bool GlsMenuData_T< std::string >::ReferTo ( std::string &  data)

Changes the data item to refer to and use the external variable rather than its own memory. Allows access to the data item's value without performing dictionary lookups and data value retrievals.

static void GlsMenuAction::Register ( const std::string &  name,
ActionHandler_t handler 

Register a handler for a specific action.

nameaction name
handlerhandler for the action
virtual void GlsMenuData_T< std::string >::ResetValueChanged ( )

Sets the previous value to the current value.

void GlsMenuData_T< std::string >::SetPrecision ( int  outputPrecision)

Allows for setting of precision for floating point numbers. This is the number of digits to be shown after the decimal point.

virtual const std::string & GlsMenuData_T< std::string >::Value ( ) const

Returns the value of the simulation meta-data.

virtual std::string & GlsMenuData_T< std::string >::Value ( )

Returns a reference value of the simulation meta-data.

virtual void GlsMenuData_T< std::string >::Value ( const std::string &  val)

Sets the value of the simulation meta-data.

virtual bool GlsMenuData_T< std::string >::ValueChanged ( )

Determines if the value has changed since the last call to this method.

virtual std::ostream& GlsMenuData_T< std::string >::WriteValue ( std::ostream &  outstr)

Writes the value to the output stream.

Reimplemented in GlsMenuActionGroup.

Field Documentation

std::string * GlsMenuData_T< std::string >::_data

Storage for the meta-data.

Definition at line 220 of file gls_menu_data.h.

GlsMenuDictionary& GlsMenuAction::_dataDict

Definition at line 124 of file gls_menu_action.h.

HandlerCont_t GlsMenuAction::_globalHandlers

Definition at line 140 of file gls_menu_action.h.

HandlerCont_t& GlsMenuAction::_localHandlers

Definition at line 137 of file gls_menu_action.h.

int GlsMenuData_T< std::string >::_precision

Allows for setting of precision for floating point numbers.

Definition at line 229 of file gls_menu_data.h.

std::string GlsMenuData_T< std::string >::_prevValue

The previous meta-data value.

Definition at line 223 of file gls_menu_data.h.

bool GlsMenuData_T< std::string >::_prevValueValid

Whether or not the previous value should be considered.

Definition at line 226 of file gls_menu_data.h.

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