cdelaychannel.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
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;
00046
00047 private:
00048
00049 void checkState() const {if (!parametersFinalized()) throw cRuntimeError(this, ePARAMSNOTREADY);}
00050
00051 protected:
00052
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