OverSim
Vivaldi.h
Go to the documentation of this file.
1 // Copyright (C) 2008 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 
24 #ifndef _VIVALDI_
25 #define _VIVALDI_
26 
27 
28 #include <vector>
29 
30 #include <omnetpp.h>
31 
32 #include <GlobalStatisticsAccess.h>
33 #include <NeighborCache.h>
34 #include <CoordinateSystem.h>
35 
36 class TransportAddress;
37 
38 
39 class Vivaldi : public AbstractNcs
40 {
41  private:
42  //variables for storing the parameter from ned file
44  uint32_t dimension;
45  protected:
46  // variable for storing the node coordinates / estimated error
48 
49  double errorC;
50  double coordC;
51 
53 
54  virtual void finishVivaldi();
55 
56  virtual void updateDisplay();
57 
58  virtual double calcError(const simtime_t& rtt, double dist, double weight);
59  virtual double calcDelta(const simtime_t& rtt, double dist, double weight);
60 
61  //pointer to GlobalStatistics
64 
65  public:
66  virtual ~Vivaldi() { delete ownCoords; };
67 
68  virtual void init(NeighborCache* neighborCache);
69  void processCoordinates(const simtime_t& rtt,
70  const AbstractNcsNodeInfo& nodeInfo);
71 
73 
75  virtual AbstractNcsNodeInfo* createNcsInfo(const std::vector<double>& coords) const;
76 
77  const VivaldiCoordsInfo& getOwnNcsInfo() const { return *ownCoords; };
78  const std::vector<double>& getOwnCoordinates() const { return ownCoords->getCoords(); };
79  inline double getOwnError() const { return ownCoords->getError(); };
80  inline double getOwnHeightVector() const { return ownCoords->getHeightVector(); };
81 };
82 
83 #endif
84