Click
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SimpleElement< 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 SimpleElement< T >

Batch helper element.

Build an element that implements only simple_action, and which does not call pull or push. Just extend SimpleElement<T> where T is the new element itself. It also avoids the virtual call, so a vanilla element using this version even without batching will run faster.

Downside : The inherited element cannot be extended further because of CRTP !

Member Function Documentation

◆ push()

template<typename T >
void SimpleElement< 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 * SimpleElement< 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: