diff options
Diffstat (limited to 'grapher/GraphData.hxx')
-rw-r--r-- | grapher/GraphData.hxx | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index 0e26fb4d..04f415f3 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -1,6 +1,9 @@ #ifndef SYSTEMTAP_GRAPHDATA_HXX #define SYSTEMTAP_GRAPHDATA_HXX 1 +#include <stdint.h> + +#include <sstream> #include <string> #include <utility> #include <vector> @@ -8,26 +11,26 @@ #include <boost/circular_buffer.hpp> +#include "GraphStyle.hxx" + namespace systemtap { struct GraphDataBase { virtual ~GraphDataBase() {} - enum Style - { BAR, - DOT, - EVENT - }; - typedef boost::circular_buffer<double> TimeList; + + typedef boost::circular_buffer<int64_t> 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; } + virtual std::string elementAsString(size_t element) = 0; // size of grid square at "normal" viewing + std::string name; double scale; double color[3]; - Style style; + GraphStyle* style; std::string title; std::string xAxisText; std::string yAxisText; @@ -44,6 +47,12 @@ namespace systemtap : GraphDataBase(cap), data(cap) { } + std::string elementAsString(size_t element) + { + std::ostringstream stream; + stream << data[element]; + return stream.str(); + } DataList data; }; struct CSVData |