OverSim
oversim Namespace Reference

Classes

class  Chord
 Chord overlay module. More...
class  ChordFingerTable
 Chord's finger table module. More...
struct  SuccessorListEntry
class  ChordSuccessorList
 Chord's successor list module. More...
class  Koorde
 Koorde overlay module. More...
class  Nice
 NICE overlay module. More...
class  NicePeerInfo

Typedefs

typedef std::multimap
< simtime_t, NodeHandle
Successors
typedef std::pair< NodeHandle,
Successors
FingerEntry
typedef std::pair< unsigned
int, double > 
HeartbeatEvaluator

Functions

 Define_Module (Chord)
 Define_Module (ChordFingerTable)
 Define_Module (ChordSuccessorList)
std::ostream & operator<< (std::ostream &os, const SuccessorListEntry &e)
 Define_Module (Koorde)
template<class BidIt >
bool next_combination (BidIt n_begin, BidIt n_end, BidIt r_begin, BidIt r_end)
template<class BidIt , class Prediate >
bool next_combination (BidIt n_begin, BidIt n_end, BidIt r_begin, BidIt r_end, Prediate Equal)
template<class BidIt >
bool prev_combination (BidIt n_begin, BidIt n_end, BidIt r_begin, BidIt r_end)
template<class BidIt , class Prediate >
bool prev_combination (BidIt n_begin, BidIt n_end, BidIt r_begin, BidIt r_end, Prediate Equal)
template<class RanIt , class Func >
void recursive_combination (RanIt nbegin, RanIt nend, int n_column, RanIt rbegin, RanIt rend, int r_column, int loop, Func func)
 Define_Module (Nice)
std::ostream & operator<< (std::ostream &os, NicePeerInfo &pi)

Variables

const char * clustercolors []
 Define colors for layers in visualization.
const char * clusterarrows []

Typedef Documentation

Definition at line 40 of file ChordFingerTable.h.

typedef std::pair<unsigned int, double> oversim::HeartbeatEvaluator

Definition at line 41 of file NicePeerInfo.h.

typedef std::multimap<simtime_t, NodeHandle> oversim::Successors

Definition at line 39 of file ChordFingerTable.h.

Function Documentation

oversim::Define_Module ( ChordSuccessorList  )
oversim::Define_Module ( Koorde  )
oversim::Define_Module ( ChordFingerTable  )
oversim::Define_Module ( Chord  )
oversim::Define_Module ( Nice  )
template<class BidIt >
bool oversim::next_combination ( BidIt  n_begin,
BidIt  n_end,
BidIt  r_begin,
BidIt  r_end 
)
inline

Definition at line 24 of file combination.h.

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

{
bool boolmarked=false;
BidIt r_marked;
BidIt n_it1=n_end;
--n_it1;
BidIt tmp_r_end=r_end;
--tmp_r_end;
for(BidIt r_it1=tmp_r_end; r_it1!=r_begin || r_it1==r_begin; --r_it1,--n_it1)
{
if(*r_it1==*n_it1 )
{
if(r_it1!=r_begin) //to ensure not at the start of r sequence
{
boolmarked=true;
r_marked=(--r_it1);
++r_it1;//add it back again
continue;
}
else // it means it is at the start the sequence, so return false
return false;
}
else //if(*r_it1!=*n_it1 )
{
//marked code
if(boolmarked==true)
{
//for loop to find which marked is in the first sequence
BidIt n_marked;//mark in first sequence
for (BidIt n_it2=n_begin;n_it2!=n_end;++n_it2)
if(*r_marked==*n_it2) {n_marked=n_it2;break;}
BidIt n_it3=++n_marked;
for (BidIt r_it2=r_marked;r_it2!=r_end;++r_it2,++n_it3)
{
*r_it2=*n_it3;
}
return true;
}
for(BidIt n_it4=n_begin; n_it4!=n_end; ++n_it4)
if(*r_it1==*n_it4)
{
*r_it1=*(++n_it4);
return true;
}
}
}
return true;//will never reach here
}
template<class BidIt , class Prediate >
bool oversim::next_combination ( BidIt  n_begin,
BidIt  n_end,
BidIt  r_begin,
BidIt  r_end,
Prediate  Equal 
)
inline

Definition at line 85 of file combination.h.

{
bool boolmarked=false;
BidIt r_marked;
BidIt n_it1=n_end;
--n_it1;
BidIt tmp_r_end=r_end;
--tmp_r_end;
for(BidIt r_it1=tmp_r_end; r_it1!=r_begin || r_it1==r_begin; --r_it1,--n_it1)
{
if( Equal( *r_it1, *n_it1) )
{
if(r_it1!=r_begin) //to ensure not at the start of r sequence
{
boolmarked=true;
r_marked=(--r_it1);
++r_it1;//add it back again
continue;
}
else // it means it is at the start the sequence, so return false
return false;
}
else //if(*r_it1!=*n_it1 )
{
//marked code
if(boolmarked==true)
{
//for loop to find which marked is in the first sequence
BidIt n_marked;//mark in first sequence
for (BidIt n_it2=n_begin;n_it2!=n_end;++n_it2)
if( Equal( *r_marked, *n_it2) ) {n_marked=n_it2;break;}
BidIt n_it3=++n_marked;
for (BidIt r_it2=r_marked;r_it2!=r_end;++r_it2,++n_it3)
{
*r_it2=*n_it3;
}
return true;
}
for(BidIt n_it4=n_begin; n_it4!=n_end; ++n_it4)
if( Equal(*r_it1, *n_it4) )
{
*r_it1=*(++n_it4);
return true;
}
}
}
return true;//will never reach here
}
std::ostream & oversim::operator<< ( std::ostream &  os,
const SuccessorListEntry &  e 
)

Definition at line 36 of file ChordSuccessorList.cc.

{
os << e.nodeHandle << " " << e.newEntry;
return os;
};
std::ostream& oversim::operator<< ( std::ostream &  os,
NicePeerInfo &  pi 
)

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;
}
template<class BidIt >
bool oversim::prev_combination ( BidIt  n_begin,
BidIt  n_end,
BidIt  r_begin,
BidIt  r_end 
)
inline

Definition at line 151 of file combination.h.

{
bool boolsame=false;
BidIt marked;//for r
BidIt r_marked;
BidIt n_marked;
BidIt tmp_n_end=n_end;
--tmp_n_end;
BidIt r_it1=r_end;
--r_it1;
for(BidIt n_it1=tmp_n_end; n_it1!=n_begin || n_it1==n_begin ; --n_it1)
{
if(*r_it1==*n_it1)
{
r_marked=r_it1;
n_marked=n_it1;
break;
}
}
BidIt n_it2=n_marked;
BidIt tmp_r_end=r_end;
--tmp_r_end;
for(BidIt r_it2=r_marked; r_it2!=r_begin || r_it2==r_begin; --r_it2,--n_it2)
{
if(*r_it2==*n_it2 )
{
if(r_it2==r_begin&& !(*r_it2==*n_begin) )
{
for(BidIt n_it3=n_begin;n_it3!=n_end;++n_it3)
{
if(*r_it2==*n_it3)
{
marked=r_it2;
*r_it2=*(--n_it3);
BidIt n_it4=n_end;
--n_it4;
for(BidIt r_it3=tmp_r_end; (r_it3!=r_begin || r_it3==r_begin) &&r_it3!=marked; --r_it3,--n_it4)
{
*r_it3=*n_it4;
}
return true;
}
}
}
else if(r_it2==r_begin&&*r_it2==*n_begin)
{
return false;//no more previous combination;
}
}
else //if(*r_it2!=*n_it2 )
{
++r_it2;
marked=r_it2;
for(BidIt n_it5=n_begin;n_it5!=n_end;++n_it5)
{
if(*r_it2==*n_it5)
{
*r_it2=*(--n_it5);
BidIt n_it6=n_end;
--n_it6;
for(BidIt r_it4=tmp_r_end; (r_it4!=r_begin || r_it4==r_begin) &&r_it4!=marked; --r_it4,--n_it6)
{
*r_it4=*n_it6;
}
return true;
}
}
}
}
return false;//Will never reach here, unless error
}
template<class BidIt , class Prediate >
bool oversim::prev_combination ( BidIt  n_begin,
BidIt  n_end,
BidIt  r_begin,
BidIt  r_end,
Prediate  Equal 
)
inline

Definition at line 239 of file combination.h.

{
bool boolsame=false;
BidIt marked;//for r
BidIt r_marked;
BidIt n_marked;
BidIt tmp_n_end=n_end;
--tmp_n_end;
BidIt r_it1=r_end;
--r_it1;
for(BidIt n_it1=tmp_n_end; n_it1!=n_begin || n_it1==n_begin ; --n_it1)
{
if( Equal(*r_it1, *n_it1) )
{
r_marked=r_it1;
n_marked=n_it1;
break;
}
}
BidIt n_it2=n_marked;
BidIt tmp_r_end=r_end;
--tmp_r_end;
for(BidIt r_it2=r_marked; r_it2!=r_begin || r_it2==r_begin; --r_it2,--n_it2)
{
if( Equal(*r_it2, *n_it2) )
{
if(r_it2==r_begin&& !Equal(*r_it2, *n_begin) )
{
for(BidIt n_it3=n_begin;n_it3!=n_end;++n_it3)
{
if(Equal(*r_it2, *n_it3))
{
marked=r_it2;
*r_it2=*(--n_it3);
BidIt n_it4=n_end;
--n_it4;
for(BidIt r_it3=tmp_r_end; (r_it3!=r_begin || r_it3==r_begin) &&r_it3!=marked; --r_it3,--n_it4)
{
*r_it3=*n_it4;
}
return true;
}
}
}
else if(r_it2==r_begin&&Equal(*r_it2, *n_begin))
{
return false;//no more previous combination;
}
}
else //if(*r_it2!=*n_it2 )
{
++r_it2;
marked=r_it2;
for(BidIt n_it5=n_begin;n_it5!=n_end;++n_it5)
{
if(Equal(*r_it2, *n_it5))
{
*r_it2=*(--n_it5);
BidIt n_it6=n_end;
--n_it6;
for(BidIt r_it4=tmp_r_end; (r_it4!=r_begin || r_it4==r_begin) &&r_it4!=marked; --r_it4,--n_it6)
{
*r_it4=*n_it6;
}
return true;
}
}
}
}
return false;//Will never reach here, unless error
}
template<class RanIt , class Func >
void oversim::recursive_combination ( RanIt  nbegin,
RanIt  nend,
int  n_column,
RanIt  rbegin,
RanIt  rend,
int  r_column,
int  loop,
Func  func 
)

Definition at line 331 of file combination.h.

{
int r_size=rend-rbegin;
int localloop=loop;
int local_n_column=n_column;
//A different combination is out
if(r_column>(r_size-1))
{
func(rbegin,rend);
return;
}
for(int i=0;i<=loop;++i)
{
RanIt it1=rbegin;
for(int cnt=0;cnt<r_column;++cnt)
{
++it1;
}
RanIt it2=nbegin;
for(int cnt2=0;cnt2<n_column+i;++cnt2)
{
++it2;
}
*it1=*it2;
++local_n_column;
recursive_combination(nbegin,nend,local_n_column,
rbegin,rend,r_column+1,localloop,func);
--localloop;
}
}

Variable Documentation

const char* oversim::clusterarrows[]
Initial value:
{ "m=m,50,50,50,50;ls=yellow,2",
"m=m,50,50,50,50;ls=magenta,3",
"m=m,50,50,50,50;ls=red,4",
"m=m,50,50,50,50;ls=orange,5",
"m=m,50,50,50,50;ls=green,6",
"m=m,50,50,50,50;ls=aquamarine,7",
"m=m,50,50,50,50;ls=cyan,8",
"m=m,50,50,50,50;ls=blue,9",
"m=m,50,50,50,50;ls=navy,10",
"m=m,50,50,50,50;ls=yellow,11"
}

Definition at line 53 of file Nice.cc.

Referenced by oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceJoinCluster(), oversim::Nice::handleNiceLeaderTransfer(), and oversim::Nice::updateVisualization().

const char* oversim::clustercolors[]
Initial value:
{ "yellow",
"magenta",
"red",
"orange",
"green",
"aquamarine",
"cyan",
"blue",
"navy",
"yellow"
}

Define colors for layers in visualization.

Definition at line 41 of file Nice.cc.

Referenced by oversim::Nice::changeState(), oversim::Nice::ClusterMerge(), oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceLeaderTransfer(), oversim::Nice::JoinCluster(), oversim::Nice::Remove(), and oversim::Nice::updateVisualization().