OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
GiaNode.cc
Go to the documentation of this file.
1
//
2
// Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3
//
4
// This program is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU General Public License
6
// as published by the Free Software Foundation; either version 2
7
// of the License, or (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
//
18
23
#include <
OverlayKey.h
>
24
25
#include "
GiaNode.h
"
26
27
28
// predefined gia node
29
const
GiaNode
GiaNode::UNSPECIFIED_NODE
;
30
31
GiaNode::GiaNode
()
32
{
33
//...
34
}
35
36
GiaNode::GiaNode
(
const
NodeHandle
& handle) :
NodeHandle
(handle)
37
{
38
//...
39
}
40
41
//TODO
42
GiaNode::GiaNode
(
const
NodeHandle
& handle,
double
cap,
int
degree) :
NodeHandle
(handle)
43
{
44
capacity
= cap;
45
}
46
47
GiaNode
&
GiaNode::operator=
(
const
NodeHandle
& handle)
48
{
49
ip
= handle.
getIp
();
50
port
= handle.
getPort
();
51
key
= handle.
getKey
();
52
capacity
= 0;
53
54
return
*
this
;
55
}
56
57
void
GiaNode::setCapacity
(
double
cap)
58
{
59
capacity
= cap;
60
}
61
62
double
GiaNode::getCapacity
()
const
63
{
64
return
capacity
;
65
}
66
67
std::ostream&
operator<<
(std::ostream& os,
const
GiaNode
& node)
68
{
69
if
(node.
ip
.isUnspecified() ==
true
&& node.
key
.
isUnspecified
() && node.
port
== -1) {
70
os <<
"<unspec>"
;
71
}
else
{
72
os << node.
ip
<<
":"
<< node.
port
<<
" "
73
<< node.
key
.
toString
() <<
" with capacity: "
74
<< node.
capacity
//<< " , degree: " << node.connectionDegree
75
//<< " , sentTokens: " << node.sentTokens << " , receivedTokens: " << node.receivedTokens;
76
;
77
}
78
return
os;
79
}
80
81
// bool GiaNode::operator==(const GiaNode& rhs) const
82
// {
83
// if(this->getNodeHandle() != rhs.getNodeHandle())
84
// return false;
85
// return true;
86
// }
87
88
// bool GiaNode::operator!=(const GiaNode& rhs) const
89
// {
90
// if(this->getNodeHandle() == rhs.getNodeHandle())
91
// return false;
92
// return true;
93
// }
src
overlay
gia
GiaNode.cc
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2