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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // Representation of a timeline of floats with their names and moments
17 /****************************************************************************/
18 #ifndef TrackerValueDesc_h
19 #define TrackerValueDesc_h
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <fx.h>
26 #include <string>
27 #include <vector>
29 #include <utils/common/RGBColor.h>
30 #include <utils/common/SUMOTime.h>
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
44 class TrackerValueDesc : public ValueRetriever<double> {
45 public:
47  TrackerValueDesc(const std::string& name, const RGBColor& col,
48  SUMOTime recordBegin,
49  double aggregationSeconds);
50 
53 
55  double getRange() const;
56 
58  double getMin() const;
59 
61  double getMax() const;
62 
64  double getYCenter() const;
65 
67  const RGBColor& getColor() const;
68 
72  const std::vector<double>& getValues();
73 
77  const std::vector<double>& getAggregatedValues();
78 
80  const std::string& getName() const;
81 
83  void addValue(double value);
84 
86  void unlockValues();
87 
90 
93 
96 
97 
98 private:
100  std::string myName;
101 
104 
107 
109  std::vector<double> myValues;
110 
112  std::vector<double> myAggregatedValues;
113 
115  double myMin, myMax;
116 
117  // Mutex to avoid parallel drawing and insertion of new items
119 
122 
125 
128 
131 
134 
135 };
136 
137 
138 #endif
139 
140 /****************************************************************************/
141 
double getYCenter() const
Returns the center of the value.
long long int SUMOTime
Definition: SUMOTime.h:36
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.
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