senf::ppi::module::ActiveSocketSource< Reader > Class Template Reference
[Source/Sink Modules]

Input module reading data from an arbitrary FileHandle. More...

#include <senf/PPI/SocketSource.hh>

Inheritance diagram for senf::ppi::module::ActiveSocketSource< Reader >:
Inheritance graph
[legend]

List of all members.


Detailed Description

template<class Reader = DgramReader<>>
class senf::ppi::module::ActiveSocketSource< Reader >

Input module reading data from an arbitrary FileHandle.

This input module will read data from a FileHandle object and parse the data according to the Reader. The default reader is senf::ppi::DgramReader <> which reads the data into a senf::DataPacket. To parse the data according to some other packet type, pass that packet type to senf::ppi::DgramReader:

declares a reader module reading senf::EthernetPacket's

A Reader must fulfill the following interface:

class SomeReader
{
public:
    typedef unspecified_type Handle;                       // type of handle requested
    typedef unspecified_type PacketType                    // type of packet returned

    SomeReader();                                          // EITHER default constructible
    SomeReader(SomeReader const & other);                  // OR copy constructible

    PacketType operator()(Handle handle);                  // extraction function
};
Whenever the FileHandle object is ready for reading, the Reader's operator() is called to read a packet.

Definition at line 108 of file SocketSource.hh.


Public Types

typedef Reader::Handle  Handle
  Handle type requested by the reader.

Public Member Functions

  ActiveSocketSource ()
  Create non-connected reader.
  ActiveSocketSource (Reader reader)
  Create non-connected reader.
  ActiveSocketSource (Handle const &handle)
  Create new reader for the given handle.
  ActiveSocketSource (Handle const &handle, Reader reader)
  Create new reader for the given handle.
Reader &  reader ()
  Access Reader helper.
Handle  handle ()
  Access handle.
void  handle (Handle const &handle)
  Set handle.

Public Attributes

connector::ActiveOutput
< typename Reader::PacketType > 
output
  Output connector to which the data received is written.

Member Typedef Documentation

template<class Reader = DgramReader<>>
typedef Reader::Handle senf::ppi::module::ActiveSocketSource< Reader >::
Handle

Handle type requested by the reader.

Definition at line 111 of file SocketSource.hh.


Constructor & Destructor Documentation

template<class Reader >
senf::ppi::module::ActiveSocketSource< Reader >::
ActiveSocketSource ()

Create non-connected reader.

The reader will be disabled until a socket is set

Precondition:
Requires Reader to be default constructible

Definition at line 48 of file SocketSource.ct.

template<class Reader>
senf::ppi::module::ActiveSocketSource< Reader >::
ActiveSocketSource ( Reader  reader )

Create non-connected reader.

The reader will be disabled until a socket is set

Precondition:
Requires Reader to be copy constructible

Definition at line 55 of file SocketSource.ct.

template<class Reader>
senf::ppi::module::ActiveSocketSource< Reader >::
ActiveSocketSource ( Handle const &  handle )

Create new reader for the given handle.

Data will be read from handle and be parsed by Reader.

Precondition:
Requires Reader to be default constructible
Parameters:
[in]  handle  Handle to read data from

Definition at line 63 of file SocketSource.ct.

template<class Reader>
senf::ppi::module::ActiveSocketSource< Reader >::
ActiveSocketSource ( Handle const &  handle,
Reader  reader )

Create new reader for the given handle.

Data will be read from handle and be parsed by Reader.

Precondition:
Requires Reader to be copy constructible
Parameters:
[in]  handle  Handle to read data from

Definition at line 71 of file SocketSource.ct.


Member Function Documentation

template<class Reader >
void senf::ppi::module::ActiveSocketSource< Reader >::
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 50 of file SocketSource.cti.

template<class Reader >
senf::ppi::module::ActiveSocketSource< Reader >::Handle senf::ppi::module::ActiveSocketSource< Reader >::
handle ()

Access handle.

Definition at line 44 of file SocketSource.cti.

template<class Reader >
Reader & senf::ppi::module::ActiveSocketSource< Reader >::
reader ()

Access Reader helper.

Definition at line 37 of file SocketSource.cti.


Member Data Documentation

template<class Reader = DgramReader<>>
connector::ActiveOutput<typename Reader::PacketType> senf::ppi::module::ActiveSocketSource< Reader >::
output

Output connector to which the data received is written.

Definition at line 117 of file SocketSource.hh.


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