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

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