nlsr::RoutingTableCalculator Class Reference

#include <routing-table-calculator.hpp>

+ Inheritance diagram for nlsr::RoutingTableCalculator:
+ Collaboration diagram for nlsr::RoutingTableCalculator:

Public Member Functions

 RoutingTableCalculator (size_t nRouters)
 

Protected Member Functions

void adjustAdMatrix (int source, int link, double linkCost)
 Adjust a link cost in the adj. matrix. More...
 
void allocateAdjMatrix ()
 Allocate the space needed for the adj. matrix. More...
 
void allocateLinkCosts ()
 
void allocateLinks ()
 
void freeAdjMatrix ()
 
void freeLinks ()
 
void freeLinksCosts ()
 
void getLinksFromAdjMatrix (int *links, double *linkCosts, int source)
 Populates temp. variables with the link costs for some router. More...
 
int getNumOfLinkfromAdjMatrix (int sRouter)
 Returns how many links a router in the matrix has. More...
 
void initMatrix ()
 set NON_ADJACENT_COST i.e. -12345 to every cell of the matrix to ensure that the memory is safe. This is also to incorporate zero cost links More...
 
void makeAdjMatrix (const Lsdb &lsdb, Map &pMap)
 Constructs an adj. matrix to calculate with. More...
 
void setNoLink (int nl)
 
void writeAdjMatrixLog (const Map &map) const
 Writes a formated adjacent matrix to DEBUG log. More...
 

Protected Attributes

double ** adjMatrix
 
double * linkCosts
 
int * links
 
size_t m_nRouters
 
int vNoLink
 

Detailed Description

Definition at line 40 of file routing-table-calculator.hpp.

Constructor & Destructor Documentation

◆ RoutingTableCalculator()

nlsr::RoutingTableCalculator::RoutingTableCalculator ( size_t  nRouters)
inline

Definition at line 43 of file routing-table-calculator.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ adjustAdMatrix()

void nlsr::RoutingTableCalculator::adjustAdMatrix ( int  source,
int  link,
double  linkCost 
)
protected

Adjust a link cost in the adj. matrix.

Parameters
sourceThe source router whose adjacency to adjust.
linkThe adjacency of the source to adjust.
linkCostThe cost to change to.

Definition at line 160 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ allocateAdjMatrix()

void nlsr::RoutingTableCalculator::allocateAdjMatrix ( )
protected

Allocate the space needed for the adj. matrix.

Definition at line 44 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ allocateLinkCosts()

void nlsr::RoutingTableCalculator::allocateLinkCosts ( )
protected

Definition at line 217 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ allocateLinks()

void nlsr::RoutingTableCalculator::allocateLinks ( )
protected

Allocates an array large enough to hold multipath calculation temps.

Definition at line 211 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ freeAdjMatrix()

void nlsr::RoutingTableCalculator::freeAdjMatrix ( )
protected

Definition at line 202 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ freeLinks()

void nlsr::RoutingTableCalculator::freeLinks ( )
protected

Definition at line 223 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ freeLinksCosts()

void nlsr::RoutingTableCalculator::freeLinksCosts ( )
protected

Definition at line 228 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ getLinksFromAdjMatrix()

void nlsr::RoutingTableCalculator::getLinksFromAdjMatrix ( int *  links,
double *  linkCosts,
int  source 
)
protected

Populates temp. variables with the link costs for some router.

Parameters
sourceThe router whose values are to be adjusted.
linksAn integer pointer array for the link mappingNos.
linkCostsA double pointer array that stores the link costs.

Obtains a sparse list of adjacencies and link costs for some router. Since this is sparse, that means while generating these arrays, if there is no adjacency at i in the matrix, these temporary variables will not contain a NON_ADJACENT_COST (-12345) at i, but rather will contain the values for the next valid adjacency.

Definition at line 187 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ getNumOfLinkfromAdjMatrix()

int nlsr::RoutingTableCalculator::getNumOfLinkfromAdjMatrix ( int  sRouter)
protected

Returns how many links a router in the matrix has.

Parameters
sRouterThe router to count the links of.

Definition at line 174 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ initMatrix()

void nlsr::RoutingTableCalculator::initMatrix ( )
protected

set NON_ADJACENT_COST i.e. -12345 to every cell of the matrix to ensure that the memory is safe. This is also to incorporate zero cost links

Definition at line 54 of file routing-table-calculator.cpp.

+ Here is the caller graph for this function:

◆ makeAdjMatrix()

void nlsr::RoutingTableCalculator::makeAdjMatrix ( const Lsdb lsdb,
Map pMap 
)
protected

Constructs an adj. matrix to calculate with.

Parameters
lsdbReference to the Lsdb
pMapThe map to populate with the adj. data.

Definition at line 64 of file routing-table-calculator.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNoLink()

void nlsr::RoutingTableCalculator::setNoLink ( int  nl)
inlineprotected

Definition at line 115 of file routing-table-calculator.hpp.

+ Here is the caller graph for this function:

◆ writeAdjMatrixLog()

void nlsr::RoutingTableCalculator::writeAdjMatrixLog ( const Map map) const
protected

Writes a formated adjacent matrix to DEBUG log.

Parameters
mapThe map containing adjacent matrix data

Definition at line 122 of file routing-table-calculator.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ adjMatrix

double** nlsr::RoutingTableCalculator::adjMatrix
protected

Definition at line 121 of file routing-table-calculator.hpp.

◆ linkCosts

double* nlsr::RoutingTableCalculator::linkCosts
protected

Definition at line 126 of file routing-table-calculator.hpp.

◆ links

int* nlsr::RoutingTableCalculator::links
protected

Definition at line 125 of file routing-table-calculator.hpp.

◆ m_nRouters

size_t nlsr::RoutingTableCalculator::m_nRouters
protected

Definition at line 122 of file routing-table-calculator.hpp.

◆ vNoLink

int nlsr::RoutingTableCalculator::vNoLink
protected

Definition at line 124 of file routing-table-calculator.hpp.