Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIParameterTableItem< T > Class Template Reference

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

#include <GUIParameterTableItem.h>

Inheritance diagram for GUIParameterTableItem< T >:
[legend]
Collaboration diagram for GUIParameterTableItem< T >:
[legend]

Public Member Functions

bool dynamic () const
 Returns the information whether this item may change over time.
 
ValueSource< double > * getdoubleSourceCopy () const
 Returns a double-typed copy of the source if the value is dynamic.
 
const std::string & getName () const
 Returns the name of this value.
 
ValueSource< T > * getSourceCopy () const
 Returns a copy of the source if the value is dynamic.
 
 GUIParameterTableItem (FXTable *table, unsigned pos, const std::string &name, bool dynamic, T value)
 Constructor for non-changing (static) values.
 
 GUIParameterTableItem (FXTable *table, unsigned pos, const std::string &name, bool dynamic, ValueSource< T > *src)
 Constructor for changing (dynamic) values.
 
void init (bool dynamic, std::string value)
 Initialises the line.
 
void update ()
 Resets the value if it's dynamic.
 
 ~GUIParameterTableItem ()
 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.
 
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 96 of file GUIParameterTableItem.h.

Constructor & Destructor Documentation

◆ GUIParameterTableItem() [1/2]

template<class T >
GUIParameterTableItem< T >::GUIParameterTableItem ( FXTable *  table,
unsigned  pos,
const std::string &  name,
bool  dynamic,
ValueSource< T > *  src 
)
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 108 of file GUIParameterTableItem.h.

References GUIParameterTableItem< T >::dynamic(), ValueSource< T >::getValue(), and GUIParameterTableItem< T >::init().

◆ GUIParameterTableItem() [2/2]

template<class T >
GUIParameterTableItem< T >::GUIParameterTableItem ( FXTable *  table,
unsigned  pos,
const std::string &  name,
bool  dynamic,
value 
)
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 126 of file GUIParameterTableItem.h.

References GUIParameterTableItem< T >::dynamic(), and GUIParameterTableItem< T >::init().

◆ ~GUIParameterTableItem()

template<class T >
GUIParameterTableItem< T >::~GUIParameterTableItem ( )
inline

Destructor.

Definition at line 134 of file GUIParameterTableItem.h.

References GUIParameterTableItem< T >::mySource.

Member Function Documentation

◆ dynamic()

template<class T >
bool GUIParameterTableItem< T >::dynamic ( ) const
inlinevirtual

Returns the information whether this item may change over time.

Implements GUIParameterTableItemInterface.

Definition at line 166 of file GUIParameterTableItem.h.

References GUIParameterTableItem< T >::myAmDynamic.

Referenced by GUIParameterTableItem< T >::GUIParameterTableItem(), GUIParameterTableItem< T >::GUIParameterTableItem(), GUIParameterTableItem< T >::init(), and GUIParameterTableItem< T >::update().

Here is the caller graph for this function:

◆ getdoubleSourceCopy()

template<class T >
ValueSource< double > * GUIParameterTableItem< T >::getdoubleSourceCopy ( ) const
inlinevirtual

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

Implements GUIParameterTableItemInterface.

Definition at line 202 of file GUIParameterTableItem.h.

References ValueSource< T >::makedoubleReturningCopy(), and GUIParameterTableItem< T >::mySource.

Referenced by GUIParameterTableItem< T >::init().

Here is the caller graph for this function:

◆ getName()

template<class T >
const std::string & GUIParameterTableItem< T >::getName ( ) const
inlinevirtual

Returns the name of this value.

Implements GUIParameterTableItemInterface.

Definition at line 171 of file GUIParameterTableItem.h.

References GUIParameterTableItem< T >::myName.

◆ getSourceCopy()

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

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

Definition at line 194 of file GUIParameterTableItem.h.

References GUIParameterTableItem< T >::mySource.

◆ init()

template<class T >
void GUIParameterTableItem< T >::init ( bool  dynamic,
std::string  value 
)
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 146 of file GUIParameterTableItem.h.

References GUIParameterTableItem< T >::dynamic(), GUIParameterTableItem< T >::getdoubleSourceCopy(), GUIIconSubSys::getIcon(), GUIParameterTableItem< T >::myName, GUIParameterTableItem< T >::myTable, GUIParameterTableItem< T >::myTablePosition, NO, TRACKER, and YES.

Referenced by GUIParameterTableItem< T >::GUIParameterTableItem(), and GUIParameterTableItem< T >::GUIParameterTableItem().

Here is the caller graph for this function:

◆ update()

template<class T >
void GUIParameterTableItem< T >::update ( )
inlinevirtual

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 182 of file GUIParameterTableItem.h.

References GUIParameterTableItem< T >::dynamic(), GUIParameterTableItem< T >::mySource, GUIParameterTableItem< T >::myTable, GUIParameterTableItem< T >::myTablePosition, and GUIParameterTableItem< T >::myValue.

Field Documentation

◆ myAmDynamic

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

Information whether the value may change.

Definition at line 211 of file GUIParameterTableItem.h.

Referenced by GUIParameterTableItem< T >::dynamic().

◆ myName

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

The name of this value.

Definition at line 214 of file GUIParameterTableItem.h.

Referenced by GUIParameterTableItem< T >::getName(), and GUIParameterTableItem< T >::init().

◆ mySource

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 220 of file GUIParameterTableItem.h.

Referenced by GUIParameterTableItem< T >::getdoubleSourceCopy(), GUIParameterTableItem< T >::getSourceCopy(), GUIParameterTableItem< T >::update(), and GUIParameterTableItem< T >::~GUIParameterTableItem().

◆ myTable

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

The table this entry belongs to.

Definition at line 226 of file GUIParameterTableItem.h.

Referenced by GUIParameterTableItem< T >::init(), and GUIParameterTableItem< T >::update().

◆ myTablePosition

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

The position within the table.

Definition at line 217 of file GUIParameterTableItem.h.

Referenced by GUIParameterTableItem< T >::init(), and GUIParameterTableItem< T >::update().

◆ myValue

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

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

Definition at line 223 of file GUIParameterTableItem.h.

Referenced by GUIParameterTableItem< T >::update().


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