Vivaldi.h

Go to the documentation of this file.
00001 // Copyright (C) 2008 Institut fuer Telematik, Universitaet Karlsruhe (TH)
00002 //
00003 // This program is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU General Public License
00005 // as published by the Free Software Foundation; either version 2
00006 // of the License, or (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00016 //
00017 
00024 #ifndef _VIVALDI_
00025 #define _VIVALDI_
00026 
00027 
00028 #include <vector>
00029 
00030 #include <omnetpp.h>
00031 
00032 #include <GlobalStatisticsAccess.h>
00033 #include <NeighborCache.h>
00034 #include <CoordinateSystem.h>
00035 
00036 class TransportAddress;
00037 
00038 
00039 class Vivaldi
00040 {
00041   private:
00042     //variables for storing the parameter from ned file
00043     double errorC;
00044     double coordC;
00045     bool enableHeightVector;
00046     double lossC;
00047     double effectiveSample;
00048     uint32_t dimension;
00049 
00050     // variables for storing the node coordinates / estimated error
00051     std::vector<double> xi;
00052     double errori;
00053     double loss;
00054     double lossResetLimit;
00055 
00056   protected:
00057     bool useSVivaldi;
00058     bool showVivaldiPosition;
00059 
00060     virtual void finishVivaldi();
00061 
00062     virtual void updateDisplay();
00063 
00064     //pointer to GlobalStatistics
00065     GlobalStatistics* globalStatistics;
00066     NeighborCache* neighborCache;
00067 
00068   public:
00069     virtual void initVivaldi(NeighborCache* neighborCache);
00070     void processCoordinates(simtime_t rtt,
00071                             const std::vector<double>& xj,
00072                             double errrorj);
00073     Prox getCoordinateBasedProx(const NodeCoordsInfo& info);
00074     const std::vector<double>& getOwnCoordinates() const { return xi; };
00075     inline double getOwnError() const { return errori; };
00076 };
00077 
00078 #endif

Generated on Tue Sep 8 17:26:54 2009 for OverSim by  doxygen 1.5.8