Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add a test trying to access the properties of a remote host -- it works
[simgrid.git] / src / surf / gtnets / gtnets_topology.h
1 /* $ID$ */
2
3 /* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9
10 #ifndef _GTNETS_TOPOLOGY_H
11 #define _GTNETS_TOPOLOGY_H
12
13 #include <map>
14 #include <vector>
15 #include <set>
16 #include <iostream>
17
18 using namespace std;
19
20 class GTNETS_Link;
21
22 class GTNETS_Node {
23
24 public:
25   GTNETS_Node(int);
26    GTNETS_Node(const GTNETS_Node & node);
27   ~GTNETS_Node();
28
29   int add_host(int);
30   int add_router(int);
31   int id() {
32     return ID_;
33   };
34   bool is_router();
35   bool include(int);
36   void print_hosts();
37
38 private:
39   int ID_;
40   int is_router_;
41   set < int >hosts_;            //simgrid hosts
42 };
43
44 class GTNETS_Link {
45
46 public:
47   GTNETS_Link();
48   GTNETS_Link(int id);
49    GTNETS_Link(const GTNETS_Link &);
50   ~GTNETS_Link();
51
52   GTNETS_Node *src_node();
53   GTNETS_Node *dst_node();
54   int peer_node(int);
55   int id() {
56     return ID_;
57   };
58   void print_link_status();
59   int add_src(GTNETS_Node *);
60   int add_dst(GTNETS_Node *);
61   bool route_exists();
62
63 private:
64   int ID_;
65   GTNETS_Node *src_node_;
66   GTNETS_Node *dst_node_;
67
68 };
69
70 // To create a topology:
71 // 1. add links
72 // 2. add routers
73 // 3. add onehop links
74 class GTNETS_Topology {
75 public:
76   GTNETS_Topology();
77   ~GTNETS_Topology();
78
79   bool is_router(int id);
80   int peer_node_id(int linkid, int cur_id);
81   int add_link(int id);
82   int add_router(int id);
83   int add_onehop_route(int src, int dst, int link);
84
85   int nodeid_from_hostid(int);
86   int link_size();
87   int node_size();
88   void print_topology();
89   const vector < GTNETS_Node * >&nodes();
90   const map < int, GTNETS_Link * >&links();
91
92 private:
93
94   int nodeID_;
95    map < int, GTNETS_Link * >links_;
96    vector < GTNETS_Node * >nodes_;
97
98    map < int, int >hosts_;      //hostid->nodeid
99
100    set < int >routers_;
101 };
102
103 #endif