Click
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SimpleBatchElement< T > Class Template Reference

#include <batchelement.hh>

Inherits BatchElement.

Public Member Functions

void push (int port, Packet *p) override
 Push packet p onto push input port.
 
Packet * pull (int port) override
 Pull a packet from pull output port.
 

Detailed Description

template<typename T>
class SimpleBatchElement< T >

Batch helper element.

Allows the user to simply implement simple_action and simple_action_batch but relying on CRTP instead of virtual, removing one virtual call.

The inherited element cannot be extended further because of CRTP !

Member Function Documentation

◆ push()

template<typename T >
void SimpleBatchElement< T >::push ( int  port,
Packet *  p 
)
inlineoverridevirtual

Push packet p onto push input port.

Parameters
portthe input port number on which the packet arrives
pthe packet

An upstream element transferred packet p to this element over a push connection. This element should process the packet as necessary and return. The packet arrived on input port port. push() must account for the packet either by pushing it further downstream, by freeing it, or by storing it temporarily.

The default implementation calls simple_action().

Reimplemented from Element.

◆ pull()

template<typename T >
Packet * SimpleBatchElement< T >::pull ( int  port)
inlineoverridevirtual

Pull a packet from pull output port.

Parameters
portthe output port number receiving the pull request.
Returns
a packet

A downstream element initiated a packet transfer from this element over a pull connection. This element should return a packet pointer, or null if no packet is available. The pull request arrived on output port port.

Often, pull() methods will request packets from upstream using input(i).pull(). The default implementation calls simple_action().

Reimplemented from Element.


The documentation for this class was generated from the following file: