SUMO - Simulation of Urban MObility

GUIParameterTableItem< T > Class Template Reference

Instance of a single line in a parameter window. More...

#include <GUIParameterTableItem.h>

Inheritance diagram for GUIParameterTableItem< T >:
GUIParameterTableItemInterface

Public Member Functions

bool dynamic () const throw ()
 Returns the information whether this item may change.
const std::string & getName () const throw ()
 Returns the name of this value.
ValueSource< T > * getSourceCopy () const throw ()
 Returns a copy of the source if the value is dynamic.
ValueSource< SUMOReal > * getSUMORealSourceCopy () const throw ()
 Returns a SUMOReal-typed copy of the source if the value is dynamic.
 GUIParameterTableItem (FXTable *table, unsigned pos, const std::string &name, bool dynamic, ValueSource< T > *src) throw ()
 Constructor for changing (dynamic) values.
 GUIParameterTableItem (FXTable *table, unsigned pos, const std::string &name, bool dynamic, T value) throw ()
 Constructor for non-changing (static) values.
 GUIParameterTableItem (FXTable *table, unsigned pos, const std::string &name, bool dynamic, std::string value) throw ()
 Constructor for string-typed, non-changing (static) values.
void init (bool dynamic, std::string value) throw ()
 Initialises the line.
void update () throw ()
 Resets the value if it's dynamic.
 ~GUIParameterTableItem () throw ()
 Destructor.

Private Attributes

bool myAmDynamic
 Information whether the value may change.
std::string myName
 The name of this value.
ValueSource< T > * mySource
 The source to gain new values from; this source is==0 if the values are not dynamic.
FXTable * myTable
 The table this entry belongs to.
FXint myTablePosition
 The position within the table.
T myValue
 A backup of the value to avoid the redrawing when nothing has changed.

Detailed Description

template<class T>
class GUIParameterTableItem< T >

Instance of a single line in a parameter window.

This class represents a single item of a parameter table and is an implementation of the GUIParameterTableItemInterface that allows different value-types.

As some values may change over the simulation, this class holds the information whether they change and how to ask for new values if they do.

See also:
GUIParameterTracker
GUIParameterTableItemInterface

Definition at line 118 of file GUIParameterTableItem.h.


Constructor & Destructor Documentation

template<class T>
GUIParameterTableItem< T >::GUIParameterTableItem ( FXTable *  table,
unsigned  pos,
const std::string &  name,
bool  dynamic,
ValueSource< T > *  src 
) throw () [inline]

Constructor for changing (dynamic) values.

Parameters:
[in]tableThe table this item belongs to
[in]posThe row of the table this item fills
[in]nameThe name of the represented value
[in]dynamicInformation whether this value changes over time
[in]srcThe value source
Todo:

Consider using a reference to the table

Check whether the name should be stored in GUIParameterTableItemInterface

Definition at line 130 of file GUIParameterTableItem.h.

References GUIParameterTableItemInterface::dynamic().

template<class T>
GUIParameterTableItem< T >::GUIParameterTableItem ( FXTable *  table,
unsigned  pos,
const std::string &  name,
bool  dynamic,
T  value 
) throw () [inline]

Constructor for non-changing (static) values.

Parameters:
[in]tableThe table this item belongs to
[in]posThe row of the table this item fills
[in]nameThe name of the represented value
[in]dynamicInformation whether this value changes over time
[in]valueThe value
Todo:

Consider using a reference to the table

Check whether the name should be stored in GUIParameterTableItemInterface

Should never be dynamic!?

Definition at line 150 of file GUIParameterTableItem.h.

References GUIParameterTableItemInterface::dynamic().

template<class T>
GUIParameterTableItem< T >::GUIParameterTableItem ( FXTable *  table,
unsigned  pos,
const std::string &  name,
bool  dynamic,
std::string  value 
) throw () [inline]

Constructor for string-typed, non-changing (static) values.

Parameters:
[in]tableThe table this item belongs to
[in]posThe row of the table this item fills
[in]nameThe name of the represented value
[in]dynamicInformation whether this value changes over time
[in]valueThe value
Todo:

Consider using a reference to the table

Check whether the name should be stored in GUIParameterTableItemInterface

Should never be dynamic!?

Definition at line 170 of file GUIParameterTableItem.h.

References GUIParameterTableItemInterface::dynamic().

template<class T>
GUIParameterTableItem< T >::~GUIParameterTableItem ( ) throw () [inline]

Destructor.

Definition at line 180 of file GUIParameterTableItem.h.


Member Function Documentation

template<class T>
bool GUIParameterTableItem< T >::dynamic ( ) const throw () [inline, virtual]

Returns the information whether this item may change.

Returns:
Whether this item changes over time

Implements GUIParameterTableItemInterface.

Definition at line 210 of file GUIParameterTableItem.h.

template<class T>
const std::string& GUIParameterTableItem< T >::getName ( ) const throw () [inline, virtual]

Returns the name of this value.

Returns:
The name of this value

Implements GUIParameterTableItemInterface.

Definition at line 219 of file GUIParameterTableItem.h.

template<class T>
ValueSource<T>* GUIParameterTableItem< T >::getSourceCopy ( ) const throw () [inline]

Returns a copy of the source if the value is dynamic.

Returns:
A copy of the value source

Definition at line 247 of file GUIParameterTableItem.h.

template<class T>
ValueSource<SUMOReal>* GUIParameterTableItem< T >::getSUMORealSourceCopy ( ) const throw () [inline, virtual]

Returns a SUMOReal-typed copy of the source if the value is dynamic.

Returns:
A SUMOReal-typed copy of the value source

Implements GUIParameterTableItemInterface.

Definition at line 259 of file GUIParameterTableItem.h.

References ValueSource< T >::makeSUMORealReturningCopy().

template<class T>
void GUIParameterTableItem< T >::init ( bool  dynamic,
std::string  value 
) throw () [inline]

Initialises the line.

Fills the line using the name, the current value, and the information whether the value changes over time.

Parameters:
[in]dynamicInformation whether this value changes over time
[in]valueThe current (initial) value

Definition at line 193 of file GUIParameterTableItem.h.

References GUIParameterTableItemInterface::dynamic(), GUIIconSubSys::getIcon(), ICON_NO, and ICON_YES.

template<class T>
void GUIParameterTableItem< T >::update ( ) throw () [inline, virtual]

Resets the value if it's dynamic.

If the value is dynamic, the current value is retrieved from the value source. If it is different from the previous one (stored in myValue), it is stored in myValue and set as the current value text within the according table cell.

Implements GUIParameterTableItemInterface.

Definition at line 231 of file GUIParameterTableItem.h.

References GUIParameterTableItemInterface::dynamic().


Field Documentation

template<class T>
bool GUIParameterTableItem< T >::myAmDynamic [private]

Information whether the value may change.

Definition at line 269 of file GUIParameterTableItem.h.

template<class T>
std::string GUIParameterTableItem< T >::myName [private]

The name of this value.

Definition at line 272 of file GUIParameterTableItem.h.

template<class T>
ValueSource<T>* GUIParameterTableItem< T >::mySource [private]

The source to gain new values from; this source is==0 if the values are not dynamic.

Definition at line 278 of file GUIParameterTableItem.h.

template<class T>
FXTable* GUIParameterTableItem< T >::myTable [private]

The table this entry belongs to.

Definition at line 284 of file GUIParameterTableItem.h.

template<class T>
FXint GUIParameterTableItem< T >::myTablePosition [private]

The position within the table.

Definition at line 275 of file GUIParameterTableItem.h.

template<class T>
T GUIParameterTableItem< T >::myValue [private]

A backup of the value to avoid the redrawing when nothing has changed.

Definition at line 281 of file GUIParameterTableItem.h.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines