Eclipse 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-2019 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>
28 #include <utils/common/RGBColor.h>
29 #include <utils/common/SUMOTime.h>
31 
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
43 class TrackerValueDesc : public ValueRetriever<double> {
44 public:
46  TrackerValueDesc(const std::string& name, const RGBColor& col,
47  SUMOTime recordBegin,
48  double aggregationSeconds);
49 
52 
54  double getRange() const;
55 
57  double getMin() const;
58 
60  double getMax() const;
61 
63  double getYCenter() const;
64 
66  const RGBColor& getColor() const;
67 
71  const std::vector<double>& getValues();
72 
76  const std::vector<double>& getAggregatedValues();
77 
79  const std::string& getName() const;
80 
82  void addValue(double value);
83 
85  void unlockValues();
86 
89 
92 
95 
96 
97 private:
99  std::string myName;
100 
103 
106 
108  std::vector<double> myValues;
109 
111  std::vector<double> myAggregatedValues;
112 
114  double myMin, myMax;
115 
116  // Mutex to avoid parallel drawing and insertion of new items
117  FXMutex myLock;
118 
121 
124 
127 
130 
133 
134 };
135 
136 
137 #endif
138 
139 /****************************************************************************/
140 
TrackerValueDesc::myValues
std::vector< double > myValues
Values collected.
Definition: TrackerValueDesc.h:108
SUMOTime.h
TrackerValueDesc::getMin
double getMin() const
Returns the values minimum.
Definition: TrackerValueDesc.cpp:90
TrackerValueDesc::myValidNo
int myValidNo
Counter for valid numbers within the current aggregation interval.
Definition: TrackerValueDesc.h:126
TrackerValueDesc::getColor
const RGBColor & getColor() const
Returns the color to use to display the value.
Definition: TrackerValueDesc.cpp:108
TrackerValueDesc::myName
std::string myName
The name of the value.
Definition: TrackerValueDesc.h:99
TrackerValueDesc::myInactiveCol
RGBColor myInactiveCol
The color to use when the value is set as "inactive".
Definition: TrackerValueDesc.h:105
TrackerValueDesc::addValue
void addValue(double value)
Adds a new value to the list.
Definition: TrackerValueDesc.cpp:56
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
TrackerValueDesc::getMax
double getMax() const
Returns the values maximum.
Definition: TrackerValueDesc.cpp:96
TrackerValueDesc::myLock
FXMutex myLock
Definition: TrackerValueDesc.h:117
TrackerValueDesc::unlockValues
void unlockValues()
Releases the locking after the values have been drawn.
Definition: TrackerValueDesc.cpp:133
TrackerValueDesc::~TrackerValueDesc
~TrackerValueDesc()
Destructor.
Definition: TrackerValueDesc.cpp:47
RGBColor.h
TrackerValueDesc::getYCenter
double getYCenter() const
Returns the center of the value.
Definition: TrackerValueDesc.cpp:102
RGBColor
Definition: RGBColor.h:40
TrackerValueDesc::setAggregationSpan
void setAggregationSpan(SUMOTime as)
set the aggregation amount
Definition: TrackerValueDesc.cpp:139
TrackerValueDesc::getValues
const std::vector< double > & getValues()
returns the vector of collected values The values will be locked - no further addition will be perfom...
Definition: TrackerValueDesc.cpp:114
TrackerValueDesc::myTmpLastAggValue
double myTmpLastAggValue
Temporary storage for the last aggregation interval.
Definition: TrackerValueDesc.h:132
TrackerValueDesc
Representation of a timeline of floats with their names and moments.
Definition: TrackerValueDesc.h:43
TrackerValueDesc::getName
const std::string & getName() const
Returns the name of the value.
Definition: TrackerValueDesc.cpp:128
TrackerValueDesc::myMax
double myMax
Definition: TrackerValueDesc.h:114
TrackerValueDesc::myAggregationInterval
int myAggregationInterval
The aggregation interval in simulation steps.
Definition: TrackerValueDesc.h:120
TrackerValueDesc::myAggregatedValues
std::vector< double > myAggregatedValues
Collected values in their aggregated form.
Definition: TrackerValueDesc.h:111
ValueRetriever
Definition: ValueRetriever.h:33
ValueRetriever.h
TrackerValueDesc::myMin
double myMin
The minimum and the maximum of the value.
Definition: TrackerValueDesc.h:114
TrackerValueDesc::myRecordingBegin
SUMOTime myRecordingBegin
The time step the values are added from.
Definition: TrackerValueDesc.h:129
TrackerValueDesc::myActiveCol
RGBColor myActiveCol
The color to use when the value is set as "active".
Definition: TrackerValueDesc.h:102
config.h
TrackerValueDesc::getRange
double getRange() const
returns the maximum value range
Definition: TrackerValueDesc.cpp:84
TrackerValueDesc::getAggregatedValues
const std::vector< double > & getAggregatedValues()
returns the vector of aggregated values The values will be locked - no further addition will be perfo...
Definition: TrackerValueDesc.cpp:121
TrackerValueDesc::getRecordingBegin
SUMOTime getRecordingBegin() const
Returns the timestep the recording started.
Definition: TrackerValueDesc.cpp:173
TrackerValueDesc::myInvalidValue
double myInvalidValue
Values like this shall not be counted on aggregation.
Definition: TrackerValueDesc.h:123
TrackerValueDesc::getAggregationSpan
SUMOTime getAggregationSpan() const
get the aggregation amount
Definition: TrackerValueDesc.cpp:167
TrackerValueDesc::TrackerValueDesc
TrackerValueDesc(const std::string &name, const RGBColor &col, SUMOTime recordBegin, double aggregationSeconds)
Constructor.
Definition: TrackerValueDesc.cpp:35