]> AND Private Git Repository - loba.git/blobdiff - hostdata.h
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Replace NULL with nullptr.
[loba.git] / hostdata.h
index 82e133fade684cfe00cee98aafee0a315e47a0e3..2c5379a37540831bbdc8fc7a6cce391f0238267b 100644 (file)
@@ -2,28 +2,35 @@
 #define HOSTDATA_H
 
 #include <string>
-#include <msg/msg.h>
+#include <vector>
+#include <simgrid/msg.h>
+#include "simgrid_features.h"
 
+// Helper class that associates instances of itself with each host.
+// Facilitate global operations on hosts, and retreiving of host name
+// and mailboxes.
 class hostdata {
 public:
     static void create();
     static void destroy();
+    static size_t size()                        { return hosts.size(); }
+    static const hostdata& at(size_t i)         { return hosts[i];     }
 
-    hostdata(m_host_t host);
+    hostdata(msg_host_t host);
     ~hostdata();
 
-    const char* get_name() const                { return name; }
+    const char* get_name() const                { return name;              }
     const char* get_ctrl_mbox() const           { return ctrl_mbox.c_str(); }
     const char* get_data_mbox() const           { return data_mbox.c_str(); }
 
 private:
-    // linked list of hostdata's, used by create/destroy
-    static hostdata* instances;
-    hostdata* next;
+    // static list of hostdata's, used by create/destroy
+    static std::vector<hostdata> hosts;
 
     const char* name;
     std::string ctrl_mbox;
     std::string data_mbox;
+
 };
 
 #endif // !HOSTDATA_H