OverSim
oversim::NicePeerInfo Class Reference

#include <NicePeerInfo.h>

Public Member Functions

 NicePeerInfo (Nice *_parent)
 ~NicePeerInfo ()
void set_distance_estimation_start (double value)
double getDES ()
void set_distance (double value)
double get_distance ()
void startHeartbeatTimeout ()
cMessage * getHbTimer ()
void updateDistance (TransportAddress member, double distance)
double getDistanceTo (TransportAddress member)
unsigned int get_last_sent_HB ()
void set_last_sent_HB (unsigned int seqNo)
unsigned int get_last_recv_HB ()
void set_last_recv_HB (unsigned int seqNo)
double get_last_HB_arrival ()
void set_last_HB_arrival (double arrival)
bool get_backHBPointer ()
void set_backHBPointer (bool _backHBPointer)
void set_backHB (bool backHBPointer, unsigned int seqNo, double time)
double get_backHB (unsigned int seqNo)
unsigned int get_backHB_seqNo (bool index)
void touch ()
double getActivity ()
void setSubClusterMembers (unsigned int members)
unsigned int getSubClusterMembers ()

Private Attributes

Niceparent
double distance_estimation_start
double distance
cMessage * hbTimer
std::map< TransportAddress,
double > 
distanceTable
double activity
unsigned int subclustermembers
HeartbeatEvaluator backHB [2]
bool backHBPointer
unsigned int last_sent_HB
unsigned int last_recv_HB
double last_HB_arrival

Friends

std::ostream & operator<< (std::ostream &os, NicePeerInfo &pi)

Detailed Description

Definition at line 43 of file NicePeerInfo.h.

Constructor & Destructor Documentation

oversim::NicePeerInfo::NicePeerInfo ( Nice _parent)

Definition at line 30 of file NicePeerInfo.cc.

: parent (_parent)
{
distance = -1;
backHBPointer = false;
activity = simTime().dbl();
WATCH_MAP(distanceTable);
WATCH(last_sent_HB);
WATCH(last_recv_HB);
} // NicePeerInfo
oversim::NicePeerInfo::~NicePeerInfo ( )

Definition at line 52 of file NicePeerInfo.cc.

{
} // ~NicePeerInfo

Member Function Documentation

double oversim::NicePeerInfo::get_backHB ( unsigned int  seqNo)

Definition at line 197 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

{
double time = -1;
if (backHB[0].first == seqNo)
time = backHB[0].second;
else if (backHB[1].first == seqNo)
time = backHB[1].second;
return time;
} // get_backHB
unsigned int oversim::NicePeerInfo::get_backHB_seqNo ( bool  index)

Definition at line 211 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

{
return backHB[index].first;
} // get_backHB_seqNo
bool oversim::NicePeerInfo::get_backHBPointer ( )

Definition at line 175 of file NicePeerInfo.cc.

{
return backHBPointer;
} // get_backHBPointer
double oversim::NicePeerInfo::get_distance ( )

Definition at line 78 of file NicePeerInfo.cc.

{
return distance;
} // get_distance
double oversim::NicePeerInfo::get_last_HB_arrival ( )

Definition at line 160 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

{
} // get_last_HB_arrival
unsigned int oversim::NicePeerInfo::get_last_recv_HB ( )

Definition at line 146 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

{
return last_recv_HB;
} // get_last_recv_HB
unsigned int oversim::NicePeerInfo::get_last_sent_HB ( )

Definition at line 132 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

{
return last_sent_HB;
} // get_last_sent_HB
double oversim::NicePeerInfo::getActivity ( )

Definition at line 227 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

{
return activity;
} // getActivity
double oversim::NicePeerInfo::getDES ( )

Definition at line 64 of file NicePeerInfo.cc.

{
} // getDES
double oversim::NicePeerInfo::getDistanceTo ( TransportAddress  member)

Definition at line 110 of file NicePeerInfo.cc.

{
//std::cout << "getDistanceTo " << member.getIp() << "..." << endl;
//get member out of map
std::map<TransportAddress, double>::iterator it = distanceTable.find(member);
if (it != distanceTable.end()) {
//std::cout << "is in distanceTable" << endl;
return it->second;
} else {
//std::cout << "is NOT in distanceTable" << endl;
return -1;
}
} // getDistanceTo
cMessage * oversim::NicePeerInfo::getHbTimer ( )

Definition at line 85 of file NicePeerInfo.cc.

{
return hbTimer;
} // startHeartbeatTimeout
unsigned int oversim::NicePeerInfo::getSubClusterMembers ( )

Definition at line 243 of file NicePeerInfo.cc.

{
}
void oversim::NicePeerInfo::set_backHB ( bool  backHBPointer,
unsigned int  seqNo,
double  time 
)

Definition at line 189 of file NicePeerInfo.cc.

{
backHB[backHBPointer].first = seqNo;
backHB[backHBPointer].second = time;
} // set_backHB
void oversim::NicePeerInfo::set_backHBPointer ( bool  _backHBPointer)

Definition at line 182 of file NicePeerInfo.cc.

{
backHBPointer = _backHBPointer;
} // set_backHBPointer
void oversim::NicePeerInfo::set_distance ( double  value)

Definition at line 71 of file NicePeerInfo.cc.

Referenced by oversim::Nice::initializeOverlay().

{
distance = value;
} // set_distance
void oversim::NicePeerInfo::set_distance_estimation_start ( double  value)

Definition at line 57 of file NicePeerInfo.cc.

{
} // set_distance_estimation_start
void oversim::NicePeerInfo::set_last_HB_arrival ( double  arrival)
void oversim::NicePeerInfo::set_last_recv_HB ( unsigned int  seqNo)

Definition at line 153 of file NicePeerInfo.cc.

{
last_recv_HB = seqNo;
} // set_last_recv_HB
void oversim::NicePeerInfo::set_last_sent_HB ( unsigned int  seqNo)

Definition at line 139 of file NicePeerInfo.cc.

{
last_sent_HB = seqNo;
} // set_last_sent_HB
void oversim::NicePeerInfo::setSubClusterMembers ( unsigned int  members)

Definition at line 235 of file NicePeerInfo.cc.

{
subclustermembers = members;
}
void oversim::NicePeerInfo::startHeartbeatTimeout ( )
void oversim::NicePeerInfo::touch ( )

Definition at line 219 of file NicePeerInfo.cc.

{
activity = simTime().dbl();
} // touch
void oversim::NicePeerInfo::updateDistance ( TransportAddress  member,
double  distance 
)

Definition at line 92 of file NicePeerInfo.cc.

{
//get member out of map
std::map<TransportAddress, double>::iterator it = distanceTable.find(member);
if (it != distanceTable.end()) {
it->second = distance;
} else {
distanceTable.insert(std::make_pair(member, distance));
}
} // updateDistance

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
NicePeerInfo pi 
)
friend

Definition at line 251 of file NicePeerInfo.cc.

{
os << "distance: " << pi.distance << endl;
os << "des: " << pi.distance_estimation_start << endl;
os << "last_rcv: " << pi.get_last_recv_HB() << endl;
os << "last_sent: " << pi.get_last_sent_HB() << endl;
os << "last_HB: " << pi.get_last_HB_arrival() << endl;
os << "backHB[0].seqNo: " << pi.get_backHB_seqNo(0) << endl;
os << "backHB[0].time: " << pi.get_backHB(pi.get_backHB_seqNo(0)) << endl;
os << "backHB[1].seqNo: " << pi.get_backHB_seqNo(1) << endl;
os << "backHB[1].time: " << pi.get_backHB(pi.get_backHB_seqNo(1)) << endl;
os << "activity: " << pi.getActivity() << endl;
std::map<TransportAddress, double>::iterator it = pi.distanceTable.begin();
while (it != pi.distanceTable.end()) {
os << it->first << " : " << it->second << endl;
it++;
}
return os;
}

Member Data Documentation

double oversim::NicePeerInfo::activity
private

Definition at line 97 of file NicePeerInfo.h.

Referenced by getActivity(), NicePeerInfo(), and touch().

HeartbeatEvaluator oversim::NicePeerInfo::backHB[2]
private

Definition at line 101 of file NicePeerInfo.h.

Referenced by get_backHB(), get_backHB_seqNo(), and set_backHB().

bool oversim::NicePeerInfo::backHBPointer
private

Definition at line 102 of file NicePeerInfo.h.

Referenced by get_backHBPointer(), NicePeerInfo(), set_backHB(), and set_backHBPointer().

double oversim::NicePeerInfo::distance
private
double oversim::NicePeerInfo::distance_estimation_start
private
std::map<TransportAddress, double> oversim::NicePeerInfo::distanceTable
private

Definition at line 95 of file NicePeerInfo.h.

Referenced by getDistanceTo(), NicePeerInfo(), oversim::operator<<(), and updateDistance().

cMessage* oversim::NicePeerInfo::hbTimer
private

Definition at line 94 of file NicePeerInfo.h.

Referenced by getHbTimer().

double oversim::NicePeerInfo::last_HB_arrival
private

Definition at line 106 of file NicePeerInfo.h.

Referenced by get_last_HB_arrival(), NicePeerInfo(), and set_last_HB_arrival().

unsigned int oversim::NicePeerInfo::last_recv_HB
private

Definition at line 105 of file NicePeerInfo.h.

Referenced by get_last_recv_HB(), NicePeerInfo(), and set_last_recv_HB().

unsigned int oversim::NicePeerInfo::last_sent_HB
private

Definition at line 104 of file NicePeerInfo.h.

Referenced by get_last_sent_HB(), NicePeerInfo(), and set_last_sent_HB().

Nice* oversim::NicePeerInfo::parent
private

Definition at line 91 of file NicePeerInfo.h.

unsigned int oversim::NicePeerInfo::subclustermembers
private

Definition at line 99 of file NicePeerInfo.h.

Referenced by getSubClusterMembers(), NicePeerInfo(), and setSubClusterMembers().


The documentation for this class was generated from the following files: