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

Private GIT Repository
Fix build with SimGrid 3.12.
[loba.git] / hostdata.h
1 #ifndef HOSTDATA_H
2 #define HOSTDATA_H
3
4 #include <string>
5 #include <vector>
6 #include <simgrid/msg.h>
7 #include "simgrid_features.h"
8
9 // Helper class that associates instances of itself with each host.
10 // Facilitate global operations on hosts, and retreiving of host name
11 // and mailboxes.
12 class hostdata {
13 public:
14     static void create();
15     static void destroy();
16     static size_t size()                        { return hosts.size(); }
17     static const hostdata& at(size_t i)         { return hosts[i];     }
18
19     hostdata(msg_host_t host);
20     ~hostdata();
21
22     const char* get_name() const                { return name;              }
23     const char* get_ctrl_mbox() const           { return ctrl_mbox.c_str(); }
24     const char* get_data_mbox() const           { return data_mbox.c_str(); }
25
26 private:
27     // static list of hostdata's, used by create/destroy
28     static std::vector<hostdata> hosts;
29
30     const char* name;
31     std::string ctrl_mbox;
32     std::string data_mbox;
33
34 };
35
36 #endif // !HOSTDATA_H
37
38 // Local variables:
39 // mode: c++
40 // End: