SimpleNodeEntry.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2000 Institut fuer Telematik, Universitaet Karlsruhe
00003 // Copyright (C) 2004 Andras Varga
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 //
00019 
00026 #ifndef __SIMPLENODEENTRY_H
00027 #define __SIMPLENODEENTRY_H
00028 
00029 
00030 #include <omnetpp.h>
00031 #include <IPvXAddress.h>
00032 
00033 #include "SimpleUDPPacket_m.h"
00034 
00035 
00036 class NodeRecord
00037 {
00038 public:
00039     NodeRecord(uint32_t dim);
00040     ~NodeRecord();
00041     NodeRecord(const NodeRecord& nodeRecord);
00042     NodeRecord& operator=(const NodeRecord& nodeRecord);
00043     void debugOutput(int dim);
00044 
00045     double* coords;
00046     IPvXAddress ip;
00047     static uint32_t dim;
00048 };
00049 
00055 class SimpleNodeEntry : public cPolymorphic
00056 {
00057 public:
00058 
00059     ~SimpleNodeEntry()
00060     {
00061         if (index == -1) delete nodeRecord;
00062     }
00063 
00072     SimpleNodeEntry(cModule* node, cChannelType* type,
00073                     uint32_t fieldSize, uint32_t sendQueueLength);
00074 
00084     SimpleNodeEntry(cModule* node, cChannelType* type, uint32_t sendQueueLength,
00085                     NodeRecord* nodeRecord, int index);
00086 
00092     inline cGate* getGate() const
00093     {
00094         return ingate;
00095     };
00096 
00102 //    inline static void setFieldSize(uint size)
00103 //    {
00104 //        fieldSize = size;
00105 //    };
00106 
00112 //    inline static void setSendQueueLength(uint length)
00113 //    {
00114 //        sendQueueLength = length;
00115 //    };
00116 
00117     typedef std::pair<simtime_t, bool> SimpleDelay; 
00118 
00126     SimpleDelay calcDelay(SimpleUDPPacket* msg, const SimpleNodeEntry& dest);
00127 
00133     std::string info() const;
00134 
00142     friend std::ostream& operator<<(std::ostream& out, const SimpleNodeEntry& entry);
00143 
00144     simtime_t getAccessDelay() { return accessDelay; };
00145 
00146     // typo fixed, thanks to huebby
00147     float getBandwidth() { return bandwidth; };
00148 
00149     float getErrorRate() { return errorRate; };
00150 
00151     inline float getX() { return nodeRecord->coords[0]; };
00152     inline float getY() { return nodeRecord->coords[1]; };
00153 
00154     int getRecordIndex() { return index; };
00155     NodeRecord* getNodeRecord() { return nodeRecord; };
00156 
00157 protected:
00158 
00165     float operator-(const SimpleNodeEntry& entry) const;
00166 
00167     cGate* ingate; 
00168 
00169     simtime_t txFinished; 
00170     simtime_t txMaxQueueTime; 
00171     simtime_t accessDelay; 
00172     double bandwidth; 
00173     double errorRate; 
00174 
00175     NodeRecord* nodeRecord;
00176     int index;
00177 };
00178 
00179 
00180 #endif // __SIMPLENODEENTRY_H

Generated on Wed Mar 25 16:32:49 2009 for OverSim by  doxygen 1.5.5