Logo AND Algorithmique Numérique Distribuée

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