SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // Representation of a timeline of floats with their names and moments 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef TrackerValueDesc_h 00022 #define TrackerValueDesc_h 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include <fx.h> 00033 #include <string> 00034 #include <vector> 00035 #include <utils/foxtools/MFXMutex.h> 00036 #include <utils/common/RGBColor.h> 00037 #include <utils/common/SUMOTime.h> 00038 #include <utils/common/ValueRetriever.h> 00039 00040 00041 // =========================================================================== 00042 // class definitions 00043 // =========================================================================== 00051 class TrackerValueDesc : public ValueRetriever<SUMOReal> { 00052 public: 00054 TrackerValueDesc(const std::string& name, const RGBColor& col, 00055 SUMOTime recordBegin); 00056 00058 ~TrackerValueDesc(); 00059 00061 SUMOReal getRange() const; 00062 00064 SUMOReal getMin() const; 00065 00067 SUMOReal getMax() const; 00068 00070 SUMOReal getYCenter() const; 00071 00073 const RGBColor& getColor() const; 00074 00078 const std::vector<SUMOReal> &getValues(); 00079 00083 const std::vector<SUMOReal> &getAggregatedValues(); 00084 00086 const std::string& getName() const; 00087 00089 void addValue(SUMOReal value); 00090 00092 void unlockValues(); 00093 00095 void setAggregationSpan(SUMOTime as); 00096 00098 SUMOTime getAggregationSpan() const; 00099 00101 SUMOTime getRecordingBegin() const; 00102 00103 00104 private: 00106 std::string myName; 00107 00109 RGBColor myActiveCol; 00110 00112 RGBColor myInactiveCol; 00113 00115 std::vector<SUMOReal> myValues; 00116 00118 std::vector<SUMOReal> myAggregatedValues; 00119 00121 SUMOReal myMin, myMax; 00122 00123 // Mutex to avoid parallel drawing and insertion of new items 00124 MFXMutex myLock; 00125 00127 int myAggregationInterval; 00128 00130 SUMOReal myInvalidValue; 00131 00133 size_t myValidNo; 00134 00136 SUMOTime myRecordingBegin; 00137 00139 SUMOReal myTmpLastAggValue; 00140 00141 }; 00142 00143 00144 #endif 00145 00146 /****************************************************************************/ 00147