GlsMenu
GlsMenuDiscrete_T< T > Class Template Reference

#include <gls_menu_data.h>

Inheritance diagram for GlsMenuDiscrete_T< T >:
GlsMenuData_T< T > GlsMenuData

Public Member Functions

 GlsMenuDiscrete_T (const std::string &name, T *data)
 
 GlsMenuDiscrete_T (const std::string &name, const T &value)
 
virtual ~GlsMenuDiscrete_T ()
 
virtual void Inc (long amount=1)
 
virtual void Attach (T *&data)
 
virtual bool ReferTo (T &data)
 
virtual bool ValueChanged ()
 
virtual void ResetValueChanged ()
 
virtual std::ostream & WriteValue (std::ostream &outstr)
 
template<>
std::ostream & WriteValue (std::ostream &outstr)
 
template<>
std::ostream & WriteValue (std::ostream &outstr)
 
virtual std::istream & ReadValue (std::istream &instr)
 
void SetPrecision (int outputPrecision)
 
virtual const T & Value () const
 
virtual T & Value ()
 
virtual void Value (const T &val)
 

Protected Attributes

T * _data
 Storage for the meta-data. More...
 
_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...
 

Detailed Description

template<class T>
class GlsMenuDiscrete_T< T >

The GlsMenuDiscrete_T class adds to the GlsMenuData_T class an implementation of the Inc (increment) method that suffices for most discrete types that do not require rollover.

Definition at line 257 of file gls_menu_data.h.

Constructor & Destructor Documentation

template<class T>
GlsMenuDiscrete_T< T >::GlsMenuDiscrete_T ( const std::string &  name,
T *  data 
)

Class constructor. Keeps a pointer to the specified type in sync with the simulation meta-data. This will set localStorage to false.

template<class T>
GlsMenuDiscrete_T< T >::GlsMenuDiscrete_T ( const std::string &  name,
const T &  value 
)

Class constructor. Actually creates storage for the simulation meta-data and initializes the value. This will set localStorage to true.

template<class T>
virtual GlsMenuDiscrete_T< T >::~GlsMenuDiscrete_T ( )
virtual

Class destructor.

Member Function Documentation

template<class T>
virtual void GlsMenuData_T< T >::Attach ( T *&  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.

Referenced by GlsMenuDictionary::Attach().

template<class T>
virtual void GlsMenuDiscrete_T< T >::Inc ( long  amount = 1)
virtual

Increment the data item value.

Reimplemented from GlsMenuData.

template<class T>
virtual std::istream& GlsMenuData_T< T >::ReadValue ( std::istream &  instr)
virtualinherited

Reads the value from the input stream. The ReadValue call shall consume only what it needs. It is the responsibility of the calling function to read to the end of line, or to clean up from a bad read. The calling function will also ensure that the data starts as the next byte in the stream.

Reimplemented in GlsMenuLine, and GlsMenuActionGroup.

Referenced by GlsMenuDataFactory::Data< T >::Create(), and GlsMenuDataFactory::Data< T >::CreateDiscrete().

template<class T>
virtual bool GlsMenuData_T< T >::ReferTo ( T &  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.

Referenced by GlsMenuDictionary::Refer(), and GlsMenuDictionary::ReferCopy().

template<class T>
virtual void GlsMenuData_T< T >::ResetValueChanged ( )
virtualinherited

Sets the previous value to the current value.

template<class T>
void GlsMenuData_T< T >::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.

template<class T>
virtual const T& GlsMenuData_T< T >::Value ( ) const
virtualinherited

Returns the value of the simulation meta-data.

Referenced by GlsMenuDictionary::ReferCopy().

template<class T>
virtual T& GlsMenuData_T< T >::Value ( )
virtualinherited

Returns a reference value of the simulation meta-data.

template<class T>
virtual void GlsMenuData_T< T >::Value ( const T &  val)
virtualinherited

Sets the value of the simulation meta-data.

template<class T>
virtual bool GlsMenuData_T< T >::ValueChanged ( )
virtualinherited

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

template<class T>
virtual std::ostream& GlsMenuData_T< T >::WriteValue ( std::ostream &  outstr)
virtualinherited

Writes the value to the output stream.

Reimplemented in GlsMenuActionGroup.

template<>
std::ostream & GlsMenuData_T< float >::WriteValue ( std::ostream &  outstr)
inlineinherited

Definition at line 235 of file gls_menu_data.h.

template<>
std::ostream & GlsMenuData_T< double >::WriteValue ( std::ostream &  outstr)
inlineinherited

Definition at line 242 of file gls_menu_data.h.

Field Documentation

template<class T>
T* GlsMenuData_T< T >::_data
protectedinherited

Storage for the meta-data.

Definition at line 220 of file gls_menu_data.h.

template<class T>
int GlsMenuData_T< T >::_precision
protectedinherited

Allows for setting of precision for floating point numbers.

Definition at line 229 of file gls_menu_data.h.

template<class T>
T GlsMenuData_T< T >::_prevValue
protectedinherited

The previous meta-data value.

Definition at line 223 of file gls_menu_data.h.

template<class T>
bool GlsMenuData_T< T >::_prevValueValid
protectedinherited

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: