GlsMenu  1.5.4
GlsMenuDataContainer_T< T > Class Template Reference

#include <gls_menu_data.h>

Inheritance diagram for GlsMenuDataContainer_T< T >:
GlsMenuData

Public Member Functions

 GlsMenuDataContainer_T (const std::string &name, T *data)
 
 GlsMenuDataContainer_T (const std::string &name, const T &value)
 
 GlsMenuDataContainer_T (const std::string &name)
 
virtual ~GlsMenuDataContainer_T ()
 
virtual void Attach (T *&data)
 
virtual bool ReferTo (T &data)
 
virtual bool ValueChanged ()
 
virtual void ResetValueChanged ()
 
virtual 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)
 
virtual void Inc (long amount=1)
 

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 GlsMenuDataContainer_T< T >

The GlsMenuDataContainer_T provides a fully functional templatized container type to hold menu meta-data. type. The type T MUST have the <<, >>, =, and == operators defined. This will work for most one-line data types.

Definition at line 351 of file gls_menu_data.h.

Constructor & Destructor Documentation

template<class T >
GlsMenuDataContainer_T< T >::GlsMenuDataContainer_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 >
GlsMenuDataContainer_T< T >::GlsMenuDataContainer_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 >
GlsMenuDataContainer_T< T >::GlsMenuDataContainer_T ( const std::string &  name)

Class constructor. Actually creates storage for the simulation meta-data but will not initialize the value. This will set localStorage to true.

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

Class destructor.

Member Function Documentation

template<class T >
virtual void GlsMenuDataContainer_T< T >::Attach ( T *&  data)
virtual

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.

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().

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

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.

template<class T >
virtual bool GlsMenuDataContainer_T< T >::ReferTo ( T &  data)
virtual

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.

template<class T >
virtual void GlsMenuDataContainer_T< T >::ResetValueChanged ( )
virtual

Sets the previous value to the current value.

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

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

Returns the value of the simulation meta-data.

template<class T >
virtual T& GlsMenuDataContainer_T< T >::Value ( )
virtual

Returns a reference value of the simulation meta-data.

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

Sets the value of the simulation meta-data.

template<class T >
virtual bool GlsMenuDataContainer_T< T >::ValueChanged ( )
virtual

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

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

Writes the value to the output stream.

Field Documentation

template<class T >
T* GlsMenuDataContainer_T< T >::_data
protected

Storage for the meta-data.

Definition at line 467 of file gls_menu_data.h.

template<class T >
int GlsMenuDataContainer_T< T >::_precision
protected

Allows for setting of precision for floating point numbers.

Definition at line 476 of file gls_menu_data.h.

template<class T >
T GlsMenuDataContainer_T< T >::_prevValue
protected

The previous meta-data value.

Definition at line 470 of file gls_menu_data.h.

template<class T >
bool GlsMenuDataContainer_T< T >::_prevValueValid
protected

Whether or not the previous value should be considered.

Definition at line 473 of file gls_menu_data.h.


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