]> git.tdb.fi Git - netvis.git/blobdiff - source/host.h
Handle addresses in a more generic way
[netvis.git] / source / host.h
index b600dea04e3d9d315c865fbaabb3df7d69fc5e5b..928d7aaf79566ebebf5bdccae794fd5d1fff106a 100644 (file)
@@ -11,6 +11,8 @@ Distributed unter the GPL
 #include <map>
 #include <string>
 #include <msp/time/timedelta.h>
+#include "activity.h"
+#include "address.h"
 #include "vector2.h"
 
 class NetVis;
@@ -19,21 +21,23 @@ class Host
 {
 private:
        NetVis &netvis;
-       unsigned addr;
+       Address addr;
        std::string name;
        std::string short_name;
        bool local;
        Vector2 pos;
        bool active;
-       float activity;
+       Activity activity;
        float throttle;
 
 public:
-       Host(NetVis &, unsigned);
-       unsigned get_address() const { return addr; }
+       Host(NetVis &, const Address &);
+
+       const Address &get_address() const { return addr; }
        void set_name(const std::string &);
        const std::string &get_name() const { return name; }
        void set_local(bool);
+       bool is_local() const { return local; }
 
        void set_position(const Vector2 &);
        const Vector2 &get_position() const { return pos; }
@@ -41,7 +45,7 @@ public:
        void set_active(bool);
        bool get_active() const { return active; }
        void add_activity(unsigned);
-       float get_activity() const { return activity; }
+       float get_activity() const { return activity.get_average(); }
        float send_packet();
 
        void tick(const Msp::Time::TimeDelta &);