oversim::NicePeerInfo Class Reference

#include <NicePeerInfo.h>

List of all members.

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.

00031         : parent (_parent)
00032 {
00033 
00034     distance_estimation_start = -1;
00035     distance = -1;
00036     last_sent_HB = 1;
00037     last_recv_HB = 0;
00038     backHBPointer = false;
00039     last_HB_arrival = 0;
00040 
00041     activity = simTime().dbl();
00042 
00043     subclustermembers = 0;
00044 
00045     WATCH_MAP(distanceTable);
00046     WATCH(last_sent_HB);
00047     WATCH(last_recv_HB);
00048     WATCH(last_HB_arrival);
00049 
00050 } // NicePeerInfo

oversim::NicePeerInfo::~NicePeerInfo (  ) 

Definition at line 52 of file NicePeerInfo.cc.

00053 {
00054 
00055 } // ~NicePeerInfo


Member Function Documentation

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

Definition at line 197 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

00198 {
00199 
00200     double time = -1;
00201 
00202     if (backHB[0].first == seqNo)
00203         time = backHB[0].second;
00204     else if (backHB[1].first == seqNo)
00205         time = backHB[1].second;
00206 
00207     return time;
00208 
00209 } // get_backHB

unsigned int oversim::NicePeerInfo::get_backHB_seqNo ( bool  index  ) 

Definition at line 211 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

00212 {
00213 
00214     return backHB[index].first;
00215 
00216 } // get_backHB_seqNo

bool oversim::NicePeerInfo::get_backHBPointer (  ) 

Definition at line 175 of file NicePeerInfo.cc.

00176 {
00177 
00178     return backHBPointer;
00179 
00180 } // get_backHBPointer

double oversim::NicePeerInfo::get_distance (  ) 

Definition at line 78 of file NicePeerInfo.cc.

00079 {
00080 
00081     return distance;
00082 
00083 } // get_distance

double oversim::NicePeerInfo::get_last_HB_arrival (  ) 

Definition at line 160 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

00161 {
00162 
00163     return last_HB_arrival;
00164 
00165 } // get_last_HB_arrival

unsigned int oversim::NicePeerInfo::get_last_recv_HB (  ) 

Definition at line 146 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

00147 {
00148 
00149     return last_recv_HB;
00150 
00151 } // get_last_recv_HB

unsigned int oversim::NicePeerInfo::get_last_sent_HB (  ) 

Definition at line 132 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

00133 {
00134 
00135     return last_sent_HB;
00136 
00137 } // get_last_sent_HB

double oversim::NicePeerInfo::getActivity (  ) 

Definition at line 227 of file NicePeerInfo.cc.

Referenced by oversim::operator<<().

00228 {
00229 
00230     return activity;
00231 
00232 } // getActivity

double oversim::NicePeerInfo::getDES (  ) 

Definition at line 64 of file NicePeerInfo.cc.

00065 {
00066 
00067     return distance_estimation_start;
00068 
00069 } // getDES

double oversim::NicePeerInfo::getDistanceTo ( TransportAddress  member  ) 

Definition at line 110 of file NicePeerInfo.cc.

00111 {
00112 
00113     //std::cout << "getDistanceTo " << member.getAddress() << "..." << endl;
00114     //get member out of map
00115     std::map<TransportAddress, double>::iterator it = distanceTable.find(member);
00116 
00117     if (it != distanceTable.end()) {
00118 
00119         //std::cout << "is in distanceTable" << endl;
00120         return it->second;
00121 
00122     } else {
00123 
00124         //std::cout << "is NOT in distanceTable" << endl;
00125         return -1;
00126 
00127     }
00128 
00129 
00130 } // getDistanceTo

cMessage * oversim::NicePeerInfo::getHbTimer (  ) 

Definition at line 85 of file NicePeerInfo.cc.

00086 {
00087 
00088     return hbTimer;
00089 
00090 } // startHeartbeatTimeout

unsigned int oversim::NicePeerInfo::getSubClusterMembers (  ) 

Definition at line 243 of file NicePeerInfo.cc.

00244 {
00245 
00246     return subclustermembers;
00247 
00248 }

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

Definition at line 189 of file NicePeerInfo.cc.

00190 {
00191 
00192     backHB[backHBPointer].first = seqNo;
00193     backHB[backHBPointer].second = time;
00194 
00195 } // set_backHB

void oversim::NicePeerInfo::set_backHBPointer ( bool  _backHBPointer  ) 

Definition at line 182 of file NicePeerInfo.cc.

00183 {
00184 
00185     backHBPointer = _backHBPointer;
00186 
00187 } // set_backHBPointer

void oversim::NicePeerInfo::set_distance ( double  value  ) 

Definition at line 71 of file NicePeerInfo.cc.

00072 {
00073 
00074     distance = value;
00075 
00076 } // set_distance

void oversim::NicePeerInfo::set_distance_estimation_start ( double  value  ) 

Definition at line 57 of file NicePeerInfo.cc.

00058 {
00059 
00060     distance_estimation_start = value;
00061 
00062 } // set_distance_estimation_start

void oversim::NicePeerInfo::set_last_HB_arrival ( double  arrival  ) 

Definition at line 168 of file NicePeerInfo.cc.

00169 {
00170 
00171     last_HB_arrival = arrival;
00172 
00173 } // set_last_HB_arrival

void oversim::NicePeerInfo::set_last_recv_HB ( unsigned int  seqNo  ) 

Definition at line 153 of file NicePeerInfo.cc.

00154 {
00155 
00156     last_recv_HB = seqNo;
00157 
00158 } // set_last_recv_HB

void oversim::NicePeerInfo::set_last_sent_HB ( unsigned int  seqNo  ) 

Definition at line 139 of file NicePeerInfo.cc.

00140 {
00141 
00142     last_sent_HB = seqNo;
00143 
00144 } // set_last_sent_HB

void oversim::NicePeerInfo::setSubClusterMembers ( unsigned int  members  ) 

Definition at line 235 of file NicePeerInfo.cc.

00236 {
00237 
00238     subclustermembers = members;
00239 
00240 }

void oversim::NicePeerInfo::startHeartbeatTimeout (  ) 
void oversim::NicePeerInfo::touch (  ) 

Definition at line 219 of file NicePeerInfo.cc.

00220 {
00221 
00222     activity = simTime().dbl();
00223 
00224 } // touch

void oversim::NicePeerInfo::updateDistance ( TransportAddress  member,
double  distance 
)

Definition at line 92 of file NicePeerInfo.cc.

00093 {
00094     //get member out of map
00095     std::map<TransportAddress, double>::iterator it = distanceTable.find(member);
00096 
00097     if (it != distanceTable.end()) {
00098 
00099         it->second = distance;
00100 
00101     } else {
00102 
00103         distanceTable.insert(std::make_pair(member, distance));
00104 
00105     }
00106 
00107 
00108 } // updateDistance


Friends And Related Function Documentation

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

Definition at line 251 of file NicePeerInfo.cc.

00252 {
00253     os << "distance: " << pi.distance << endl;
00254     os << "des: " << pi.distance_estimation_start << endl;
00255     os << "last_rcv: " << pi.get_last_recv_HB() << endl;
00256     os << "last_sent: " << pi.get_last_sent_HB() << endl;
00257     os << "last_HB: " << pi.get_last_HB_arrival() << endl;
00258     os << "backHB[0].seqNo: " << pi.get_backHB_seqNo(0) << endl;
00259     os << "backHB[0].time: " << pi.get_backHB(pi.get_backHB_seqNo(0)) << endl;
00260     os << "backHB[1].seqNo: " << pi.get_backHB_seqNo(1) << endl;
00261     os << "backHB[1].time: " << pi.get_backHB(pi.get_backHB_seqNo(1)) << endl;
00262     os << "activity: " << pi.getActivity() << endl;
00263 
00264     std::map<TransportAddress, double>::iterator it = pi.distanceTable.begin();
00265 
00266     while (it != pi.distanceTable.end()) {
00267         os << it->first << " : " << it->second << endl;
00268         it++;
00269     }
00270 
00271     return os;
00272 }


Member Data Documentation

Definition at line 97 of file NicePeerInfo.h.

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

Definition at line 101 of file NicePeerInfo.h.

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

Definition at line 102 of file NicePeerInfo.h.

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

Definition at line 93 of file NicePeerInfo.h.

Referenced by get_distance(), NicePeerInfo(), oversim::operator<<(), and set_distance().

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().

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().

Definition at line 91 of file NicePeerInfo.h.

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:
Generated on Wed May 26 16:21:20 2010 for OverSim by  doxygen 1.6.3