00001 // Copyright (C) 2010 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 00023 #ifndef _SIMPLENCS_ 00024 #define _SIMPLENCS_ 00025 00026 00027 #include <vector> 00028 00029 #include <omnetpp.h> 00030 00031 #include <NeighborCache.h> 00032 #include <CoordinateSystem.h> 00033 00034 00035 class SimpleNcs : public AbstractNcs 00036 { 00037 private: 00038 // variable for storing the node coordinates / estimated error 00039 SimpleCoordsInfo* ownCoords; 00040 00041 //variables for storing the parameter from ned file 00042 uint32_t dimension; 00043 00044 simtime_t falsifyDelay(simtime_t oldDelay) const; 00045 00046 enum delayFaultTypeNum { 00047 delayFaultUndefined, 00048 delayFaultLiveAll, 00049 delayFaultLivePlanetlab, 00050 delayFaultSimulation 00051 }; 00052 static std::map<std::string, delayFaultTypeNum> delayFaultTypeMap; 00053 static std::string delayFaultTypeString; 00054 static bool faultyDelay; 00055 00056 protected: 00057 NeighborCache* neighborCache; 00058 00059 public: 00060 SimpleNcs() { ownCoords = NULL; }; 00061 virtual ~SimpleNcs() { delete ownCoords; }; 00062 00063 virtual void init(NeighborCache* neighborCache); 00064 00065 Prox getCoordinateBasedProx(const AbstractNcsNodeInfo& info) const; 00066 00067 virtual AbstractNcsNodeInfo* getUnvalidNcsInfo() const { return new SimpleCoordsInfo(); }; 00068 virtual AbstractNcsNodeInfo* createNcsInfo(const std::vector<double>& coords) const; 00069 00070 const AbstractNcsNodeInfo& getOwnNcsInfo() const { return *ownCoords; }; 00071 const std::vector<double>& getOwnCoordinates() const { return ownCoords->getCoords(); }; 00072 }; 00073 00074 #endif 00075