senf::ppi::module::PassiveSocketSink< Writer > Class Template Reference

Output module writing data to a FileHandle using the provided Writer. If using the default ConnectedDgramWriter the filehandle must be writable, connected and able to handle complete datagrams. More...

#include <senf/PPI/SocketSink.hh>

Inheritance diagram for senf::ppi::module::PassiveSocketSink< Writer >:

Classes

struct  TxStats
 

Public Types

typedef Writer::Handle Handle
 Handle type requested by writer. More...
 

Public Member Functions

 PassiveSocketSink ()
 Create non-connected writer. More...
 
 PassiveSocketSink (Writer const &writer)
 Create non-connected writer. More...
 
 PassiveSocketSink (Handle const &handle)
 Create new writer for the given handle. More...
 
 PassiveSocketSink (Handle const &handle, Writer const &writer)
 Create new writer for the given handle. More...
 
Writer & writer ()
 Access the Writer. More...
 
Handlehandle ()
 Access handle. More...
 
void handle (Handle const &handle)
 Set handle. More...
 
TxStatstxStats ()
 
- Public Member Functions inherited from senf::ppi::module::Module
virtual ~Module ()
 

Public Attributes

connector::PassiveInput< typename Writer::PacketType > input
 Input connector from which data is received. More...
 

Additional Inherited Members

- Protected Member Functions inherited from senf::ppi::module::Module
 Module ()
 
Route< connector::InputConnector, connector::OutputConnector > & route (connector::InputConnector &input, connector::OutputConnector &output)
 Define flow information. More...
 
Route< connector::InputConnector, EventDescriptor > & route (connector::InputConnector &input, EventDescriptor &output)
 Define flow information. More...
 
Route< EventDescriptor, connector::OutputConnector > & route (EventDescriptor &input, connector::OutputConnector &output)
 Define flow information. More...
 
void noroute (connector::Connector &connector)
 Define terminal connectors. More...
 
template<class Target >
void registerEvent (EventDescriptor &descriptor, Target target)
 Register an external event. More...
 
ClockService::clock_type const & time () const
 Time-stamp of the currently processing event. More...
 
ClockService::clock_type const & now () const
 Current time of the currently processing event. More...
 
virtual void v_init ()
 Called after module setup. More...
 
console::DirectoryNodesysConsoleDir () const
 
void destroy ()
 

Detailed Description

template<class Writer = ConnectedDgramWriter>
class senf::ppi::module::PassiveSocketSink< Writer >

Output module writing data to a FileHandle using the provided Writer. If using the default ConnectedDgramWriter the filehandle must be writable, connected and able to handle complete datagrams.

This output module will write data to a FileHandle object using a given Writer. This output module is passive. This implies, that the output handle may not block. This also implies, that data will probably get lost if written to fast for the underlying transport mechanism. Either this is desired (like for a UDP socket) or some additional bandwidth shaping needs to be used.

The default Writer is senf::ppi::ConnectedDgramWriter which will write out the complete packet to the file handle.

The Writer must fulfill the following interface:

class SomeWriter
{
public:
typedef unspecified Handle; // type of handle requested
typedef unspecified_type PacketType // type of packet read
SomeWriter(); // EITHER default constructible
SomeWriter(SomeWriter const & other); // OR copy constructible
bool operator()(Handle handle, Packet packet); // insertion function
};

Whenever a packet is received for sending, the Writer's operator() is called.

Definition at line 300 of file SocketSink.hh.

Member Typedef Documentation

◆ Handle

template<class Writer = ConnectedDgramWriter>
typedef Writer::Handle senf::ppi::module::PassiveSocketSink< Writer >::Handle

Handle type requested by writer.

Definition at line 302 of file SocketSink.hh.

Constructor & Destructor Documentation

◆ PassiveSocketSink() [1/4]

template<class Writer = ConnectedDgramWriter>
senf::ppi::module::PassiveSocketSink< Writer >::PassiveSocketSink ( )

Create non-connected writer.

The writer will be disabled until a socket is set

Precondition
Requires Writer to be default constructible

◆ PassiveSocketSink() [2/4]

template<class Writer = ConnectedDgramWriter>
senf::ppi::module::PassiveSocketSink< Writer >::PassiveSocketSink ( Writer const &  writer)
explicit

Create non-connected writer.

The writer will be disabled until a socket is set

Precondition
Requires Writer to be copy constructible
Parameters
[in]writerWriter helper writing packet date to the socket

◆ PassiveSocketSink() [3/4]

template<class Writer = ConnectedDgramWriter>
senf::ppi::module::PassiveSocketSink< Writer >::PassiveSocketSink ( Handle const &  handle)
explicit

Create new writer for the given handle.

Data will be written to handle using Writer.

Precondition
Requires Writer to be default constructible
Parameters
[in]handleHandle to write data to

◆ PassiveSocketSink() [4/4]

template<class Writer = ConnectedDgramWriter>
senf::ppi::module::PassiveSocketSink< Writer >::PassiveSocketSink ( Handle const &  handle,
Writer const &  writer 
)

Create new writer for the given handle.

Data will be written to handle using Writer.

Precondition
Requires Writer to be copy constructible
Parameters
[in]handleHandle to write data to
[in]writerWriter helper writing packet date to the socket

Member Function Documentation

◆ handle() [1/2]

template<class Writer = ConnectedDgramWriter>
Handle& senf::ppi::module::PassiveSocketSink< Writer >::handle ( )

Access handle.

◆ handle() [2/2]

template<class Writer = ConnectedDgramWriter>
void senf::ppi::module::PassiveSocketSink< Writer >::handle ( Handle const &  handle)

Set handle.

Assigning an empty or in-valid() handle will disable the module until a new valid handle is assigned.

◆ txStats()

template<class Writer = ConnectedDgramWriter>
TxStats& senf::ppi::module::PassiveSocketSink< Writer >::txStats ( )
inline

Definition at line 354 of file SocketSink.hh.

◆ writer()

template<class Writer = ConnectedDgramWriter>
Writer& senf::ppi::module::PassiveSocketSink< Writer >::writer ( )

Access the Writer.

Member Data Documentation

◆ input

template<class Writer = ConnectedDgramWriter>
connector::PassiveInput<typename Writer::PacketType> senf::ppi::module::PassiveSocketSink< Writer >::input

Input connector from which data is received.

Definition at line 307 of file SocketSink.hh.


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