Deprecate inheritance hierachy of plot formats in event_log_visualizer.

Instead add separate printing functions for each plot format in the base class.

Bug: webrtc:11566
Change-Id: I8adfc983b4e8a66c477de4022c2d97b6975d7e5c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176563
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31496}
This commit is contained in:
Bjorn Terelius
2020-06-09 17:17:21 +02:00
committed by Commit Bot
parent e366045375
commit 8a89b5bc0d
8 changed files with 272 additions and 236 deletions

View File

@ -15,6 +15,13 @@
#include <utility>
#include <vector>
#include "rtc_base/deprecation.h"
#include "rtc_base/ignore_wundef.h"
RTC_PUSH_IGNORING_WUNDEF()
#include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
enum class LineStyle {
@ -94,8 +101,8 @@ class Plot {
public:
virtual ~Plot() {}
// Overloaded to draw the plot.
virtual void Draw() = 0;
// Deprecated. Use PrintPythonCode() or ExportProtobuf() instead.
RTC_DEPRECATED virtual void Draw() {}
// Sets the lower x-axis limit to min_value (if left_margin == 0).
// Sets the upper x-axis limit to max_value (if right_margin == 0).
@ -158,6 +165,12 @@ class Plot {
// Otherwise, the call has no effect and the timeseries is destroyed.
void AppendTimeSeriesIfNotEmpty(TimeSeries&& time_series);
// Replaces PythonPlot::Draw()
void PrintPythonCode() const;
// Replaces ProtobufPlot::Draw()
void ExportProtobuf(webrtc::analytics::Chart* chart) const;
protected:
float xaxis_min_;
float xaxis_max_;
@ -175,8 +188,17 @@ class Plot {
class PlotCollection {
public:
virtual ~PlotCollection() {}
virtual void Draw() = 0;
virtual Plot* AppendNewPlot() = 0;
// Deprecated. Use PrintPythonCode() or ExportProtobuf() instead.
RTC_DEPRECATED virtual void Draw() {}
virtual Plot* AppendNewPlot();
// Replaces PythonPlotCollection::Draw()
void PrintPythonCode(bool shared_xaxis) const;
// Replaces ProtobufPlotCollections::Draw()
void ExportProtobuf(webrtc::analytics::ChartCollection* collection) const;
protected:
std::vector<std::unique_ptr<Plot>> plots_;