senf::ppi::connector::InputConnector Class Reference

Input connector base-class. More...

#include <senf/PPI/Connectors.hh>

Inheritance diagram for senf::ppi::connector::InputConnector:

Public Types

typedef Queue::const_iterator queue_iterator
 Iterator type of the embedded queue. More...
 
typedef Queue::size_type size_type
 Unsigned type for counting queue elements. More...
 
- Public Types inherited from senf::ppi::connector::Connector
enum  TraceState { NO_TRACING, TRACE_IDS, TRACE_CONTENTS }
 

Public Member Functions

Packet const & operator() ()
 Get a packet. More...
 
Packet const & read ()
 Alias for operator()() More...
 
OutputConnectorpeer () const
 
size_type queueSize () const
 Return number of elements in the queue. More...
 
bool empty () const
 Return queueSize() == 0. More...
 
- Public Member Functions inherited from senf::ppi::connector::Connector
Connectorpeer () const
 Get peer connected to this connector. More...
 
module::Modulemodule () const
 Get this connectors containing module. More...
 
bool connected () const
 true, if connector connected, false otherwise More...
 
void disconnect ()
 Disconnect connector from peer. More...
 
console::DirectoryNodeconsoleDir () const
 
void tracingState (TraceState state)
 
TraceState tracingState () const
 

Protected Member Functions

 InputConnector ()
 
virtual void v_disconnected ()
 
virtual void v_connected ()
 
- Protected Member Functions inherited from senf::ppi::connector::Connector
 Connector ()
 
virtual ~Connector ()
 
void connect (Connector &target)
 
void trace (Packet const &p, char const *label)
 
void throttleTrace (char const *label, char const *type)
 
void unregisterConnector ()
 

Additional Inherited Members

- Static Public Member Functions inherited from senf::ppi::connector::Connector
static void staticTracingState (TraceState state)
 
static void tracingFilter (std::string const &traceFilter)
 

Detailed Description

Input connector base-class.

An input connector receives packets. It may be either an ActiveConnector or a PassiveConnector. An input connector contains a packet queue. This queue enables processing packets in batches or generating multiple output packets from a single input packet. The queues have the potential to greatly simplify the module implementations.

Implementation note:
Which container to use?
  • list has good insertion and deletion properties on both ends but it costs a dynamic memory allocation for every insertion. A very good property is, that iterators stay valid across insertions/deletions
  • vector is fast and has good amortized dynamic allocation properties. However, it is quite unusable as a queue
  • deque has comparable dynamic allocation properties as vector but also has good insertion/removal properties on both ends.
So probably we will use a deque. I'd like a container which keeps iterators intact on insertion/deletion but I believe that list is just to expensive since every packet will be added to the queue before it can be processed.

Definition at line 397 of file Connectors.hh.

Member Typedef Documentation

◆ queue_iterator

Iterator type of the embedded queue.

Definition at line 402 of file Connectors.hh.

◆ size_type

Unsigned type for counting queue elements.

Definition at line 403 of file Connectors.hh.

Constructor & Destructor Documentation

◆ InputConnector()

senf::ppi::connector::InputConnector::InputConnector ( )
protected

Member Function Documentation

◆ empty()

bool senf::ppi::connector::InputConnector::empty ( ) const

Return queueSize() == 0.

◆ operator()()

senf::Packet const & senf::ppi::connector::InputConnector::operator() ( )

Get a packet.

This member is the primary method to access received data. On passive connectors, this operator will just dequeue a packet from the packet queue. If the connector is active, the connector will request new packets from the connected module. If the packet request cannot be fulfilled an in-valid Packet is returned.

Definition at line 408 of file Connectors.cc.

◆ peer()

OutputConnector& senf::ppi::connector::InputConnector::peer ( ) const

◆ queueSize()

size_type senf::ppi::connector::InputConnector::queueSize ( ) const

Return number of elements in the queue.

◆ read()

Packet const& senf::ppi::connector::InputConnector::read ( )

Alias for operator()()

◆ v_connected()

void senf::ppi::connector::InputConnector::v_connected ( )
protectedvirtual

◆ v_disconnected()

void senf::ppi::connector::InputConnector::v_disconnected ( )
protectedvirtual

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