OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
GiaTokenFactory.h
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
24
#ifndef __GIATOKENFACTORY_H_
25
#define __GIATOKENFACTORY_H_
26
27
28
#include <vector>
29
#include <queue>
30
31
#include <omnetpp.h>
32
33
#include <
InitStages.h
>
34
35
class
Gia
;
36
#include "
GiaNeighbors.h
"
37
38
45
class
GiaTokenFactory
:
public
cSimpleModule
46
{
47
public
:
48
// OMNeT++ methodes
52
virtual
int
numInitStages
()
const
53
{
54
return
MAX_STAGE_OVERLAY
+ 1;
55
}
56
61
virtual
void
initialize
(
int
stage );
62
67
virtual
void
handleMessages
( cMessage* msg );
68
69
// class methodes
74
virtual
void
setNeighbors
(
GiaNeighbors
*
neighbors
);
75
80
void
setMaxHopCount
( uint32_t
maxHopCount
);
81
85
virtual
void
grantToken
();
86
87
protected
:
88
89
Gia
*
gia
;
90
91
// sort rules for priority queue
92
class
tokenCompareGiaNode
:
public
std::binary_function<FullGiaNodeInfo, FullGiaNodeInfo, FullGiaNodeInfo>
93
{
94
public
:
95
bool
operator()
(
const
FullGiaNodeInfo
& x,
const
FullGiaNodeInfo
& y);
96
};
97
98
typedef
std::priority_queue<FullGiaNodeInfo, std::vector<FullGiaNodeInfo>,
tokenCompareGiaNode
>
TokenQueue
;
99
TokenQueue
tokenQueue
;
100
GiaNeighbors
*
neighbors
;
101
std::vector<GiaNode>
tokenQueueVector
;
102
uint32_t
maxHopCount
;
104
// statistics
105
uint32_t
stat_sentTokens
;
110
void
createPriorityQueue
();
111
115
void
clearTokenQueue
();
116
120
void
updateQueueVector
();
121
125
void
updateSentTokens
();
126
130
void
sendToken
();
131
};
132
133
#endif
src
overlay
gia
GiaTokenFactory.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2