]> git.tdb.fi Git - netvis.git/blob - source/host.h
Move activity tracking to a separate class
[netvis.git] / source / host.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 HOST_H_
9 #define HOST_H_
10
11 #include <map>
12 #include <string>
13 #include <msp/time/timedelta.h>
14 #include "activity.h"
15 #include "vector2.h"
16
17 class NetVis;
18
19 class Host
20 {
21 private:
22         NetVis &netvis;
23         unsigned addr;
24         std::string name;
25         std::string short_name;
26         bool local;
27         Vector2 pos;
28         bool active;
29         Activity activity;
30         float throttle;
31
32 public:
33         Host(NetVis &, unsigned);
34         unsigned get_address() const { return addr; }
35         void set_name(const std::string &);
36         const std::string &get_name() const { return name; }
37         void set_local(bool);
38
39         void set_position(const Vector2 &);
40         const Vector2 &get_position() const { return pos; }
41
42         void set_active(bool);
43         bool get_active() const { return active; }
44         void add_activity(unsigned);
45         float get_activity() const { return activity.get_average(); }
46         float send_packet();
47
48         void tick(const Msp::Time::TimeDelta &);
49         void render() const;
50 };
51
52 #endif