added mechanism to allow services to document the names of their items, and improved bandwidth graph to show names for GXS services. Other services still need to supply their own names

This commit is contained in:
csoler 2017-04-20 20:54:51 +02:00
parent f406b81238
commit 5f8bf03dfe
15 changed files with 280 additions and 81 deletions

View file

@ -69,8 +69,11 @@ public:
// return the vector of last values up to date
virtual void getCurrentValues(std::vector<QPointF>& vals) const ;
// return the vector of cumulated values up to date
virtual void getCumulatedValues(std::vector<float>& vals) const;
// returns what to display in the legend. Derive this to show additional info.
virtual QString legend(int i,float v) const ;
virtual QString legend(int i, float v, bool show_value=true) const ;
// Returns the n^th interpolated value at the given time in floating point seconds backward.
virtual void getDataPoints(int index, std::vector<QPointF>& pts, float filter_factor=0.0f) const ;
@ -95,11 +98,13 @@ protected slots:
protected:
virtual void getValues(std::map<std::string,float>& values) const = 0 ;// overload this in your own class to fill in the values you want to display.
void updateTotals();
qint64 getTime() const ; // returns time in ms since RS has started
// Storage of collected events. The string is any string used to represent the collected data.
std::map<std::string, std::list<std::pair<qint64,float> > > _points ;
std::map<std::string, float> _totals ;
QTimer *_timer ;
@ -118,8 +123,9 @@ public:
static const uint32_t RSGRAPH_FLAGS_LOG_SCALE_Y = 0x0002 ;// log scale in Y
static const uint32_t RSGRAPH_FLAGS_ALWAYS_COLLECT = 0x0004 ;// keep collecting while not displayed
static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_PLAIN = 0x0008 ;// use plain / line drawing style
static const uint32_t RSGRAPH_FLAGS_SHOW_LEGEND = 0x0010 ;// show legend in the graph
static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_FLAT = 0x0020 ;// do not interpolate, and draw flat colored boxes
static const uint32_t RSGRAPH_FLAGS_SHOW_LEGEND = 0x0010 ;// show legend in the graph
static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_FLAT = 0x0020 ;// do not interpolate, and draw flat colored boxes
static const uint32_t RSGRAPH_FLAGS_LEGEND_CUMULATED = 0x0040 ;// show the total in the legend rather than current values
/** Bandwidth graph style. */
enum GraphStyle