cdelaychannel.h

00001 //==========================================================================
00002 //   CDELAYCHANNEL.H  -  header for
00003 //                     OMNeT++/OMNEST
00004 //            Discrete System Simulation in C++
00005 //
00006 //
00007 //  Declaration of the following classes:
00008 //    cDelayChannel : channel class
00009 //
00010 //==========================================================================
00011 
00012 /*--------------------------------------------------------------*
00013   Copyright (C) 1992-2008 Andras Varga
00014   Copyright (C) 2006-2008 OpenSim Ltd.
00015 
00016   This file is distributed WITHOUT ANY WARRANTY. See the file
00017   `license' for details on this and other legal matters.
00018 *--------------------------------------------------------------*/
00019 
00020 #ifndef __CDELAYCHANNEL_H
00021 #define __CDELAYCHANNEL_H
00022 
00023 #include "cchannel.h"
00024 #include "csimulation.h"
00025 
00026 NAMESPACE_BEGIN
00027 
00033 class SIM_API cDelayChannel : public cChannel //implies noncopyable
00034 {
00035   protected:
00036     static simsignal_t messageSentSignal;
00037     static simsignal_t messageDiscardedSignal;
00038 
00039   private:
00040     enum {
00041       FL_ISDISABLED = 128,
00042       FL_DELAY_NONZERO = 256,
00043     };
00044 
00045     simtime_t delay; // cached value of propagation delay parameter
00046 
00047   private:
00048     // internal: checks whether parameters have been set up
00049     void checkState() const  {if (!parametersFinalized()) throw cRuntimeError(this, ePARAMSNOTREADY);}
00050 
00051   protected:
00052     // internal: update cached copies of parameters
00053     void rereadPars();
00054 
00058     virtual void handleParameterChange(const char *parname);
00059 
00060   public:
00068     explicit cDelayChannel(const char *name=NULL) : cChannel(name) {}
00069 
00073     virtual ~cDelayChannel() {}
00074 
00079     static cDelayChannel *create(const char *name);
00081 
00087     virtual bool isTransmissionChannel() const {return false;}
00088 
00092     virtual double getNominalDatarate() const {return 0;}
00093 
00097     virtual simtime_t calculateDuration(cMessage *msg) const {return 0;}
00098 
00102     virtual simtime_t getTransmissionFinishTime() const {return SIMTIME_ZERO;}
00103 
00107     virtual bool isBusy() const {return false;}
00108 
00112     virtual void forceTransmissionFinishTime(simtime_t t) {}
00114 
00120     virtual void setDelay(double d);
00121 
00125     virtual void setDisabled(bool d);
00126 
00131     virtual simtime_t getDelay() const {checkState(); return delay;}
00132 
00138     virtual bool isDisabled() const  {checkState(); return flags & FL_ISDISABLED;}
00140 
00146     virtual void initialize();
00147 
00152     virtual void processMessage(cMessage *msg, simtime_t t, result_t& result);
00154 };
00155 
00156 NAMESPACE_END
00157 
00158 
00159 #endif
00160 
00161 
Generated on Tue Dec 2 11:16:27 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3