SUMO - Simulation of Urban MObility
TrackerValueDesc.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Representation of a timeline of floats with their names and moments
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef TrackerValueDesc_h
22 #define TrackerValueDesc_h
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <fx.h>
33 #include <string>
34 #include <vector>
36 #include <utils/common/RGBColor.h>
37 #include <utils/common/SUMOTime.h>
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
51 class TrackerValueDesc : public ValueRetriever<double> {
52 public:
54  TrackerValueDesc(const std::string& name, const RGBColor& col,
55  SUMOTime recordBegin,
56  double aggregationSeconds);
57 
60 
62  double getRange() const;
63 
65  double getMin() const;
66 
68  double getMax() const;
69 
71  double getYCenter() const;
72 
74  const RGBColor& getColor() const;
75 
79  const std::vector<double>& getValues();
80 
84  const std::vector<double>& getAggregatedValues();
85 
87  const std::string& getName() const;
88 
90  void addValue(double value);
91 
93  void unlockValues();
94 
97 
100 
102  SUMOTime getRecordingBegin() const;
103 
104 
105 private:
107  std::string myName;
108 
111 
114 
116  std::vector<double> myValues;
117 
119  std::vector<double> myAggregatedValues;
120 
122  double myMin, myMax;
123 
124  // Mutex to avoid parallel drawing and insertion of new items
126 
129 
132 
135 
138 
141 
142 };
143 
144 
145 #endif
146 
147 /****************************************************************************/
148 
double getMax() const
Returns the values maximum.
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.
Representation of a timeline of floats with their names and moments.
double myInvalidValue
Values like this shall not be counted on aggregation.
double getYCenter() const
Returns the center of the value.
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.
SUMOTime getRecordingBegin() const
Returns the timestep the recording started.
double myMin
The minimum and the maximum of the value.
RGBColor myInactiveCol
The color to use when the value is set as "inactive".
double getRange() const
returns the maximum value range
SUMOTime getAggregationSpan() const
get the aggregation amount
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.
const std::string & getName() const
Returns the name of the value.
~TrackerValueDesc()
Destructor.
long long int SUMOTime
Definition: TraCIDefs.h:52
void addValue(double value)
Adds a new value to the list.
double getMin() const
Returns the values minimum.
std::string myName
The name of the value.
const RGBColor & getColor() const
Returns the color to use to display the value.
void setAggregationSpan(SUMOTime as)
set the aggregation amount