INET Framework for OMNeT++/OMNEST
inet::queueing::TimeBasedTokenGenerator Class Reference

#include <TimeBasedTokenGenerator.h>

Inheritance diagram for inet::queueing::TimeBasedTokenGenerator:
inet::ClockUserModuleMixin< TokenGeneratorBase > inet::queueing::TokenGeneratorBase inet::queueing::PacketProcessorBase inet::queueing::IPacketProcessor inet::StringFormat::IDirectiveResolver

Public Member Functions

virtual ~TimeBasedTokenGenerator ()
 
virtual bool supportsPacketPushing (cGate *gate) const override
 Returns true if the processor supports pushing packets at the given gate. More...
 
virtual bool supportsPacketPulling (cGate *gate) const override
 Returns true if the processor supports pulling packets at the given gate. More...
 
- Public Member Functions inherited from inet::ClockUserModuleMixin< TokenGeneratorBase >
virtual void scheduleClockEventAt (clocktime_t time, ClockEvent *msg)
 
virtual void scheduleClockEventAfter (clocktime_t delay, ClockEvent *msg)
 
virtual cMessage * cancelClockEvent (ClockEvent *msg)
 
virtual void cancelAndDeleteClockEvent (ClockEvent *msg)
 
virtual void rescheduleClockEventAt (clocktime_t time, ClockEvent *msg)
 
virtual void rescheduleClockEventAfter (clocktime_t time, ClockEvent *msg)
 
virtual clocktime_t computeClockTimeFromSimTime (simtime_t time) const
 
virtual simtime_t computeSimTimeFromClockTime (clocktime_t time) const
 
virtual clocktime_t getClockTime () const
 
virtual clocktime_t getArrivalClockTime (ClockEvent *msg) const
 
- Public Member Functions inherited from inet::queueing::TokenGeneratorBase
virtual const char * resolveDirective (char directive) const override
 
- Public Member Functions inherited from inet::queueing::PacketProcessorBase
virtual bool supportsPacketSending (cGate *gate) const override
 Returns true if the processor supports sending packets at the given gate. More...
 
virtual bool supportsPacketPassing (cGate *gate) const override
 Returns true if the processor supports passing packets as a whole at the given gate. More...
 
virtual bool supportsPacketStreaming (cGate *gate) const override
 Returns true if the processor supports streaming packets at the given gate. More...
 
- Public Member Functions inherited from inet::queueing::IPacketProcessor
virtual ~IPacketProcessor ()
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *message) override
 
virtual void scheduleGenerationTimer ()
 
- Protected Member Functions inherited from inet::queueing::PacketProcessorBase
virtual int numInitStages () const override
 
virtual void refreshDisplay () const override
 
virtual void handlePacketProcessed (Packet *packet)
 
virtual void checkPacketOperationSupport (cGate *gate) const
 
virtual void checkPacketOperationSupport (cGate *startGate, cGate *endGate) const
 
virtual void animate (Packet *packet, cGate *gate, const SendOptions &sendOptions, Action action) const
 
virtual void animatePacket (Packet *packet, cGate *gate, Action action) const
 
virtual void animatePacketStart (Packet *packet, cGate *gate, bps datarate, long transmissionId, Action action) const
 
virtual void animatePacketStart (Packet *packet, cGate *gate, bps datarate, const SendOptions &sendOptions, Action action) const
 
virtual void animatePacketEnd (Packet *packet, cGate *gate, long transmissionId, Action action) const
 
virtual void animatePacketEnd (Packet *packet, cGate *gate, const SendOptions &sendOptions, Action action) const
 
virtual void animatePacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, long transmissionId, Action action) const
 
virtual void animatePacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, const SendOptions &sendOptions, Action action) const
 
virtual void pushOrSendPacket (Packet *packet, cGate *gate, IPassivePacketSink *consumer)
 
virtual void pushOrSendPacketStart (Packet *packet, cGate *gate, IPassivePacketSink *consumer, bps datarate, int transmissionId)
 
virtual void pushOrSendPacketEnd (Packet *packet, cGate *gate, IPassivePacketSink *consumer, int transmissionId)
 
virtual void pushOrSendPacketProgress (Packet *packet, cGate *gate, IPassivePacketSink *consumer, bps datarate, b position, b extraProcessableLength, int transmissionId)
 
virtual void animatePush (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePushPacket (Packet *packet, cGate *gate) const
 
virtual void animatePushPacketStart (Packet *packet, cGate *gate, bps datarate, long transmissionId) const
 
virtual void animatePushPacketStart (Packet *packet, cGate *gate, bps datarate, const SendOptions &sendOptions) const
 
virtual void animatePushPacketEnd (Packet *packet, cGate *gate, long transmissionId) const
 
virtual void animatePushPacketEnd (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePushPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, long transmissionId) const
 
virtual void animatePushPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, const SendOptions &sendOptions) const
 
virtual void animatePull (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePullPacket (Packet *packet, cGate *gate) const
 
virtual void animatePullPacketStart (Packet *packet, cGate *gate, bps datarate, long transmissionId) const
 
virtual void animatePullPacketStart (Packet *packet, cGate *gate, bps datarate, const SendOptions &sendOptions) const
 
virtual void animatePullPacketEnd (Packet *packet, cGate *gate, long transmissionId) const
 
virtual void animatePullPacketEnd (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePullPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, long transmissionId) const
 
virtual void animatePullPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, const SendOptions &sendOptions) const
 
virtual void dropPacket (Packet *packet, PacketDropReason reason, int limit=-1)
 
virtual void updateDisplayString () const
 

Protected Attributes

cPar * generationIntervalParameter = nullptr
 
cPar * numTokensParameter = nullptr
 
ClockEventgenerationTimer = nullptr
 
- Protected Attributes inherited from inet::queueing::TokenGeneratorBase
ModuleRefByPar< ITokenStoragestorage
 
int numTokensGenerated = -1
 
- Protected Attributes inherited from inet::queueing::PacketProcessorBase
const char * displayStringTextFormat = nullptr
 
int numProcessedPackets = -1
 
b processedTotalLength = b(-1)
 

Additional Inherited Members

- Static Public Attributes inherited from inet::queueing::TokenGeneratorBase
static simsignal_t tokensCreatedSignal = cComponent::registerSignal("tokensCreated")
 
- Protected Types inherited from inet::queueing::PacketProcessorBase
enum  Action { PUSH, PULL }
 

Constructor & Destructor Documentation

◆ ~TimeBasedTokenGenerator()

virtual inet::queueing::TimeBasedTokenGenerator::~TimeBasedTokenGenerator ( )
inlinevirtual

Member Function Documentation

◆ handleMessage()

void inet::queueing::TimeBasedTokenGenerator::handleMessage ( cMessage *  message)
overrideprotectedvirtual
33 {
34  if (message == generationTimer) {
35  auto numTokens = numTokensParameter->doubleValue();
36  numTokensGenerated += numTokens;
37  emit(tokensCreatedSignal, numTokens);
38  storage->addTokens(numTokens);
41  }
42  else
43  throw cRuntimeError("Unknown message");
44 }

◆ initialize()

void inet::queueing::TimeBasedTokenGenerator::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::queueing::TokenGeneratorBase.

16 {
17  ClockUserModuleMixin::initialize(stage);
18  if (stage == INITSTAGE_LOCAL) {
19  generationIntervalParameter = &par("generationInterval");
20  numTokensParameter = &par("numTokens");
21  generationTimer = new ClockEvent("GenerationTimer");
22  }
23  else if (stage == INITSTAGE_QUEUEING)
25 }

◆ scheduleGenerationTimer()

void inet::queueing::TimeBasedTokenGenerator::scheduleGenerationTimer ( )
protectedvirtual

◆ supportsPacketPulling()

virtual bool inet::queueing::TimeBasedTokenGenerator::supportsPacketPulling ( cGate *  gate) const
inlineoverridevirtual

Returns true if the processor supports pulling packets at the given gate.

Pulling a packet is a synchronous operation that is initiated by the sink module. A pulled packet can be passed as a whole using pullPacket(), or it can be streamed from the source to the sink using pullPacketStart(), pullPacketEnd(), and pullPacketProgress().

For output gates, true means that the connected module can pull packets from this module. For input gates, true means that this module can pull packets from the connected module. For example, a packet server module can pull packets from a queue module.

Connecting incompatible gates raises an error during initialize. The gate parameter must be a valid gate of this module. The gate should be marked with @labels(pull) in the NED file.

Reimplemented from inet::queueing::TokenGeneratorBase.

35 { return false; }

◆ supportsPacketPushing()

virtual bool inet::queueing::TimeBasedTokenGenerator::supportsPacketPushing ( cGate *  gate) const
inlineoverridevirtual

Returns true if the processor supports pushing packets at the given gate.

Pushing a packet is a synchronous operation that is initiated by the source module. A pushed packet can be passed as a whole using pushPacket(), or it can be streamed from the source to the sink using pushPacketStart(), pushPacketEnd(), and pushPacketProgress().

For output gates, true means that this module can push packets into the connected module. For input gates, true means that the connected module can push packets into this module. For example, a packet generator module can push packets into a queue module.

Connecting incompatible gates raises an error during initialize. The gate parameter must be a valid gate of this module. The gate should be marked with @labels(push) in the NED file.

Reimplemented from inet::queueing::TokenGeneratorBase.

34 { return false; }

Member Data Documentation

◆ generationIntervalParameter

cPar* inet::queueing::TimeBasedTokenGenerator::generationIntervalParameter = nullptr
protected

◆ generationTimer

ClockEvent* inet::queueing::TimeBasedTokenGenerator::generationTimer = nullptr
protected

◆ numTokensParameter

cPar* inet::queueing::TimeBasedTokenGenerator::numTokensParameter = nullptr
protected

Referenced by handleMessage(), and initialize().


The documentation for this class was generated from the following files:
inet::INITSTAGE_QUEUEING
INET_API InitStage INITSTAGE_QUEUEING
Initialization of queueing modules.
inet::ClockUserModuleMixin< TokenGeneratorBase >::scheduleClockEventAfter
virtual void scheduleClockEventAfter(clocktime_t delay, ClockEvent *msg)
Definition: ClockUserModuleMixin.h:65
inet::queueing::TokenGeneratorBase::numTokensGenerated
int numTokensGenerated
Definition: TokenGeneratorBase.h:26
inet::queueing::TimeBasedTokenGenerator::numTokensParameter
cPar * numTokensParameter
Definition: TimeBasedTokenGenerator.h:21
inet::queueing::TimeBasedTokenGenerator::scheduleGenerationTimer
virtual void scheduleGenerationTimer()
Definition: TimeBasedTokenGenerator.cc:27
inet::ClockEvent
cMessage ClockEvent
Definition: contract/ClockEvent.h:18
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::ClockUserModuleMixin< TokenGeneratorBase >::cancelAndDeleteClockEvent
virtual void cancelAndDeleteClockEvent(ClockEvent *msg)
Definition: ClockUserModuleMixin.h:67
inet::queueing::PacketProcessorBase::updateDisplayString
virtual void updateDisplayString() const
Definition: PacketProcessorBase.cc:399
inet::queueing::TimeBasedTokenGenerator::generationTimer
ClockEvent * generationTimer
Definition: TimeBasedTokenGenerator.h:23
inet::queueing::TokenGeneratorBase::storage
ModuleRefByPar< ITokenStorage > storage
Definition: TokenGeneratorBase.h:25
inet::queueing::TimeBasedTokenGenerator::generationIntervalParameter
cPar * generationIntervalParameter
Definition: TimeBasedTokenGenerator.h:20
inet::queueing::TokenGeneratorBase::tokensCreatedSignal
static simsignal_t tokensCreatedSignal
Definition: TokenGeneratorBase.h:22