Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license | |
| 5 * that can be found in the LICENSE file in the root of the source | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 #ifndef WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | |
| 11 #define WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | |
| 12 | |
| 13 #include <memory> | |
| 14 #include <string> | |
| 15 #include <utility> | |
| 16 #include <vector> | |
| 17 | |
| 18 namespace webrtc { | |
| 19 namespace plotting { | |
| 20 | |
| 21 enum PlotStyle { LINE_GRAPH, BAR_GRAPH }; | |
| 22 | |
| 23 struct TimeSeriesPoint { | |
| 24 TimeSeriesPoint(float x_, float y_) : x(x_), y(y_) {} | |
|
stefan-webrtc
2016/05/31 18:53:40
I don't think the _ are needed?
terelius
2016/06/14 13:18:49
Done.
| |
| 25 TimeSeriesPoint(float x_, float y_, std::string message_) | |
| 26 : x(x_), y(y_), message(message_) {} | |
| 27 float x; | |
| 28 float y; | |
| 29 std::string message; | |
| 30 }; | |
| 31 | |
| 32 struct TimeSeries { | |
| 33 std::string label; | |
| 34 PlotStyle style; | |
| 35 std::vector<TimeSeriesPoint> points; | |
| 36 void swap(TimeSeries& other) { | |
| 37 label.swap(other.label); | |
| 38 std::swap(style, other.style); | |
| 39 points.swap(other.points); | |
|
aleloi
2016/06/08 11:44:20
Use std::swap in all cases for consistency. It is
terelius
2016/06/14 13:18:49
Done.
| |
| 40 } | |
| 41 }; | |
| 42 | |
| 43 class Plot { | |
| 44 public: | |
| 45 virtual ~Plot() {} | |
| 46 virtual void draw() = 0; | |
| 47 | |
| 48 public: | |
|
stefan-webrtc
2016/05/31 18:53:40
Private?
terelius
2016/06/14 13:18:49
The members are set by all the CreateGraph() funct
| |
| 49 float xaxis_min; | |
| 50 float xaxis_max; | |
| 51 std::string xaxis_label; | |
| 52 float yaxis_min; | |
| 53 float yaxis_max; | |
| 54 std::string yaxis_label; | |
| 55 std::vector<TimeSeries> series; | |
| 56 std::string title; | |
| 57 }; | |
| 58 | |
| 59 class PlotCollection { | |
| 60 public: | |
| 61 virtual ~PlotCollection() {} | |
| 62 virtual void draw() = 0; | |
| 63 virtual void append_plot() = 0; | |
| 64 std::vector<std::unique_ptr<Plot> > plots; | |
|
stefan-webrtc
2016/05/31 18:53:40
Would probably make sense to make this private, ri
aleloi
2016/06/08 11:44:20
It is accessed in the main function and in analysi
terelius
2016/06/14 13:18:49
The abstract representation of a graph should not
terelius
2016/06/14 13:18:49
It would have to be protected since we want to acc
| |
| 65 }; | |
| 66 | |
| 67 } // namespace plotting | |
| 68 } // namespace webrtc | |
| 69 | |
| 70 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | |
| OLD | NEW |