GlsMenu
GlsMenuTimer Class Reference

#include <gls_menu_action.h>

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

Public Types

enum  { MICROSECS_PER_SEC = 1000000 }
 
typedef unsigned long Microsecs_t
 
typedef GlsFunctor1_T< std::istream & > ActionHandler_t
 
typedef std::map< std::string, ActionHandler_t * > HandlerCont_t
 

Public Member Functions

 GlsMenuTimer (const std::string &name, GlsMenuDictionary &dataDict, GlsMenuAction::HandlerCont_t &actionHandlers)
 
virtual ~GlsMenuTimer ()
 
void Reset ()
 
void Reset (double durationInSecs)
 
void Start ()
 
void Stop ()
 
bool IsExpired () const
 
double Duration () const
 
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

disti::Timer _stopWatch
 A stop watch used to count elapsed time. More...
 
bool _active
 Whether or not the timer is actively running and incrementing its elapsed time. More...
 
Microsecs_t _elapsedMicroseconds
 Stored elapsed time whenever the timer is stopped. This is incremented by the stop watches time whenever the timer is paused. More...
 
Microsecs_t _duration
 Time duration after which the timer will be expired. More...
 
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
 

Detailed Description

The GlsMenuTimer class supports the execution of a set of actions after the expiration of a timer.

Definition at line 257 of file gls_menu_action.h.

Member Typedef Documentation

typedef GlsFunctor1_T<std::istream&> GlsMenuAction::ActionHandler_t
inherited

Definition at line 76 of file gls_menu_action.h.

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

Definition at line 78 of file gls_menu_action.h.

typedef unsigned long GlsMenuTimer::Microsecs_t

Definition at line 261 of file gls_menu_action.h.

Member Enumeration Documentation

anonymous enum
Enumerator
MICROSECS_PER_SEC 

Definition at line 263 of file gls_menu_action.h.

Constructor & Destructor Documentation

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

Class constructor.

Parameters
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 GlsMenuTimer::~GlsMenuTimer ( )
virtual

Class destructor.

Member Function Documentation

virtual void GlsMenuData_T< std::string >::Attach ( std::string *&  data)
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.

bool GlsMenuAction::CanExecute ( std::string &  statement) const
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)
inherited

Set the logical expression used to determine if the actions should be executed when Execute is invoked.

double GlsMenuTimer::Duration ( ) const

Returns the currently set duration of the timer in seconds.

virtual void GlsMenuActionGroup::Execute ( ) const
virtualinherited

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

Parameters
dictdata dictionary to use for evaluating action parameters.

Reimplemented from GlsMenuAction.

virtual void GlsMenuData::Inc ( long  amount = 1)
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().

bool GlsMenuTimer::IsExpired ( ) const

Specified whether or not the timer has expired.

virtual bool GlsMenuLine::OkToWrite ( )
virtualinherited

Returns false if the string is empty.

virtual std::istream& GlsMenuActionGroup::ReadValue ( std::istream &  instr)
virtualinherited

Read attribute dictionary from an input stream.

Parameters
instrinput stream to read value from.

Reimplemented from GlsMenuLine.

virtual bool GlsMenuData_T< std::string >::ReferTo ( std::string &  data)
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.

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

Register a handler for a specific action.

Parameters
nameaction name
handlerhandler for the action
void GlsMenuTimer::Reset ( )

Stop the timer if it is running and reset it. This will not start the timer running.

void GlsMenuTimer::Reset ( double  durationInSecs)

Stop the timer if it is running and reset it. This will not start the timer running.

Parameters
durationInSecstimer duration in seconds.
virtual void GlsMenuData_T< std::string >::ResetValueChanged ( )
virtualinherited

Sets the previous value to the current value.

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

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

void GlsMenuTimer::Start ( )

Start the timer running. This does not reset the timer, it will start where ever it was last paused.

void GlsMenuTimer::Stop ( )

Pauses the timer. Call Start to start the timer again from the time it was paused.

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

Returns the value of the simulation meta-data.

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

Returns a reference value of the simulation meta-data.

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

Sets the value of the simulation meta-data.

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

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

virtual std::ostream& GlsMenuActionGroup::WriteValue ( std::ostream &  outstr)
virtualinherited

Read attribute dictionary from an input stream.

Parameters
instrinput stream to read value from.

Reimplemented from GlsMenuData_T< std::string >.

Field Documentation

std::list<GlsMenuAction*> GlsMenuActionGroup::_actions
protectedinherited

List of actions to execute if condition is true.

Definition at line 241 of file gls_menu_action.h.

bool GlsMenuTimer::_active
protected

Whether or not the timer is actively running and incrementing its elapsed time.

Definition at line 345 of file gls_menu_action.h.

GlsBoolExpression GlsMenuActionGroup::_condition
protectedinherited

Condition to check for true before executing all actions.

Definition at line 244 of file gls_menu_action.h.

bool GlsMenuActionGroup::_conditionIsSet
protectedinherited

This is set to true when the condition is set using the Condition method.

Definition at line 247 of file gls_menu_action.h.

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

Storage for the meta-data.

Definition at line 220 of file gls_menu_data.h.

GlsMenuDictionary& GlsMenuAction::_dataDict
protectedinherited

Definition at line 124 of file gls_menu_action.h.

Microsecs_t GlsMenuTimer::_duration
protected

Time duration after which the timer will be expired.

Definition at line 352 of file gls_menu_action.h.

Microsecs_t GlsMenuTimer::_elapsedMicroseconds
protected

Stored elapsed time whenever the timer is stopped. This is incremented by the stop watches time whenever the timer is paused.

Definition at line 349 of file gls_menu_action.h.

HandlerCont_t GlsMenuAction::_globalHandlers
staticprotectedinherited

Definition at line 140 of file gls_menu_action.h.

HandlerCont_t& GlsMenuAction::_localHandlers
protectedinherited

Definition at line 137 of file gls_menu_action.h.

int GlsMenuData_T< std::string >::_precision
protectedinherited

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
protectedinherited

The previous meta-data value.

Definition at line 223 of file gls_menu_data.h.

bool GlsMenuData_T< std::string >::_prevValueValid
protectedinherited

Whether or not the previous value should be considered.

Definition at line 226 of file gls_menu_data.h.

disti::Timer GlsMenuTimer::_stopWatch
protected

A stop watch used to count elapsed time.

Definition at line 341 of file gls_menu_action.h.


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