SUMO - Simulation of Urban MObility
TrackerValueDesc.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // Representation of a timeline of floats with their names and moments
19 /****************************************************************************/
20 #ifndef TrackerValueDesc_h
21 #define TrackerValueDesc_h
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include <fx.h>
32 #include <string>
33 #include <vector>
35 #include <utils/common/RGBColor.h>
36 #include <utils/common/SUMOTime.h>
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
50 class TrackerValueDesc : public ValueRetriever<double> {
51 public:
53  TrackerValueDesc(const std::string& name, const RGBColor& col,
54  SUMOTime recordBegin,
55  double aggregationSeconds);
56 
59 
61  double getRange() const;
62 
64  double getMin() const;
65 
67  double getMax() const;
68 
70  double getYCenter() const;
71 
73  const RGBColor& getColor() const;
74 
78  const std::vector<double>& getValues();
79 
83  const std::vector<double>& getAggregatedValues();
84 
86  const std::string& getName() const;
87 
89  void addValue(double value);
90 
92  void unlockValues();
93 
96 
99 
101  SUMOTime getRecordingBegin() const;
102 
103 
104 private:
106  std::string myName;
107 
110 
113 
115  std::vector<double> myValues;
116 
118  std::vector<double> myAggregatedValues;
119 
121  double myMin, myMax;
122 
123  // Mutex to avoid parallel drawing and insertion of new items
125 
128 
131 
134 
137 
140 
141 };
142 
143 
144 #endif
145 
146 /****************************************************************************/
147 
double getYCenter() const
Returns the center of the value.
TrackerValueDesc(const std::string &name, const RGBColor &col, SUMOTime recordBegin, double aggregationSeconds)
Constructor.
int myAggregationInterval
The aggregation interval in simulation steps.
void unlockValues()
Releases the locking after the values have been drawn.
SUMOTime getRecordingBegin() const
Returns the timestep the recording started.
Representation of a timeline of floats with their names and moments.
double myInvalidValue
Values like this shall not be counted on aggregation.
SUMOTime getAggregationSpan() const
get the aggregation amount
SUMOTime myRecordingBegin
The time step the values are added from.
std::vector< double > myAggregatedValues
Collected values in their aggregated form.
std::vector< double > myValues
Values collected.
const std::vector< double > & getAggregatedValues()
returns the vector of aggregated values The values will be locked - no further addition will be perfo...
RGBColor myActiveCol
The color to use when the value is set as "active".
int myValidNo
Counter for valid numbers within the current aggregation interval.
double myMin
The minimum and the maximum of the value.
RGBColor myInactiveCol
The color to use when the value is set as "inactive".
const std::string & getName() const
Returns the name of the value.
double getMax() const
Returns the values maximum.
const std::vector< double > & getValues()
returns the vector of collected values The values will be locked - no further addition will be perfom...
double myTmpLastAggValue
Temporary storage for the last aggregation interval.
~TrackerValueDesc()
Destructor.
const RGBColor & getColor() const
Returns the color to use to display the value.
long long int SUMOTime
Definition: TraCIDefs.h:51
double getMin() const
Returns the values minimum.
void addValue(double value)
Adds a new value to the list.
std::string myName
The name of the value.
double getRange() const
returns the maximum value range
void setAggregationSpan(SUMOTime as)
set the aggregation amount