GlsMenu
1.5.4
|
#include <gls_menu_action.h>
Public Types | |
typedef GlsFunctor1_T< std::istream & > | ActionHandler_t |
typedef std::map< std::string, ActionHandler_t * > | HandlerCont_t |
Public Member Functions | |
GlsMenuActionGroup (const std::string &name, GlsMenuDictionary &dataDict, GlsMenuAction::HandlerCont_t &actionHandlers) | |
virtual | ~GlsMenuActionGroup () |
void | Condition (const std::string &expression) |
virtual void | Execute () const |
virtual std::istream & | ReadValue (std::istream &instr) |
virtual std::ostream & | WriteValue (std::ostream &outstr) |
virtual bool | OkToWrite () |
virtual void | Attach (std::string *&data) |
virtual bool | ReferTo (std::string &data) |
virtual bool | ValueChanged () |
virtual void | ResetValueChanged () |
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::list< GlsMenuAction * > | _actions |
List of actions to execute if condition is true. More... | |
GlsBoolExpression | _condition |
Condition to check for true before executing all actions. More... | |
bool | _conditionIsSet |
This is set to true when the condition is set using the Condition method. More... | |
GlsMenuDictionary & | _dataDict |
HandlerCont_t & | _localHandlers |
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 |
This class provides a meta-data group of actions that are all executed based upon evaluation of a condition (if the condition has been set). If the condition evaluates to true or a condition was never set up, all actions in the list will be executed. A Condition can contain nested conditions nested to any level.
Eg. for menu scripting, Actions is a GlsMenuActionGroup without the condition set (so the name is used). There are 2 nested GlsMenuActionGroups that both have conditions.:
Actions: { // List all actions to be executed
if ( == VALUE1 && ) { // List all actions to be executed
if ( == VALUE3 || > ) { // List all actions to be executed }
// List any more actions to be executed
}
// List any more actions to be executed }
Definition at line 177 of file gls_menu_action.h.
|
inherited |
Definition at line 76 of file gls_menu_action.h.
|
inherited |
Definition at line 78 of file gls_menu_action.h.
GlsMenuActionGroup::GlsMenuActionGroup | ( | const std::string & | name, |
GlsMenuDictionary & | dataDict, | ||
GlsMenuAction::HandlerCont_t & | actionHandlers | ||
) |
Class constructor.
name | the name of the group of data items. |
dataDict | the menu data dictionary used to evaluate menu data variables |
actionHandlers | These are handlers for menu actions passed in by the creator. These are considered local to the menu set. |
|
virtual |
Class destructor.
|
virtualinherited |
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.
|
protectedinherited |
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.
void GlsMenuActionGroup::Condition | ( | const std::string & | expression | ) |
Set the logical expression used to determine if the actions should be executed when Execute is invoked.
|
virtual |
Invoke all actions associated with the instance. Derived classes can override this method to add new action types.
dict | data dictionary to use for evaluating action parameters. |
Reimplemented from GlsMenuAction.
|
virtualinherited |
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().
|
virtualinherited |
Returns false if the string is empty.
|
virtual |
Read attribute dictionary from an input stream.
instr | input stream to read value from. |
Reimplemented from GlsMenuLine.
|
virtualinherited |
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.
|
staticinherited |
Register a handler for a specific action.
name | action name |
handler | handler for the action |
|
virtualinherited |
Sets the previous value to the current value.
|
inherited |
Allows for setting of precision for floating point numbers. This is the number of digits to be shown after the decimal point.
|
virtualinherited |
Returns the value of the simulation meta-data.
|
virtualinherited |
Returns a reference value of the simulation meta-data.
|
virtualinherited |
Sets the value of the simulation meta-data.
|
virtualinherited |
Determines if the value has changed since the last call to this method.
|
virtual |
Read attribute dictionary from an input stream.
instr | input stream to read value from. |
Reimplemented from GlsMenuData_T< std::string >.
|
protected |
List of actions to execute if condition is true.
Definition at line 241 of file gls_menu_action.h.
|
protected |
Condition to check for true before executing all actions.
Definition at line 244 of file gls_menu_action.h.
|
protected |
This is set to true when the condition is set using the Condition method.
Definition at line 247 of file gls_menu_action.h.
|
protectedinherited |
Storage for the meta-data.
Definition at line 220 of file gls_menu_data.h.
|
protectedinherited |
Definition at line 124 of file gls_menu_action.h.
|
staticprotectedinherited |
Definition at line 140 of file gls_menu_action.h.
|
protectedinherited |
Definition at line 137 of file gls_menu_action.h.
|
protectedinherited |
Allows for setting of precision for floating point numbers.
Definition at line 229 of file gls_menu_data.h.
|
protectedinherited |
The previous meta-data value.
Definition at line 223 of file gls_menu_data.h.
|
protectedinherited |
Whether or not the previous value should be considered.
Definition at line 226 of file gls_menu_data.h.