Base class for channels.
Classes | |
class | MessageSentSignalValue |
Signal value that accompanies the "messageSent" signal. More... | |
Public Member Functions | |
virtual void | finalizeParameters () override |
Constructors, destructor | |
cChannel (const char *name=nullptr) | |
virtual | ~cChannel () |
Redefined cObject member functions. | |
virtual std::string | str () const override |
Public methods for invoking initialize()/finish(), redefined from cComponent. | |
initialize(), numInitStages(), and finish() are themselves also declared in cComponent, and can be redefined in channel classes by the user to perform initialization and finalization (result recording, etc) tasks. | |
virtual void | callInitialize () override |
virtual bool | callInitialize (int stage) override |
virtual void | callFinish () override |
Channel information. | |
virtual ComponentKind | getComponentKind () const override |
virtual cModule * | getParentModule () const override |
cChannelType * | getChannelType () const |
virtual cProperties * | getProperties () const override |
virtual cGate * | getSourceGate () const |
virtual bool | isTransmissionChannel () const =0 |
Channel functionality | |
virtual Result | processMessage (cMessage *msg, const SendOptions &options, simtime_t t)=0 |
virtual double | getNominalDatarate () const =0 |
virtual simtime_t | calculateDuration (cMessage *msg) const =0 |
virtual simtime_t | getTransmissionFinishTime () const =0 |
virtual bool | isBusy () const |
virtual void | forceTransmissionFinishTime (simtime_t t) |
virtual bool | isDisabled () const |
Public Member Functions inherited from cComponent | |
cComponent (const char *name=nullptr) | |
virtual | ~cComponent () |
virtual void | forEachChild (cVisitor *v) override |
const cComponent * | getThisPtr () const |
virtual void | setDisplayName (const char *name) |
virtual const char * | getDisplayName () const |
virtual cComponentType * | getComponentType () const |
cSimulation * | getSimulation () const |
int | getId () const |
virtual const char * | getNedTypeName () const |
virtual std::string | getNedTypeAndFullName () const |
virtual std::string | getNedTypeAndFullPath () const |
bool | isModule () const |
bool | isChannel () const |
virtual cModule * | getSystemModule () const |
virtual cModule * | getModuleByPath (const char *path) const |
virtual cModule * | findModuleByPath (const char *path) const |
virtual int | getNumParams () const |
virtual cPar & | par (int k) |
const cPar & | par (int k) const |
virtual cPar & | par (const char *parname) |
const cPar & | par (const char *parname) const |
virtual int | findPar (const char *parname) const |
bool | hasPar (const char *s) const |
virtual cRNG * | getRNG (int k) const |
virtual uint32_t | intrand (uint32_t r, int rng=0) const |
virtual double | dblrand (int rng=0) const |
virtual double | uniform (double a, double b, int rng=0) const |
virtual SimTime | uniform (SimTime a, SimTime b, int rng=0) const |
virtual double | exponential (double mean, int rng=0) const |
virtual SimTime | exponential (SimTime mean, int rng=0) const |
virtual double | normal (double mean, double stddev, int rng=0) const |
virtual SimTime | normal (SimTime mean, SimTime stddev, int rng=0) const |
virtual double | truncnormal (double mean, double stddev, int rng=0) const |
virtual SimTime | truncnormal (SimTime mean, SimTime stddev, int rng=0) const |
virtual double | gamma_d (double alpha, double theta, int rng=0) const |
virtual double | beta (double alpha1, double alpha2, int rng=0) const |
virtual double | erlang_k (unsigned int k, double mean, int rng=0) const |
virtual double | chi_square (unsigned int k, int rng=0) const |
virtual double | student_t (unsigned int i, int rng=0) const |
virtual double | cauchy (double a, double b, int rng=0) const |
virtual double | triang (double a, double b, double c, int rng=0) const |
virtual double | lognormal (double m, double w, int rng=0) const |
virtual double | weibull (double a, double b, int rng=0) const |
virtual double | pareto_shifted (double a, double b, double c, int rng=0) const |
virtual int | intuniform (int a, int b, int rng=0) const |
virtual int | intuniformexcl (int a, int b, int rng=0) const |
virtual int | bernoulli (double p, int rng=0) const |
virtual int | binomial (int n, double p, int rng=0) const |
virtual int | geometric (double p, int rng=0) const |
virtual int | negbinomial (int n, double p, int rng=0) const |
virtual int | poisson (double lambda, int rng=0) const |
virtual void | subscribe (simsignal_t signalID, cIListener *listener) |
virtual void | subscribe (const char *signalName, cIListener *listener) |
virtual void | unsubscribe (simsignal_t signalID, cIListener *listener) |
virtual void | unsubscribe (const char *signalName, cIListener *listener) |
virtual bool | isSubscribed (simsignal_t signalID, cIListener *listener) const |
virtual bool | isSubscribed (const char *signalName, cIListener *listener) const |
virtual std::vector< simsignal_t > | getLocalListenedSignals () const |
virtual std::vector< cIListener * > | getLocalSignalListeners (simsignal_t signalID) const |
virtual bool | hasGUI () const |
virtual cDisplayString & | getDisplayString () const |
virtual void | setDisplayString (const char *dispstr) |
virtual void | bubble (const char *text) const |
virtual std::string | resolveResourcePath (const char *fileName) const |
virtual void | recordScalar (const char *name, double value, const char *unit=nullptr) |
virtual void | recordScalar (const char *name, SimTime value, const char *unit=nullptr) |
virtual void | recordStatistic (cStatistic *stats, const char *unit=nullptr) |
virtual void | recordStatistic (const char *name, cStatistic *stats, const char *unit=nullptr) |
virtual void | emit (simsignal_t signalID, bool b, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, double d, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, const SimTime &t, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, const char *s, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, cObject *obj, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, const cObject *obj, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, char c, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, unsigned char c, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, short i, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, unsigned short i, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, int i, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, unsigned int i, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, long i, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, unsigned long i, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, long long i, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, unsigned long long i, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, float f, cObject *details=nullptr) |
virtual void | emit (simsignal_t signalID, long double d, cObject *details=nullptr) |
bool | mayHaveListeners (simsignal_t signalID) const |
bool | hasListeners (simsignal_t signalID) const |
Public Member Functions inherited from cSoftOwner | |
cSoftOwner (const char *name=nullptr, bool namepooling=true) | |
virtual | ~cSoftOwner () |
virtual bool | isSoftOwner () const override |
int | getNumOwnedObjects () const |
cOwnedObject * | getOwnedObject (int k) |
Public Member Functions inherited from cNoncopyableOwnedObject | |
cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true) | |
virtual cNoncopyableOwnedObject * | dup () const override |
Public Member Functions inherited from cOwnedObject | |
cOwnedObject () | |
cOwnedObject (const char *name, bool namepooling=true) | |
cOwnedObject (const cOwnedObject &obj) | |
virtual | ~cOwnedObject () |
cOwnedObject & | operator= (const cOwnedObject &o) |
virtual cObject * | getOwner () const override |
virtual bool | isOwnedObject () const override |
Public Member Functions inherited from cNamedObject | |
cNamedObject () | |
cNamedObject (const char *name, bool namepooling=true) | |
cNamedObject (const cNamedObject &obj) | |
virtual | ~cNamedObject () |
cNamedObject & | operator= (const cNamedObject &o) |
virtual void | setName (const char *s) |
virtual const char * | getName () const override |
virtual void | setNamePooling (bool b) |
virtual bool | getNamePooling () |
Public Member Functions inherited from cObject | |
cObject () | |
cObject (const cObject &other)=default | |
virtual | ~cObject () |
virtual const char * | getClassName () const |
bool | isName (const char *s) const |
virtual const char * | getFullName () const |
virtual std::string | getFullPath () const |
virtual std::string | getClassAndFullName () const |
virtual std::string | getClassAndFullPath () const |
const cObject * | getThisPtr () const |
virtual std::ostream & | printOn (std::ostream &os) const |
cObject * | findObject (const char *name, bool deep=true) |
virtual cClassDescriptor * | getDescriptor () const |
void | copyNotSupported () const |
Additional Inherited Members | |
Static Public Member Functions inherited from cComponent | |
static simsignal_t | registerSignal (const char *name) |
static const char * | getSignalName (simsignal_t signalID) |
Static Public Member Functions inherited from cOwnedObject | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cSoftOwner * | getOwningContext () |
Protected Member Functions inherited from cComponent | |
virtual void | initialize (int stage) |
virtual int | numInitStages () const |
virtual void | initialize () |
virtual void | finish () |
virtual void | handleParameterChange (const char *parname) |
virtual void | refreshDisplay () const |
virtual void | preDelete (cComponent *root) |
Protected Member Functions inherited from cSoftOwner | |
virtual void | take (cOwnedObject *obj) override |
virtual void | drop (cOwnedObject *obj) override |
Protected Member Functions inherited from cObject | |
void | dropAndDelete (cOwnedObject *obj) |
|
explicit |
Constructor.
|
virtual |
Destructor. Note: it is not allowed delete channel objects directly, only via cGate's disconnect() and reconnectWith() methods.
|
overridevirtual |
Must be called after the component was created, and (with modules) before buildInside(). It reads input parameters from omnetpp.ini, and cModule extends this method to add gates to the module too (as this is the earliest time parameter values are available, and gate vector sizes may depend on parameters).
Reimplemented from cComponent.
|
overridevirtual |
Produces a one-line description of the object's contents. See cObject for more details.
Reimplemented from cSoftOwner.
Reimplemented in cDatarateChannel.
|
overridevirtual |
Interface for calling initialize() from outside. Implementation performs multi-stage initialization for this channel object.
Implements cComponent.
|
overridevirtual |
Interface for calling initialize() from outside. It does a single stage of initialization, and returns true
if more stages are required.
Implements cComponent.
|
overridevirtual |
Interface for calling finish() from outside.
Implements cComponent.
|
inlineoverridevirtual |
Redefined from cComponent to return KIND_CHANNEL.
Implements cComponent.
|
overridevirtual |
Returns the compound module containing this channel. That is, the channel is either between two submodules of getParentModule(), or between getParentModule() and one of its submodules. (For completeness, it may also connect two gates of getParentModule() on the inside).
Implements cComponent.
|
inline |
Convenience method: casts the return value of getComponentType() to cChannelType.
|
overridevirtual |
Return the properties for this channel. Properties cannot be changed at runtime. Redefined from cComponent.
Implements cComponent.
|
inlinevirtual |
Returns the gate this channel is attached to.
|
pure virtual |
Returns true if the channel models a nonzero-duration transmission, that is, sets the duration field of cPacket. Only one transmission channel is allowed per connection path (see cGate methods getPreviousGate(), getNextGate(), getPathStartGate(), getPathEndGate()).
Implemented in cIdealChannel, cDatarateChannel, and cDelayChannel.
|
pure virtual |
This method encapsulates the channel's functionality. The method should model the transmission of the given message starting at the given t time, and store the results (propagation delay, transmission duration, discard flag) in the result object. Only the relevant fields in the result object need to be changed, others can be left untouched.
Transmission duration and bit error modeling only applies to packets (i.e. to instances of cPacket, where cMessage's isPacket() returns true), it should be skipped for non-packet messages. The method does not need to call the setDuration(duration)
method on the packet; this is done by the simulation kernel. However, the method should call setBitError(true)
on the packet if error modeling results in bit errors.
If the method sets the discard flag in the result object, it means that the message object should be deleted by the simulation kernel; this facility can be used to model that the message gets lost in the channel.
The method does not need to throw error on overlapping transmissions, or if the packet's duration field is already set; these checks are done by the simulation kernel before processMessage() is called.
Implemented in cIdealChannel, cDatarateChannel, and cDelayChannel.
|
pure virtual |
For transmission channels: Returns the nominal data rate of the channel. The number returned from this method should be treated as informative; there is no strict requirement that the channel calculates packet duration by dividing the packet length by the nominal data rate. For example, specialized channels may add the length of a lead-in signal to the duration.
Implemented in cIdealChannel, cDatarateChannel, and cDelayChannel.
For transmission channels: Calculates the transmission duration of the message with the current channel configuration (datarate, etc); it does not check or modify channel state. For non-transmission channels this method returns zero.
This method is useful for transmitter modules that need to determine the transmission time of a packet without actually sending the packet.
Caveats: this method is "best-effort" – there is no guarantee that transmission time when the packet is actually sent will be the same as the value returned by this method. The difference may be caused by changed channel parameters (i.e. "datarate" being overwritten), or by a non-time-invariant transmission algorithm.
Note that there is no requirement that processMessage() relies on this method to calculated the packet duration. That is, to change the duration computation algorithm via subclassing you need to redefine BOTH the processMessage() and calculateDuration() methods.
Implemented in cIdealChannel, cDatarateChannel, and cDelayChannel.
|
pure virtual |
For transmission channels: Returns the simulation time the sender gate will finish transmitting. If the gate is not currently transmitting, the result is unspecified but less or equal the current simulation time.
Implemented in cIdealChannel, cDatarateChannel, and cDelayChannel.
|
virtual |
For transmission channels: Returns whether the sender gate is currently transmitting, ie. whether getTransmissionFinishTime() is greater than the current simulation time.
Reimplemented in cIdealChannel, cDatarateChannel, and cDelayChannel.
|
inlinevirtual |
DEPRECATED METHOD. It is only provided for backward compatibility with OMNeT++ 5.x.
For transmission channels, this method forcibly overwrites the finish time of the current transmission in the channel. It is a crude device that allows implementing aborting transmissions. Models using this method should be migrated to the transmission update API.
Reimplemented in cDatarateChannel.
|
inlinevirtual |
Returns whether the channel is disabled. A disabled channel discards all messages sent on it.
Reimplemented in cDatarateChannel, and cDelayChannel.