]> git.tdb.fi Git - netvis.git/blob - source/host.h
c41610fd25d4b786420b8ee030d98340020fe851
[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         bool is_local() const { return local; }
39
40         void set_position(const Vector2 &);
41         const Vector2 &get_position() const { return pos; }
42
43         void set_active(bool);
44         bool get_active() const { return active; }
45         void add_activity(unsigned);
46         float get_activity() const { return activity.get_average(); }
47         float send_packet();
48
49         void tick(const Msp::Time::TimeDelta &);
50         void render() const;
51 };
52
53 #endif