]> git.tdb.fi Git - netvis.git/blob - source/history.h
Tick new and reappearing hosts a few times to put them in sensible locations
[netvis.git] / source / history.h
1 /* $Id$
2
3 This file is part of NetVis
4 Copyright @ 2008 Mikko Rasa, Mikkosoft Productions
5 Distributed unter the GPL
6 */
7
8 #ifndef HISTORY_H_
9 #define HISTORY_H_
10
11 #include <msp/gl/mesh.h>
12 #include <msp/gl/texture2d.h>
13 #include <msp/time/timestamp.h>
14 #include "ringbuffer.h"
15
16 class NetVis;
17
18 class History
19 {
20 private:
21         struct Bandwidth
22         {
23                 unsigned down;
24                 unsigned up;
25
26                 Bandwidth();
27         };
28
29         NetVis &netvis;
30         unsigned width;
31         unsigned height;
32         Bandwidth accum;
33         RingBuffer<Bandwidth> buffer;
34         Msp::Time::TimeStamp next_push;
35         unsigned scale;
36         Msp::GL::Texture2D texture;
37         Msp::GL::Mesh mesh;
38
39 public:
40         History(NetVis &, unsigned, unsigned);
41         void activity(unsigned, unsigned);
42         void tick(const Msp::Time::TimeStamp &);
43         void render() const;
44 private:
45         void create_texture();
46 };
47
48 #endif