|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Representation of a timeline of floats with their names and moments 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 #ifndef TrackerValueDesc_h 00020 #define TrackerValueDesc_h 00021 // =========================================================================== 00022 // included modules 00023 // =========================================================================== 00024 #ifdef _MSC_VER 00025 #include <windows_config.h> 00026 #else 00027 #include <config.h> 00028 #endif 00029 00030 #include <fx.h> 00031 #include <string> 00032 #include <vector> 00033 #include <utils/foxtools/MFXMutex.h> 00034 #include <utils/common/RGBColor.h> 00035 #include <utils/common/SUMOTime.h> 00036 #include <utils/common/ValueRetriever.h> 00037 00038 00039 // =========================================================================== 00040 // class definitions 00041 // =========================================================================== 00049 class TrackerValueDesc : public ValueRetriever<SUMOReal> { 00050 public: 00052 TrackerValueDesc(const std::string& name, const RGBColor& col, 00053 SUMOTime recordBegin); 00054 00056 ~TrackerValueDesc(); 00057 00059 SUMOReal getRange() const; 00060 00062 SUMOReal getMin() const; 00063 00065 SUMOReal getMax() const; 00066 00068 SUMOReal getYCenter() const; 00069 00071 const RGBColor& getColor() const; 00072 00076 const std::vector<SUMOReal> &getValues(); 00077 00081 const std::vector<SUMOReal> &getAggregatedValues(); 00082 00084 const std::string& getName() const; 00085 00087 void addValue(SUMOReal value); 00088 00090 void unlockValues(); 00091 00093 void setAggregationSpan(SUMOTime as); 00094 00096 SUMOTime getAggregationSpan() const; 00097 00099 SUMOTime getRecordingBegin() const; 00100 00101 00102 private: 00104 std::string myName; 00105 00107 RGBColor myActiveCol; 00108 00110 RGBColor myInactiveCol; 00111 00113 std::vector<SUMOReal> myValues; 00114 00116 std::vector<SUMOReal> myAggregatedValues; 00117 00119 SUMOReal myMin, myMax; 00120 00121 // Mutex to avoid parallel drawing and insertion of new items 00122 MFXMutex myLock; 00123 00125 int myAggregationInterval; 00126 00128 SUMOReal myInvalidValue; 00129 00131 size_t myValidNo; 00132 00134 SUMOTime myRecordingBegin; 00135 00137 SUMOReal myTmpLastAggValue; 00138 00139 }; 00140 00141 00142 #endif 00143 00144 /****************************************************************************/ 00145