cChannel Class Reference
[Simulation core classes]

Base class for channels. More...

#include <cchannel.h>

Inheritance diagram for cChannel:
cComponent cDefaultList cNoncopyableOwnedObject cOwnedObject noncopyable cNamedObject cObject cDatarateChannel cDelayChannel cIdealChannel

List of all members.

Classes

class  MessageSentSignalValue
 Signal value that acompanies the "messageSent" signal. More...
struct  result_t
 Allows returning multiple values from the processMessage() method. More...

Public Member Functions

virtual void finalizeParameters ()
Constructors, destructor

 cChannel (const char *name=NULL)
virtual ~cChannel ()
Redefined cObject member functions.

virtual std::string info () const
virtual void forEachChild (cVisitor *v)
virtual void parsimPack (cCommBuffer *buffer)
virtual void parsimUnpack (cCommBuffer *buffer)
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 ()
virtual bool callInitialize (int stage)
virtual void callFinish ()
Channel information.

virtual cModulegetParentModule () const
cChannelTypegetChannelType () const
virtual cPropertiesgetProperties () const
cGategetSourceGate () const
virtual bool isTransmissionChannel () const =0
Channel functionality

virtual void processMessage (cMessage *msg, simtime_t t, result_t &result)=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)=0

Detailed Description

Base class for channels.


Member Function Documentation

virtual simtime_t cChannel::calculateDuration ( cMessage msg  )  const [pure virtual]

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.

See also:
isTransmissionChannel(), cDatarateChannel

Implemented in cIdealChannel, cDatarateChannel, and cDelayChannel.

virtual bool cChannel::callInitialize ( int  stage  )  [virtual]

Interface for calling initialize() from outside.

It does a single stage of initialization, and returns true if more stages are required.

Implements cComponent.

virtual void cChannel::callInitialize (  )  [virtual]

Interface for calling initialize() from outside.

Implementation performs multi-stage initialization for this channel object.

Implements cComponent.

virtual void cChannel::finalizeParameters (  )  [virtual]

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.

virtual void cChannel::forceTransmissionFinishTime ( simtime_t  t  )  [pure virtual]

For transmission channels: Forcibly overwrites the finish time of the current transmission in the channel (see getTransmissionFinishTime()).

This method is a crude device that allows for implementing aborting transmissions; it is not needed for normal packet transmissions. Calling this method with the current simulation time will allow you to immediately send another packet on the channel without the channel reporting error due to its being busy.

Note that this call does NOT affect the delivery of the packet being transmitted: the packet object is delivered to the target module at the time it would without the call to this method. The sender needs to inform the target module in some other way that the transmission was aborted and the packet should be treated accordingly (i.e. discarded as incomplete); for example by sending an out-of-band cMessage that the receiver has to understand.

Implemented in cIdealChannel, cDatarateChannel, and cDelayChannel.

virtual void cChannel::forEachChild ( cVisitor v  )  [virtual]

Calls v->visit(this) for each contained object.

See cObject for more details.

Reimplemented from cComponent.

virtual double cChannel::getNominalDatarate (  )  const [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.

See also:
isTransmissionChannel(), cDatarateChannel

Implemented in cIdealChannel, cDatarateChannel, and cDelayChannel.

virtual cModule* cChannel::getParentModule (  )  const [virtual]

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.

virtual cProperties* cChannel::getProperties (  )  const [virtual]

Return the properties for this channel.

Properties cannot be changed at runtime. Redefined from cComponent.

Implements cComponent.

virtual simtime_t cChannel::getTransmissionFinishTime (  )  const [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.

See also:
isTransmissionChannel(), isBusy(), cDatarateChannel

Implemented in cIdealChannel, cDatarateChannel, and cDelayChannel.

virtual std::string cChannel::info (  )  const [virtual]

Produces a one-line description of the object's contents.

See cObject for more details.

Reimplemented from cDefaultList.

Reimplemented in cDatarateChannel.

virtual bool cChannel::isBusy (  )  const [virtual]

For transmission channels: Returns whether the sender gate is currently transmitting, ie.

whether getTransmissionFinishTime() is greater than the current simulation time.

See also:
isTransmissionChannel(), getTransmissionFinishTime(), cDatarateChannel

Reimplemented in cIdealChannel, cDatarateChannel, and cDelayChannel.

virtual bool cChannel::isTransmissionChannel (  )  const [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.

virtual void cChannel::processMessage ( cMessage msg,
simtime_t  t,
result_t result 
) [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.


The documentation for this class was generated from the following file:
Generated on Tue Dec 2 11:16:28 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3