-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathTable.cpp
More file actions
executable file
·59 lines (50 loc) · 1.3 KB
/
Copy pathTable.cpp
File metadata and controls
executable file
·59 lines (50 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Table.cpp: implementation of the CTable class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MANET.h"
#include "Table.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CTable::CTable(CString destination)
{
this->Destination=destination;
//////////////////////////////
this->Index=0; //this index specifies which path is the current path
this->Round=0; //number of rounds that all path checked
//this->SeqNum=0; //Sequence Number of the destination
}
CTable::~CTable()
{
}
void CTable::SetPathByPacket(CPacket *p)
{
path=new CPath(p->Uploader,p->TickCount,p->HopCount,p->SizeCount,p->SeqNum);
Paths.Add(path);
}
void CTable::SetPath(CString uploader, unsigned tickcount,unsigned hopcount,unsigned sizecount)
{
path=new CPath(uploader,tickcount,hopcount,sizecount);
Paths.Add(path);
}
int CTable::ChangePath()//CPacket *p)
{
if(PathSize=Paths.GetSize())
{
Index++;
if(Index==(unsigned)Paths.GetSize())
{
Round++;
Index=0;
}
return 1;
}
else
return 0;
}