senf::ppi::module::ActiveSocketSource< Reader > Class Template Reference

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

#include <senf/PPI/SocketSource.hh>

Inheritance diagram for senf::ppi::module::ActiveSocketSource< Reader >:

Classes

struct  RxStats
 

Public Types

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

Public Member Functions

 ActiveSocketSource (unsigned max_burst=1)
 
 ActiveSocketSource (Reader reader, unsigned max_burst=1)
 
 ActiveSocketSource (Handle const &handle, unsigned max_burst=1)
 
 ActiveSocketSource (Handle const &handle, Reader reader, unsigned max_burst=1)
 
Reader & reader ()
 Access Reader helper. More...
 
Handle handle ()
 Access handle. More...
 
void handle (Handle const &handle)
 Set handle. More...
 
unsigned maxBurst () const
 
void maxBurst (unsigned max_burst)
 
void flush ()
 
RxStatsrxStats ()
 
- Public Member Functions inherited from senf::ppi::module::Module
virtual ~Module ()
 

Public Attributes

connector::ActiveOutput< typename Reader::PacketType > output
 Output connector to which the data received is written. 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 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.

Member Typedef Documentation

◆ Handle

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

◆ ActiveSocketSource() [1/4]

template<class Reader = DgramReader<>>
senf::ppi::module::ActiveSocketSource< Reader >::ActiveSocketSource ( unsigned  max_burst = 1)

◆ ActiveSocketSource() [2/4]

template<class Reader = DgramReader<>>
senf::ppi::module::ActiveSocketSource< Reader >::ActiveSocketSource ( Reader  reader,
unsigned  max_burst = 1 
)
explicit

◆ ActiveSocketSource() [3/4]

template<class Reader = DgramReader<>>
senf::ppi::module::ActiveSocketSource< Reader >::ActiveSocketSource ( Handle const &  handle,
unsigned  max_burst = 1 
)
explicit

◆ ActiveSocketSource() [4/4]

template<class Reader = DgramReader<>>
senf::ppi::module::ActiveSocketSource< Reader >::ActiveSocketSource ( Handle const &  handle,
Reader  reader,
unsigned  max_burst = 1 
)

Member Function Documentation

◆ flush()

template<class Reader = DgramReader<>>
void senf::ppi::module::ActiveSocketSource< Reader >::flush ( )

◆ handle() [1/2]

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

Access handle.

◆ handle() [2/2]

template<class Reader = DgramReader<>>
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.

◆ maxBurst() [1/2]

template<class Reader = DgramReader<>>
unsigned senf::ppi::module::ActiveSocketSource< Reader >::maxBurst ( ) const

◆ maxBurst() [2/2]

template<class Reader = DgramReader<>>
void senf::ppi::module::ActiveSocketSource< Reader >::maxBurst ( unsigned  max_burst)

◆ reader()

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

Access Reader helper.

◆ rxStats()

template<class Reader = DgramReader<>>
RxStats& senf::ppi::module::ActiveSocketSource< Reader >::rxStats ( )
inline

Definition at line 152 of file SocketSource.hh.

Member Data Documentation

◆ output

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 116 of file SocketSource.hh.


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