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 : public AbstractNcs
00040 {
00041   private:
00042     //variables for storing the parameter from ned file
00043     bool enableHeightVector;
00044     uint32_t dimension;
00045   protected:
00046     // variable for storing the node coordinates / estimated error
00047     VivaldiCoordsInfo* ownCoords;
00048 
00049     double errorC;
00050     double coordC;
00051 
00052     //bool useSVivaldi;
00053     bool showVivaldiPosition;
00054 
00055     virtual void finishVivaldi();
00056 
00057     virtual void updateDisplay();
00058 
00059     virtual double calcError(const simtime_t& rtt, double dist, double weight);
00060     virtual double calcDelta(const simtime_t& rtt, double dist, double weight);
00061 
00062     //pointer to GlobalStatistics
00063     GlobalStatistics* globalStatistics;
00064     NeighborCache* neighborCache;
00065 
00066   public:
00067     virtual ~Vivaldi() { delete ownCoords; };
00068 
00069     virtual bool isAdapting() { return true; };
00070     virtual void init(NeighborCache* neighborCache);
00071     void processCoordinates(const simtime_t& rtt,
00072                             const AbstractNcsNodeInfo& nodeInfo);
00073 
00074     Prox getCoordinateBasedProx(const AbstractNcsNodeInfo& info) const;
00075 
00076     virtual AbstractNcsNodeInfo* getUnvalidNcsInfo() const { return new VivaldiCoordsInfo(enableHeightVector); };
00077     virtual AbstractNcsNodeInfo* createNcsInfo(const std::vector<double>& coords) const;
00078 
00079     const VivaldiCoordsInfo& getOwnNcsInfo() const { return *ownCoords; };
00080     const std::vector<double>& getOwnCoordinates() const { return ownCoords->getCoords(); };
00081     inline double getOwnError() const { return ownCoords->getError(); };
00082     inline double getOwnHeightVector() const { return ownCoords->getHeightVector(); };
00083 };
00084 
00085 #endif
00086 
Generated on Wed May 26 16:21:15 2010 for OverSim by  doxygen 1.6.3