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

#include <InstantServer.h>

Inheritance diagram for inet::queueing::InstantServer:
inet::queueing::PacketServerBase inet::queueing::PacketProcessorBase inet::queueing::IActivePacketSink inet::queueing::IActivePacketSource inet::queueing::IPacketProcessor inet::StringFormat::IDirectiveResolver

Public Member Functions

virtual void handleCanPushPacketChanged (cGate *gate) override
 Notifies about a change in the possibility of pushing some packet into the passive packet sink at the given gate. More...
 
virtual void handleCanPullPacketChanged (cGate *gate) override
 Notifies about a change in the possibility of pulling some packet from the passive packet source at the given gate. More...
 
- Public Member Functions inherited from inet::queueing::PacketServerBase
virtual IPassivePacketSourcegetProvider (cGate *gate) override
 Returns the passive packet source from where packets are pulled or nullptr if the connected module doesn't implement the interface. More...
 
virtual IPassivePacketSinkgetConsumer (cGate *gate) override
 Returns the passive packet sink where packets are pushed or nullptr if the connected module doesn't implement the interface. More...
 
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...
 
virtual void handlePushPacketProcessed (Packet *packet, cGate *gate, bool successful) override
 Notifies about the completion of the packet processing for a packet that was pushed earlier independently whether the packet is passed or streamed. More...
 
virtual void handlePullPacketProcessed (Packet *packet, cGate *gate, bool successful) override
 Notifies about the completion of the packet processing for a packet that was pulled earlier independently whether the packet is passed or streamed. More...
 
- 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...
 
virtual const char * resolveDirective (char directive) const override
 
- Public Member Functions inherited from inet::queueing::IPacketProcessor
virtual ~IPacketProcessor ()
 
- Public Member Functions inherited from inet::queueing::IActivePacketSink
virtual ~IActivePacketSink ()
 
- Public Member Functions inherited from inet::queueing::IActivePacketSource
virtual ~IActivePacketSource ()
 

Protected Member Functions

virtual bool canProcessPacket ()
 
virtual void processPacket ()
 
virtual void processPackets ()
 
- Protected Member Functions inherited from inet::queueing::PacketServerBase
virtual void initialize (int stage) override
 
- 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

bool isProcessing = false
 
- Protected Attributes inherited from inet::queueing::PacketServerBase
cGate * inputGate = nullptr
 
IPassivePacketSourceprovider = nullptr
 
cGate * outputGate = nullptr
 
IPassivePacketSinkconsumer = nullptr
 
- Protected Attributes inherited from inet::queueing::PacketProcessorBase
const char * displayStringTextFormat = nullptr
 
int numProcessedPackets = -1
 
b processedTotalLength = b(-1)
 

Additional Inherited Members

- Protected Types inherited from inet::queueing::PacketProcessorBase
enum  Action { PUSH, PULL }
 

Member Function Documentation

◆ canProcessPacket()

bool inet::queueing::InstantServer::canProcessPacket ( )
protectedvirtual
18 {
19  auto inputGatePathStartGate = inputGate->getPathStartGate();
20  auto outputGatePathEndGate = outputGate->getPathEndGate();
21  if (provider->canPullSomePacket(inputGatePathStartGate) && consumer->canPushSomePacket(outputGatePathEndGate))
22  return true;
23  else {
24  auto packet = provider->canPullPacket(inputGatePathStartGate);
25  return packet != nullptr && consumer->canPushPacket(packet, outputGatePathEndGate);
26  }
27 }

Referenced by processPackets().

◆ handleCanPullPacketChanged()

void inet::queueing::InstantServer::handleCanPullPacketChanged ( cGate *  gate)
overridevirtual

Notifies about a change in the possibility of pulling some packet from the passive packet source at the given gate.

This method is called, for example, when a new packet is inserted into a queue. It allows the sink to pull a new packet from the queue.

The gate parameter must be a valid gate of this module.

Implements inet::queueing::IActivePacketSink.

51 {
52  Enter_Method("handleCanPullPacketChanged");
54 }

◆ handleCanPushPacketChanged()

void inet::queueing::InstantServer::handleCanPushPacketChanged ( cGate *  gate)
overridevirtual

Notifies about a change in the possibility of pushing some packet into the passive packet sink at the given gate.

This method is called, for example, when a new packet can be inserted into a queue. It allows the source to push a new packet into the queue.

The gate parameter must be a valid gate of this module.

Implements inet::queueing::IActivePacketSource.

45 {
46  Enter_Method("handleCanPushPacketChanged");
48 }

◆ processPacket()

void inet::queueing::InstantServer::processPacket ( )
protectedvirtual
30 {
31  auto packet = provider->pullPacket(inputGate->getPathStartGate());
32  take(packet);
33  emit(packetPulledSignal, packet);
34  std::string packetName = packet->getName();
35  auto packetLength = packet->getDataLength();
36  EV_INFO << "Processing packet started" << EV_FIELD(packet) << EV_ENDL;
37  emit(packetPushedSignal, packet);
39  processedTotalLength += packetLength;
41  EV_INFO << "Processing packet ended" << EV_ENDL;
42 }

Referenced by processPackets().

◆ processPackets()

void inet::queueing::InstantServer::processPackets ( )
protectedvirtual
57 {
58  if (!isProcessing) {
59  isProcessing = true;
60  while (canProcessPacket())
61  processPacket();
62  isProcessing = false;
64  }
65 }

Referenced by handleCanPullPacketChanged(), and handleCanPushPacketChanged().

Member Data Documentation

◆ isProcessing

bool inet::queueing::InstantServer::isProcessing = false
protected

Referenced by processPackets().


The documentation for this class was generated from the following files:
inet::queueing::PacketProcessorBase::pushOrSendPacket
virtual void pushOrSendPacket(Packet *packet, cGate *gate, IPassivePacketSink *consumer)
Definition: PacketProcessorBase.cc:126
inet::queueing::PacketServerBase::consumer
IPassivePacketSink * consumer
Definition: PacketServerBase.h:25
inet::queueing::InstantServer::processPackets
virtual void processPackets()
Definition: InstantServer.cc:56
inet::queueing::IPassivePacketSink::canPushPacket
virtual bool canPushPacket(Packet *packet, cGate *gate) const =0
Returns true if the given packet can be pushed at the given gate into the packet sink without raising...
inet::queueing::IPassivePacketSource::canPullPacket
virtual Packet * canPullPacket(cGate *gate) const =0
Returns the packet that can be pulled at the given gate.
inet::packetPulledSignal
simsignal_t packetPulledSignal
Definition: Simsignals.cc:105
inet::queueing::IPassivePacketSink::canPushSomePacket
virtual bool canPushSomePacket(cGate *gate) const =0
Returns false if the packet sink is full at the given gate and no more packets can be pushed into it ...
inet::queueing::PacketProcessorBase::processedTotalLength
b processedTotalLength
Definition: PacketProcessorBase.h:31
inet::queueing::PacketServerBase::provider
IPassivePacketSource * provider
Definition: PacketServerBase.h:22
inet::packetPushedSignal
simsignal_t packetPushedSignal
Definition: Simsignals.cc:99
EV_FIELD
#define EV_FIELD(...)
Definition: INETDefs.h:112
inet::queueing::PacketProcessorBase::numProcessedPackets
int numProcessedPackets
Definition: PacketProcessorBase.h:30
inet::queueing::PacketProcessorBase::updateDisplayString
virtual void updateDisplayString() const
Definition: PacketProcessorBase.cc:399
inet::queueing::InstantServer::isProcessing
bool isProcessing
Definition: InstantServer.h:19
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::queueing::InstantServer::canProcessPacket
virtual bool canProcessPacket()
Definition: InstantServer.cc:17
inet::queueing::PacketServerBase::outputGate
cGate * outputGate
Definition: PacketServerBase.h:24
inet::queueing::InstantServer::processPacket
virtual void processPacket()
Definition: InstantServer.cc:29
inet::queueing::IPassivePacketSource::canPullSomePacket
virtual bool canPullSomePacket(cGate *gate) const =0
Returns false if the packet source is empty at the given gate and no more packets can be pulled from ...
EV_ENDL
#define EV_ENDL
Definition: INETDefs.h:114
inet::queueing::IPassivePacketSource::pullPacket
virtual Packet * pullPacket(cGate *gate)=0
Pulls the packet from the packet source at the given gate.
inet::queueing::PacketServerBase::inputGate
cGate * inputGate
Definition: PacketServerBase.h:21