blob: fecc6bcecfc4ff6421e3f4b5593827259bd4a54a [file] [log] [blame]
akmhoque79d355f2014-02-04 15:11:16 -06001#include <iostream>
2#include "nlsr_lsdb.hpp"
3#include "nlsr_rtc.hpp"
4#include "nlsr_map.hpp"
5#include "nlsr_lsa.hpp"
6#include "nlsr.hpp"
7
8using namespace std;
9
10void
11RoutingTableCalculator::allocateAdjMatrix()
12{
13 adjMatrix = new double*[numOfRouter];
14 for(int i = 0; i < numOfRouter; ++i)
15 {
16 adjMatrix[i] = new double[numOfRouter];
17 }
18}
19
20void
21RoutingTableCalculator::makeAdjMatrix(nlsr& pnlsr, Map pMap)
22{
23 std::list<AdjLsa> adjLsdb=pnlsr.getLsdb().getAdjLsdb();
24 for( std::list<AdjLsa>::iterator it=adjLsdb.begin();
25 it!= adjLsdb.end() ; it++)
26 {
27 string linkStartRouter=(*it).getOrigRouter();
28 int row=pMap.getMappingNoByRouterName(linkStartRouter);
29 std::list<Adjacent> adl=(*it).getAdl().getAdjList();
30 for( std::list<Adjacent>::iterator itAdl=adl.begin();
31 itAdl!= adl.end() ; itAdl++)
32 {
33 string linkEndRouter=(*itAdl).getAdjacentName();
34 int col=pMap.getMappingNoByRouterName(linkEndRouter);
35 double cost=(*itAdl).getLinkCost();
36 if ( (row >= 0 && row<numOfRouter) && (col >= 0 && col<numOfRouter) )
37 {
38 adjMatrix[row][col]=cost;
39 }
40 }
41
42 }
43}
44
45void
46RoutingTableCalculator::freeAdjMatrix()
47{
48 for(int i = 0; i < numOfRouter; ++i)
49 {
50 delete [] adjMatrix[i];
51 }
52 delete [] adjMatrix;
53}
54
55void
56LinkStateRoutingTableCalculator::calculatePath(Map& pMap, RoutingTable& rt, nlsr& pnlsr)
57{
58}
59
60void
61HypRoutingTableCalculator::calculatePath(Map& pMap, RoutingTable& rt, nlsr& pnlsr)
62{
63}
64
65void
66HypDryRoutingTableCalculator::calculatePath(Map& pMap, RoutingTable& rt, nlsr& pnlsr)
67{
68}
69