From 6197b0dc80c4f87000d26213293fe2cb72fbe081 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 1 Dec 2009 19:05:09 +0100 Subject: Refactor drawing of different styles of graph into classes * grapher/GraphStyle.cxx: New file * grapher/GraphStyle.hxx: New file * grapher/Graph(draw): Move much drawing code to GraphStyle::draw --- grapher/GraphData.hxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'grapher/GraphData.hxx') diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index e06ffdb8..9a267fc5 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -11,19 +11,17 @@ #include +#include "GraphStyle.hxx" + namespace systemtap { struct GraphDataBase { virtual ~GraphDataBase() {} - enum Style - { BAR, - DOT, - EVENT - }; + typedef boost::circular_buffer TimeList; GraphDataBase(TimeList::capacity_type cap = 50000) - : scale(1.0), style(BAR), times(cap) + : scale(1.0), style(&GraphStyleBar::instance), times(cap) { color[0] = 0.0; color[1] = 1.0; color[2] = 0.0; } @@ -31,7 +29,7 @@ namespace systemtap // size of grid square at "normal" viewing double scale; double color[3]; - Style style; + GraphStyle* style; std::string title; std::string xAxisText; std::string yAxisText; -- cgit