OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
OverSim
OverSim API Reference
GPL
Todo List
Namespaces
Classes
Files
File List
AbstractLookup.h
AbstractSendStrategy.cc
AbstractSendStrategy.h
AccessNet.cc
AccessNet.h
ALMTest.cc
ALMTest.h
ALMTestTracedMessage_m.h
apptunoutscheduler.cc
apptunoutscheduler.h
AreaDataContainer.cc
AreaDataContainer.h
Bamboo.cc
Bamboo.h
base64.h
BaseApp.cc
BaseApp.h
BaseLocation.h
BaseOverlay.cc
BaseOverlay.h
BasePastry.cc
BasePastry.h
BaseRpc.cc
BaseRpc.h
BaseTcpSupport.cc
BaseTcpSupport.h
BinaryValue.cc
BinaryValue.h
BootstrapList.cc
BootstrapList.h
BootstrapListAccess.h
BootstrapNodeHandle.h
BoundingBox2D.cc
BoundingBox2D.h
Broose.cc
Broose.h
BrooseBucket.cc
BrooseBucket.h
BrooseHandle.cc
BrooseHandle.h
BrooseMessage_m.h
CBR-DHT.cc
CBR-DHT.h
CBR-DHTMessage_m.h
Chord.cc
Chord.h
ChordFingerTable.cc
ChordFingerTable.h
ChordMessage_m.h
ChordSuccessorList.cc
ChordSuccessorList.h
Churn_m.h
ChurnGenerator.cc
ChurnGenerator.h
ChurnGeneratorAccess.h
cnetcommbuffer.cc
cnetcommbuffer.h
combination.h
CommonMessages_m.h
Comparator.h
ConnectivityProbe.cc
ConnectivityProbe.h
ConnectivityProbeApp.cc
ConnectivityProbeApp.h
ConnectivityProbeQuon.cc
ConnectivityProbeQuon.h
ConnectReaSE.cc
ConnectReaSE.h
CoordBasedRouting.cc
CoordBasedRouting.h
CoordBasedRoutingAccess.h
CoordDataContainer.cc
CoordDataContainer.h
CoordinateSystem.cc
CoordinateSystem.h
CoordMessages_m.h
CryptoModule.cc
CryptoModule.h
DHT.cc
DHT.h
DHTDataStorage.cc
DHTDataStorage.h
DHTMessage_m.h
DHTTestApp.cc
DHTTestApp.h
DHTTestAppMessages_m.h
DiscoveryMode.cc
DiscoveryMode.h
DiscoveryMode_m.h
ExtAPIMessages_m.h
ExtTCPSocketMap.cc
ExtTCPSocketMap.h
FinisherModule.cc
FinisherModule.h
GenericPacketParser.cc
GenericPacketParser.h
Gia.cc
Gia.h
GiaKeyList.cc
GiaKeyList.h
GiaKeyListModule.cc
GiaKeyListModule.h
GiaMessage_m.h
GiaMessageBookkeeping.cc
GiaMessageBookkeeping.h
GiaNeighborCandidateList.cc
GiaNeighborCandidateList.h
GiaNeighbors.cc
GiaNeighbors.h
GiaNode.cc
GiaNode.h
GIASearchApp.cc
GIASearchApp.h
GiaTokenFactory.cc
GiaTokenFactory.h
GlobalCoordinator.cc
GlobalCoordinator.h
GlobalDhtTestMap.cc
GlobalDhtTestMap.h
GlobalNodeList.cc
GlobalNodeList.h
GlobalNodeListAccess.h
GlobalParameters.cc
GlobalParameters.h
GlobalParametersAccess.h
GlobalStatistics.cc
GlobalStatistics.h
GlobalStatisticsAccess.h
GlobalTraceManager.cc
GlobalTraceManager.h
GlobalTraceManager_m.h
GlobalViewBuilder.cc
GlobalViewBuilder.h
greatGathering.cc
greatGathering.h
groupRoaming.cc
groupRoaming.h
HashFunc.h
hashWatch.h
hotspotRoaming.cc
hotspotRoaming.h
I3.cc
I3.h
I3Anycast.cc
I3BaseApp.cc
I3BaseApp.h
I3Composite.cc
I3HostMobility.cc
I3Identifier.cc
I3Identifier.h
I3IdentifierStack.cc
I3IdentifierStack.h
I3IPAddress.cc
I3IPAddress.h
I3LatencyStretch.cc
I3Message.cc
I3Message.h
I3Message_m.h
I3Multicast.cc
I3Session.cc
I3SessionMessage_m.h
I3SubIdentifier.cc
I3SubIdentifier.h
I3Trigger.cc
I3Trigger.h
I3TriggerRoutingTime.cc
I3Triggers.cc
I3TriggersMessage_m.h
index.h
InetInfo.cc
InetInfo.h
InetUnderlayConfigurator.cc
InetUnderlayConfigurator.h
InitStages.h
IterativeLookup.cc
IterativeLookup.h
IterativeLookupConfiguration.h
Kademlia.cc
Kademlia.h
KademliaBucket.cc
KademliaBucket.h
KademliaMessage_m.h
KademliaNodeHandle.cc
KademliaNodeHandle.h
KBRTestApp.cc
KBRTestApp.h
KBRTestMessage_m.h
Koorde.cc
Koorde.h
Landmark.cc
Landmark.h
LifetimeChurn.cc
LifetimeChurn.h
LoginCache.cc
LoginCache.h
LookupListener.h
MessageObserver.cc
MessageObserver.h
MovementGenerator.cc
MovementGenerator.h
MyApplication.cc
MyApplication.h
MyMessage_m.h
MyOverlay.cc
MyOverlay.h
MyOverlay_m.h
NeighborCache.cc
NeighborCache.h
Nice.cc
Nice.h
NiceCluster.cc
NiceCluster.h
NiceMessage_m.h
NicePeerInfo.cc
NicePeerInfo.h
NoChurn.cc
NoChurn.h
NodeHandle.cc
NodeHandle.h
NodeVector.cc
NodeVector.h
Nps.cc
Nps.h
Nps_m.h
NTree.cc
NTree.h
NTree_m.h
NTreeHelper.cc
NTreeHelper.h
OverlayAccess.h
OverlayDummy.cc
OverlayKey.cc
OverlayKey.h
oversim_byteswap.h
oversim_mapset.h
OverSimMessage.cc
OverSimMessage.h
OverSimMessage_m.h
P2pns.cc
P2pns.h
P2pnsCache.cc
P2pnsCache.h
P2pnsMessage_m.h
PacketParser.h
ParetoChurn.cc
ParetoChurn.h
Pastry.cc
Pastry.h
PastryLeafSet.cc
PastryLeafSet.h
PastryMessage_m.h
PastryNeighborhoodSet.cc
PastryNeighborhoodSet.h
PastryRoutingTable.cc
PastryRoutingTable.h
PastryStateObject.cc
PastryStateObject.h
PastryTypes.h
PeerInfo.cc
PeerInfo.h
PeerStorage.cc
PeerStorage.h
ProximityLookupMessages_m.h
ProxNodeHandle.cc
ProxNodeHandle.h
PubSubLobby.cc
PubSubLobby.h
PubSubMessage_m.h
PubSubMMOG.cc
PubSubMMOG.h
PubSubSubspace.cc
PubSubSubspace.h
PubSubSubspaceId.cc
PubSubSubspaceId.h
Quon.cc
Quon.h
Quon_m.h
QuonDefs.h
QuonHelper.cc
QuonHelper.h
RandomChurn.cc
RandomChurn.h
randomRoaming.cc
randomRoaming.h
realtimescheduler.cc
realtimescheduler.h
RealworldApp.cc
RealworldApp.h
RealworldConnector.cc
RealworldConnector.h
RealworldDevice.cc
RealworldDevice.h
realWorldRoaming.cc
realWorldRoaming.h
RealWorldTestApp.cc
RealWorldTestApp.h
RealWorldTestMessage_m.h
RealWorldTestPacketParser.cc
RealWorldTestPacketParser.h
ReaSEInfo.cc
ReaSEInfo.h
ReaSEUnderlayConfigurator.cc
ReaSEUnderlayConfigurator.h
RecursiveLookup.cc
RecursiveLookup.h
RegionDataContainer.cc
RegionDataContainer.h
RpcListener.cc
RpcListener.h
RpcMacros.h
RpcState.h
RUNetworkConfigurator.cc
RUNetworkConfigurator.h
SCPacket.h
Scribe.cc
Scribe.h
ScribeGroup.cc
ScribeGroup.h
ScribeMessage_m.h
SearchMsgBookkeeping.cc
SearchMsgBookkeeping.h
SendStrategyFactory.cc
SendStrategyFactory.h
SHA1.cc
SHA1.h
SimMud.cc
SimMud.h
SimMud_m.h
SimpleCoordDataContainer.cc
SimpleCoordDataContainer.h
SimpleGameClient.cc
SimpleGameClient.h
SimpleGameClient_m.h
SimpleInfo.cc
SimpleInfo.h
SimpleNcs.cc
SimpleNcs.h
SimpleNodeEntry.cc
SimpleNodeEntry.h
SimpleTCP.cc
SimpleTCP.h
SimpleUDP.cc
SimpleUDP.h
SimpleUnderlayConfigurator.cc
SimpleUnderlayConfigurator.h
SimpleUnderlayNCS.cc
SimpleUnderlayNCS.h
simplex.cc
simplex.h
SingleHostUnderlayConfigurator.cc
SingleHostUnderlayConfigurator.h
StrategyRegions.cc
StrategyRegions.h
StrategyRemoveCoords.cc
StrategyRemoveCoords.h
StrategyRemoveInaccurate.cc
StrategyRemoveInaccurate.h
StrategyRemoveRandom.cc
StrategyRemoveRandom.h
StrategySendAll.cc
StrategySendAll.h
StrategySimplifyCoords.cc
StrategySimplifyCoords.h
StrategyTreeTest.cc
StrategyTreeTest.h
StringConvert.h
SVivaldi.cc
SVivaldi.h
TCPExampleApp.cc
TCPExampleApp.h
TCPExampleMessage_m.h
TierDummy.cc
TierDummy.h
TopologyVis.cc
TopologyVis.h
TraceChurn.cc
TraceChurn.h
TransportAddress.cc
TransportAddress.h
traverseRoaming.cc
traverseRoaming.h
TreeManagement.cc
TreeManagement.h
TreeManagementMessage_m.h
TriggerTable.cc
TriggerTable.h
TunOutDevice.cc
TunOutDevice.h
tunoutscheduler.cc
tunoutscheduler.h
UdpOutDevice.cc
UdpOutDevice.h
udpoutscheduler.cc
udpoutscheduler.h
UnderlayConfigurator.cc
UnderlayConfigurator.h
UnderlayConfiguratorAccess.h
Vast.cc
Vast.h
Vast_m.h
VastDefs.cc
VastDefs.h
Vector2D.cc
Vector2D.h
Vivaldi.cc
Vivaldi.h
XmlRpc.h
XmlRpcClient.cc
XmlRpcClient.h
XmlRpcDispatch.cc
XmlRpcDispatch.h
XmlRpcException.h
XmlRpcInterface.cc
XmlRpcInterface.h
XmlRpcMutex.cc
XmlRpcMutex.h
XmlRpcServer.cc
XmlRpcServer.h
XmlRpcServerConnection.cc
XmlRpcServerConnection.h
XmlRpcServerMethod.cc
XmlRpcServerMethod.h
XmlRpcSocket.cc
XmlRpcSocket.h
XmlRpcSource.cc
XmlRpcSource.h
XmlRpcThread.cc
XmlRpcThread.h
XmlRpcThreadedServer.cc
XmlRpcThreadedServer.h
XmlRpcUtil.cc
XmlRpcUtil.h
XmlRpcValue.cc
XmlRpcValue.h
yang.cc
yang.h
ZeroconfConnector.cc
ZeroconfConnector.h
File Members
CoordinateSystem.h
Go to the documentation of this file.
1
// Copyright (C) 2009 Institut fuer Telematik, Universitaet Karlsruhe (TH)
2
//
3
// This program is free software; you can redistribute it and/or
4
// modify it under the terms of the GNU General Public License
5
// as published by the Free Software Foundation; either version 2
6
// of the License, or (at your option) any later version.
7
//
8
// This program is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with this program; if not, write to the Free Software
15
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
//
17
23
#ifndef COORDINATESYSTEM_H_
24
#define COORDINATESYSTEM_H_
25
26
#include <stdint.h>
27
#include <vector>
28
29
#include <omnetpp.h>
30
31
class
Prox
;
32
class
NeighborCache
;
33
class
BaseCallMessage
;
34
35
36
37
typedef
std::vector<double>
Coords
;
38
typedef
std::vector<Coords>
CoordsVec
;
39
std::ostream&
operator<<
(std::ostream& os,
const
Coords
& coords);
40
41
42
class
AbstractNcsNodeInfo
43
{
44
public
:
45
virtual
~AbstractNcsNodeInfo
() {};
46
virtual
bool
isValid
() = 0;
47
virtual
Prox
getDistance
(
const
AbstractNcsNodeInfo
& node)
const
= 0;
48
virtual
bool
update
(
const
AbstractNcsNodeInfo
& info) = 0;
49
50
virtual
const
Coords
&
getCoords
()
const
= 0;
51
52
virtual
operator
Coords
()
const
= 0;
53
};
54
55
class
EuclideanNcsNodeInfo
:
public
AbstractNcsNodeInfo
56
{
57
public
:
58
EuclideanNcsNodeInfo
() {
coordinates
.resize(
dim
); };
59
virtual
~EuclideanNcsNodeInfo
() { };
60
61
uint8_t
getDimension
()
const
{
return
coordinates
.size(); };
62
static
void
setDimension
(uint8_t dimension) {
dim
= dimension; };
63
64
double
getCoords
(uint8_t i)
const
{
65
if
(i >=
coordinates
.size()) {
66
throw
cRuntimeError(
"too high value for dim!"
);
67
}
68
return
coordinates
[i];
69
};
70
71
const
Coords
&
getCoords
()
const
{
return
coordinates
; };
72
73
void
setCoords
(uint8_t i,
double
value) {
74
if
(i >=
coordinates
.size()) {
75
throw
cRuntimeError(
"coordinates too small"
);
76
}
77
coordinates
[i] = value;
78
};
79
80
Prox
getDistance
(
const
AbstractNcsNodeInfo
& abstractInfo)
const
;
81
82
protected
:
83
Coords
coordinates
;
84
static
uint8_t
dim
;
85
};
86
87
class
GnpNpsCoordsInfo
:
public
EuclideanNcsNodeInfo
88
{
89
public
:
90
GnpNpsCoordsInfo
() {
npsLayer
= -1; };
91
92
bool
isValid
() {
return
npsLayer
!= -1; };
93
94
int8_t
getLayer
()
const
{
return
npsLayer
; };
95
void
setLayer
(int8_t layer) {
npsLayer
= layer; };
96
97
bool
update
(
const
AbstractNcsNodeInfo
& abstractInfo);
98
99
operator
Coords
()
const
;
100
101
protected
:
102
int8_t
npsLayer
;
103
};
104
105
std::ostream&
operator<<
(std::ostream& os,
const
GnpNpsCoordsInfo
& info);
106
107
108
class
SimpleUnderlayCoordsInfo
:
public
EuclideanNcsNodeInfo
109
{
110
public
:
111
//SimpleUnderlayCoordsInfo() { };
112
113
operator
Coords
()
const
;
114
115
bool
isValid
() {
return
true
; };
116
117
Prox
getDistance
(
const
AbstractNcsNodeInfo
& abstractInfo)
const
;
118
bool
update
(
const
AbstractNcsNodeInfo
& abstractInfo);
119
};
120
121
122
class
SimpleCoordsInfo
:
public
EuclideanNcsNodeInfo
123
{
124
public
:
125
bool
isValid
() {
return
true
; };
126
127
Prox
getDistance
(
const
AbstractNcsNodeInfo
& abstractInfo)
const
;
128
bool
update
(
const
AbstractNcsNodeInfo
& abstractInfo);
129
130
simtime_t
getAccessDelay
()
const
{
return
accessDelay
; };
131
void
setAccessDelay
(simtime_t delay) {
accessDelay
= delay; };
132
133
operator
Coords
()
const
;
134
135
protected
:
136
simtime_t
accessDelay
;
137
};
138
139
std::ostream&
operator<<
(std::ostream& os,
const
SimpleCoordsInfo
& info);
140
141
142
class
VivaldiCoordsInfo
:
public
EuclideanNcsNodeInfo
143
{
144
public
:
145
VivaldiCoordsInfo
(
bool
useHeightVector =
false
) {
146
coordErr
= 1.0;
147
heightVector
= (useHeightVector ? 0 : -1.0);
148
};
149
150
bool
isValid
() {
return
coordErr
>= 0.0 &&
coordErr
< 1.0; };
151
152
double
getError
()
const
{
return
coordErr
; };
153
void
setError
(
double
err) {
154
if
(err > 1.0) {
155
coordErr
= 1.0;
156
}
else
if
(err < 0.0) {
157
coordErr
= 0.0;
158
}
else
{
159
coordErr
= err;
160
}
161
//coordErr = ((err > 1.0) ? 1.0 : ((err < 0.0) ? 0.0 : coordErr = err));
162
};
163
164
double
getHeightVector
()
const
{
return
heightVector
; };
165
void
setHeightVector
(
double
height) {
166
heightVector
= ((height > 0.0) ? height : 0.0);
167
};
168
169
Prox
getDistance
(
const
AbstractNcsNodeInfo
& node)
const
;
170
bool
update
(
const
AbstractNcsNodeInfo
& info);
171
operator
Coords
()
const
;
172
173
protected
:
174
double
coordErr
;
175
double
heightVector
;
176
};
177
178
std::ostream&
operator<<
(std::ostream& os,
const
VivaldiCoordsInfo
& info);
179
180
class
AbstractNcs
{
181
public
:
182
virtual
~AbstractNcs
() { };
183
184
virtual
void
init
(
NeighborCache
* neighorCache) = 0;
185
virtual
bool
isReady
() {
return
true
; };
186
187
virtual
AbstractNcsNodeInfo
*
getUnvalidNcsInfo
()
const
= 0;
188
189
virtual
Prox
getCoordinateBasedProx
(
const
AbstractNcsNodeInfo
& node)
const
= 0;
190
virtual
void
processCoordinates
(
const
simtime_t& rtt,
191
const
AbstractNcsNodeInfo
& nodeInfo) { };
192
193
virtual
const
AbstractNcsNodeInfo
&
getOwnNcsInfo
()
const
= 0;
194
virtual
AbstractNcsNodeInfo
*
createNcsInfo
(
const
Coords
& coords)
const
= 0;
195
196
virtual
void
handleTimerEvent
(cMessage* msg) { };
197
virtual
bool
handleRpcCall
(
BaseCallMessage
* msg) {
return
false
; };
198
};
199
200
#endif
/* COORDINATESYSTEM_H_ */
src
common
CoordinateSystem.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2