senf::ppi::module::PassiveSocketSink< Writer > Class Template Reference
[Source/Sink Modules]

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 >:
Inheritance graph
[legend]

List of all members.


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 273 of file SocketSink.hh.


Public Types

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

Public Member Functions

  PassiveSocketSink ()
  Create non-connected writer.
  PassiveSocketSink (Writer const &writer)
  Create non-connected writer.
  PassiveSocketSink (Handle const &handle)
  Create new writer for the given handle.
  PassiveSocketSink (Handle const &handle, Writer const &writer)
  Create new writer for the given handle.
Writer &  writer ()
  Access the Writer.
Handle handle ()
  Access handle.
void  handle (Handle const &handle)
  Set handle.

Public Attributes

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

Member Typedef Documentation

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

Handle type requested by writer.

Definition at line 275 of file SocketSink.hh.


Constructor & Destructor Documentation

template<class Writer >
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

Definition at line 81 of file SocketSink.ct.

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

Create non-connected writer.

The writer will be disabled until a socket is set

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

Definition at line 89 of file SocketSink.ct.

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

Create new writer for the given handle.

Data will be written to handle using Writer.

Precondition:
Requires Writer to be default constructible
Parameters:
[in]  handle  Handle to write data to

Definition at line 98 of file SocketSink.ct.

template<class Writer >
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]  handle  Handle to write data to
[in]  writer  Writer helper writing packet date to the socket

Definition at line 107 of file SocketSink.ct.


Member Function Documentation

template<class Writer >
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.

Definition at line 109 of file SocketSink.cti.

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

Access handle.

Definition at line 103 of file SocketSink.cti.

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

Access the Writer.

Definition at line 97 of file SocketSink.cti.


Member Data Documentation

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 280 of file SocketSink.hh.


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