INET Framework for OMNeT++/OMNEST
inet::AggregatorBase Class Reference

#include <AggregatorBase.h>

Inheritance diagram for inet::AggregatorBase:
inet::queueing::PacketPusherBase inet::queueing::PacketProcessorBase inet::queueing::IPacketPusher inet::queueing::IPacketProcessor inet::StringFormat::IDirectiveResolver inet::queueing::IPassivePacketSink inet::queueing::IActivePacketSource inet::SubpacketLengthHeaderBasedAggregator

Public Member Functions

virtual ~AggregatorBase ()
 
virtual void pushPacket (Packet *packet, cGate *gate) override
 Pushes the packet into the packet sink at the given gate. More...
 
- Public Member Functions inherited from inet::queueing::PacketPusherBase
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 bool canPushSomePacket (cGate *gate) const override
 Returns false if the packet sink is full at the given gate and no more packets can be pushed into it without raising an error. More...
 
virtual bool canPushPacket (Packet *packet, cGate *gate) const override
 Returns true if the given packet can be pushed at the given gate into the packet sink without raising an error. More...
 
virtual void pushPacketStart (Packet *packet, cGate *gate, bps datarate) override
 Starts pushing the packet into the packet sink at the given gate. More...
 
virtual void pushPacketEnd (Packet *packet, cGate *gate) override
 Ends pushing the packet into the packet sink at the given gate. More...
 
virtual void pushPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength=b(0)) override
 Progresses pushing the packet into the packet sink at the given gate. More...
 
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 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...
 
- 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::IPassivePacketSink
virtual ~IPassivePacketSink ()
 
- Public Member Functions inherited from inet::queueing::IActivePacketSource
virtual ~IActivePacketSource ()
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual IAggregatorPolicycreateAggregatorPolicy (const char *aggregatorPolicyClass) const
 
virtual bool isAggregating ()
 
virtual void startAggregation (Packet *packet)
 
virtual void continueAggregation (Packet *packet)
 
virtual void endAggregation (Packet *packet)
 
- Protected Member Functions inherited from inet::queueing::PacketPusherBase
virtual void handleMessage (cMessage *message) 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 deleteSelf = false
 
IAggregatorPolicyaggregatorPolicy = nullptr
 
std::vector< Packet * > aggregatedSubpackets
 
PacketaggregatedPacket = nullptr
 
- Protected Attributes inherited from inet::queueing::PacketPusherBase
cGate * inputGate = nullptr
 
IActivePacketSourceproducer = 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 }
 

Constructor & Destructor Documentation

◆ ~AggregatorBase()

virtual inet::AggregatorBase::~AggregatorBase ( )
inlinevirtual
38 { delete aggregatedPacket; }

Member Function Documentation

◆ continueAggregation()

void inet::AggregatorBase::continueAggregation ( Packet packet)
protectedvirtual

Reimplemented in inet::SubpacketLengthHeaderBasedAggregator.

41 {
42  std::string aggregatedName = aggregatedPacket->getName();
43  if (aggregatedName.length() != 0)
44  aggregatedName += "+";
45  aggregatedName += packet->getName();
46  aggregatedPacket->setName(aggregatedName.c_str());
47  aggregatedSubpackets.push_back(packet);
49  processedTotalLength += packet->getDataLength();
50 }

Referenced by inet::SubpacketLengthHeaderBasedAggregator::continueAggregation(), and pushPacket().

◆ createAggregatorPolicy()

IAggregatorPolicy * inet::AggregatorBase::createAggregatorPolicy ( const char *  aggregatorPolicyClass) const
protectedvirtual
28 {
29  return check_and_cast<IAggregatorPolicy *>(createOne(aggregatorPolicyClass));
30 }

Referenced by initialize().

◆ endAggregation()

void inet::AggregatorBase::endAggregation ( Packet packet)
protectedvirtual
53 {
54  aggregatedSubpackets.clear();
55  aggregatedPacket = nullptr;
56  if (deleteSelf)
57  deleteModule();
58 }

Referenced by pushPacket().

◆ initialize()

void inet::AggregatorBase::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::queueing::PacketPusherBase.

15 {
17  if (stage == INITSTAGE_LOCAL) {
18  deleteSelf = par("deleteSelf");
19  const char *aggregatorPolicyClass = par("aggregatorPolicyClass");
20  if (*aggregatorPolicyClass != '\0')
21  aggregatorPolicy = createAggregatorPolicy(aggregatorPolicyClass);
22  else
23  aggregatorPolicy = findModuleFromPar<IAggregatorPolicy>(par("aggregatorPolicyModule"), this);
24  }
25 }

◆ isAggregating()

virtual bool inet::AggregatorBase::isAggregating ( )
inlineprotectedvirtual
32 { return aggregatedPacket != nullptr; }

Referenced by pushPacket().

◆ pushPacket()

void inet::AggregatorBase::pushPacket ( Packet packet,
cGate *  gate 
)
overridevirtual

Pushes the packet into the packet sink at the given gate.

This operation pushes the packet as a whole. The onwership of the packet is transferred to the sink.

This method is called, for example, when a packet source module pushes a packet into a queue module.

The sink must not be full at the gate. The packet must not be nullptr. The gate must be a valid gate of this module and it must support pushing and passing packets.

Reimplemented from inet::queueing::PacketPusherBase.

61 {
62  Enter_Method("pushPacket");
63  take(subpacket);
64  if (!isAggregating())
65  startAggregation(subpacket);
68  endAggregation(subpacket);
69  startAggregation(subpacket);
70  }
71  continueAggregation(subpacket);
72  EV_INFO << "Aggregating packet" << EV_FIELD(subpacket) << EV_FIELD(packet, *aggregatedPacket) << EV_ENDL;
73  delete subpacket;
75 }

◆ startAggregation()

void inet::AggregatorBase::startAggregation ( Packet packet)
protectedvirtual
33 {
34  ASSERT(aggregatedPacket == nullptr);
35  ASSERT(aggregatedSubpackets.size() == 0);
36  aggregatedPacket = new Packet("");
37  aggregatedPacket->copyTags(*packet); // TODO more complicated?
38 }

Referenced by pushPacket().

Member Data Documentation

◆ aggregatedPacket

◆ aggregatedSubpackets

std::vector<Packet *> inet::AggregatorBase::aggregatedSubpackets
protected

◆ aggregatorPolicy

IAggregatorPolicy* inet::AggregatorBase::aggregatorPolicy = nullptr
protected

Referenced by initialize(), and pushPacket().

◆ deleteSelf

bool inet::AggregatorBase::deleteSelf = false
protected

Referenced by endAggregation(), and initialize().


The documentation for this class was generated from the following files:
inet::AggregatorBase::isAggregating
virtual bool isAggregating()
Definition: AggregatorBase.h:32
inet::queueing::PacketProcessorBase::pushOrSendPacket
virtual void pushOrSendPacket(Packet *packet, cGate *gate, IPassivePacketSink *consumer)
Definition: PacketProcessorBase.cc:126
inet::AggregatorBase::aggregatedSubpackets
std::vector< Packet * > aggregatedSubpackets
Definition: AggregatorBase.h:24
inet::AggregatorBase::deleteSelf
bool deleteSelf
Definition: AggregatorBase.h:21
inet::AggregatorBase::continueAggregation
virtual void continueAggregation(Packet *packet)
Definition: AggregatorBase.cc:40
inet::AggregatorBase::startAggregation
virtual void startAggregation(Packet *packet)
Definition: AggregatorBase.cc:32
inet::utils::createOne
cObject * createOne(const char *className, const char *defaultNamespace)
Like cObjectFactory::createOne(), except it starts searching for the class in the given namespace.
Definition: INETUtils.cc:147
inet::queueing::PacketProcessorBase::processedTotalLength
b processedTotalLength
Definition: PacketProcessorBase.h:31
inet::AggregatorBase::endAggregation
virtual void endAggregation(Packet *packet)
Definition: AggregatorBase.cc:52
inet::IAggregatorPolicy::isAggregatablePacket
virtual bool isAggregatablePacket(Packet *aggregatedPacket, std::vector< Packet * > &aggregatedSubpackets, Packet *newSubpacket)=0
inet::AggregatorBase::aggregatedPacket
Packet * aggregatedPacket
Definition: AggregatorBase.h:25
inet::queueing::PacketPusherBase::outputGate
cGate * outputGate
Definition: PacketPusherBase.h:25
EV_FIELD
#define EV_FIELD(...)
Definition: INETDefs.h:112
inet::queueing::PacketPusherBase::initialize
virtual void initialize(int stage) override
Definition: PacketPusherBase.cc:16
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::queueing::PacketProcessorBase::numProcessedPackets
int numProcessedPackets
Definition: PacketProcessorBase.h:30
inet::queueing::PacketProcessorBase::updateDisplayString
virtual void updateDisplayString() const
Definition: PacketProcessorBase.cc:399
inet::queueing::PacketPusherBase::consumer
IPassivePacketSink * consumer
Definition: PacketPusherBase.h:26
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
EV_ENDL
#define EV_ENDL
Definition: INETDefs.h:114
inet::AggregatorBase::aggregatorPolicy
IAggregatorPolicy * aggregatorPolicy
Definition: AggregatorBase.h:22
inet::Packet::copyTags
void copyTags(const Packet &source)
Copies the set of packet tags from the other packet.
Definition: Packet.h:1275
inet::AggregatorBase::createAggregatorPolicy
virtual IAggregatorPolicy * createAggregatorPolicy(const char *aggregatorPolicyClass) const
Definition: AggregatorBase.cc:27