OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
NiceCluster.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2009 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
24
#ifndef __NICECLUSTER_H_
25
#define __NICECLUSTER_H_
26
27
#include <
BaseOverlay.h
>
28
#include <omnetpp.h>
29
30
class
NiceCluster
31
{
32
33
private
:
34
35
/* set of cluster members */
36
std::set<TransportAddress>
cluster
;
37
38
/* leader of the cluster */
39
TransportAddress
leader
;
40
41
/* last time of leader transfer */
42
simtime_t
lastLT
;
43
44
/* if we are reasonably sure that the cluster leader is really the above node */
45
bool
leaderConfirmed
;
46
47
/* how many times we've sent leader heartbeats to the nodes in this cluster */
48
int
leaderHeartbeatsSent
;
49
50
typedef
std::set<TransportAddress>::const_iterator
ConstClusterIterator
;
51
typedef
std::set<TransportAddress>::iterator
ClusterIterator
;
52
53
public
:
54
55
NiceCluster
();
56
60
void
add
(
const
TransportAddress
& member);
61
67
void
clear
();
68
72
bool
contains
(
const
TransportAddress
& member );
73
77
int
getSize
();
78
82
const
TransportAddress
&
get
(
int
i );
83
88
void
remove
(
const
TransportAddress
& member);
89
96
void
setLeader
(
const
TransportAddress
&
leader
);
97
101
const
TransportAddress
&
getLeader
();
102
106
std::set<TransportAddress>::const_iterator
begin
()
const
;
107
111
std::set<TransportAddress>::const_iterator
end
()
const
;
112
113
simtime_t
getLastLT
();
114
void
setLastLT
();
115
120
bool
isLeaderConfirmed
();
121
125
void
confirmLeader
();
126
127
int
getLeaderHeartbeatsSent
();
128
129
void
setLeaderHeartbeatsSent
(
int
heartbeats);
130
131
};
// NiceCluster
132
133
#endif
/* _NICECLUSTER_H_ */
src
overlay
nice
NiceCluster.h
Generated on Fri Dec 7 2012 13:37:53 for OverSim by
1.8.1.2