"Fossies" - the Fresh Open Source Software Archive

Member "tcpflow-1.6.1/src/netviz/port_histogram_view.h" (19 Feb 2021, 1609 Bytes) of package /linux/misc/tcpflow-1.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "port_histogram_view.h" see the Fossies "Dox" file reference documentation.

    1 /**
    2  * port_histogram_view.h:
    3  *
    4  * This source file is public domain, as it is not based on the original tcpflow.
    5  *
    6  * Author: Michael Shick <mike@shick.in>
    7  *
    8  */
    9 
   10 #ifndef PORT_HISTOGRAM_VIEW_H
   11 #define PORT_HISTOGRAM_VIEW_H
   12 
   13 #include "config.h"
   14 #ifdef HAVE_LIBCAIRO
   15 
   16 #include "plot_view.h"
   17 #include "port_histogram.h"
   18 
   19 class port_histogram_view : public plot_view {
   20 public:
   21     port_histogram_view(port_histogram &histogram_,
   22             const std::map<in_port_t, rgb_t> &color_map_,
   23             const rgb_t &default_color, const rgb_t &cdf_color_);
   24 
   25     class bucket_view {
   26     public:
   27         bucket_view(const port_histogram::port_count &bucket_,
   28                 const rgb_t &color_) :
   29             bucket(bucket_), color(color_), chip_height(0.0), chip_offset(0.0) {}
   30 
   31         const port_histogram::port_count &bucket;
   32         const rgb_t &color;
   33         double chip_height;
   34         double chip_offset;
   35 
   36         static const double label_font_size;
   37         static const double chip_width_factor;
   38 
   39         void render(cairo_t *cr, const bounds_t &bounds);
   40         void render_label(cairo_t *cr, const bounds_t &bounds);
   41     };
   42 
   43     port_histogram &histogram;
   44     const std::map<in_port_t, rgb_t> &color_map;
   45     const rgb_t &default_color;
   46     const rgb_t &cdf_color;
   47 
   48     static const double bar_space_factor;
   49     static const double bar_chip_size_factor;
   50     static const double cdf_line_width;
   51     static const double data_width_factor;
   52 
   53     void render(cairo_t *cr, const bounds_t &bounds);
   54     void render_data(cairo_t *cr, const bounds_t &bounds);
   55     port_histogram &get_data();
   56 };
   57 
   58 #endif
   59 #endif