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 00034 class TransportAddress; 00035 class NeighborCache; 00036 00037 class Vivaldi 00038 { 00039 private: 00040 //variables for storing the parameter from ned file 00041 double errorC; 00042 double coordC; 00043 double lossC; 00044 double effectiveSample; 00045 uint32_t dimension; 00046 00047 // variables for storing the node coordinates / estimated error 00048 std::vector<double> xi; 00049 double errori; 00050 double loss; 00051 00052 protected: 00053 bool useSVivaldi; 00054 bool showVivaldiPosition; 00055 00056 virtual void finishVivaldi(); 00057 00058 virtual void updateDisplay(); 00059 00060 //pointer to GlobalStatistics 00061 GlobalStatistics* globalStatistics; 00062 NeighborCache* neighborCache; 00063 00064 public: 00065 virtual void initVivaldi(NeighborCache* neighborCache); 00066 void processCoordinates(simtime_t rtt, 00067 const std::vector<double>& xj, 00068 double errrorj); 00069 const std::vector<double>& getOwnCoordinates() const { return xi; }; 00070 inline double getOwnError() const { return errori; }; 00071 }; 00072 00073 #endif
1.5.5