diff options
Diffstat (limited to 'grapher/GraphData.hxx')
-rw-r--r-- | grapher/GraphData.hxx | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index fb1ca9f5..863b1d07 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -25,63 +25,63 @@ namespace systemtap { - struct GraphDataBase; - typedef std::vector<std::tr1::shared_ptr<GraphDataBase> > GraphDataList; - struct GraphDataBase - { - virtual ~GraphDataBase() {} +struct GraphDataBase; +typedef std::vector<std::tr1::shared_ptr<GraphDataBase> > GraphDataList; +struct GraphDataBase +{ + virtual ~GraphDataBase() {} - typedef boost::circular_buffer<int64_t> TimeList; - GraphDataBase(TimeList::capacity_type cap = 50000) - : 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]; - GraphStyle* style; - std::string title; - 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<void> graphDataChanged; - }; + typedef boost::circular_buffer<int64_t> TimeList; + GraphDataBase(TimeList::capacity_type cap = 50000) + : 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]; + GraphStyle* style; + std::string title; + 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<void> graphDataChanged; +}; - template<typename T> - class GraphData : public GraphDataBase +template<typename T> +class GraphData : public GraphDataBase +{ +public: + typedef T data_type; + typedef boost::circular_buffer<data_type> DataList; + GraphData(typename DataList::capacity_type cap = 50000) + : GraphDataBase(cap), data(cap) { - public: - typedef T data_type; - typedef boost::circular_buffer<data_type> DataList; - GraphData(typename DataList::capacity_type cap = 50000) - : GraphDataBase(cap), data(cap) - { - } - std::string elementAsString(size_t element) - { - std::ostringstream stream; - stream << data[element]; - return stream.str(); - } - DataList data; - }; - struct CSVData + } + std::string elementAsString(size_t element) { - typedef std::pair<std::string, std::tr1::shared_ptr<GraphDataBase> > - Element; - std::vector<Element> elements; - }; + std::ostringstream stream; + stream << data[element]; + return stream.str(); + } + DataList data; +}; +struct CSVData +{ + typedef std::pair<std::string, std::tr1::shared_ptr<GraphDataBase> > + Element; + std::vector<Element> elements; +}; - inline GraphDataList& getGraphData() { return GraphDataBase::graphData; } +inline GraphDataList& getGraphData() { return GraphDataBase::graphData; } - inline sigc::signal<void>& graphDataSignal() - { - return GraphDataBase::graphDataChanged; - } +inline sigc::signal<void>& graphDataSignal() +{ + return GraphDataBase::graphDataChanged; +} } #endif |