From cfd482078cd4805076cc6fd7e4e8642b97a03b25 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 8 Dec 2009 12:44:03 +0100 Subject: refactor list of data sets out of GraphWidget into a global data structure. Also, add a sigc signal for broadcasting data set changes. * grapher/GraphData.hxx (GraphDataList) new typedef (getGraphData, graphDataSignal): new functions * grapher/Graph.hxx (DatasetList): remove typedef in favor of systemtap::GraphDataList * grapher/GraphWidget.cxx (GraphWidget, onGraphDataChanged): Use graphDataSignal to notice new data sets that need to be added. Use the global data set list instead of one embedded in GraphWidget. * grapher/StapParser.hxx: delete the _widget member; use signals to broadcast that there are new data sets instead of calling into the widget. --- grapher/GraphData.hxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'grapher/GraphData.hxx') diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index fbb2bb8f..fb1ca9f5 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -19,10 +19,14 @@ #include +#include + #include "GraphStyle.hxx" namespace systemtap { + struct GraphDataBase; + typedef std::vector > GraphDataList; struct GraphDataBase { virtual ~GraphDataBase() {} @@ -43,6 +47,9 @@ namespace systemtap std::string xAxisText; std::string yAxisText; TimeList times; + static GraphDataList graphData; + // signal stuff for telling everyone about changes to the data set list + static sigc::signal graphDataChanged; }; template @@ -69,5 +76,12 @@ namespace systemtap Element; std::vector elements; }; + + inline GraphDataList& getGraphData() { return GraphDataBase::graphData; } + + inline sigc::signal& graphDataSignal() + { + return GraphDataBase::graphDataChanged; + } } #endif -- cgit