#include <senf/PPI/Module.hh>
Inherits senf::ppi::ModuleManager::Initializable, and noncopyable.
Inherited by senf::ppi::module::MonitorModule<>, senf::ppi::module::ActiveDuplicator, senf::ppi::module::ActiveFeeder, senf::ppi::module::ActiveQueueSocketSource< Packet, Connector >, senf::ppi::module::ActiveSocketSink< Writer >, senf::ppi::module::ActiveSocketSource< Reader >, senf::ppi::module::AnnotationRouter< AnnotationType >, senf::ppi::module::CloneSource, senf::ppi::module::debug::ActiveSink, senf::ppi::module::debug::ActiveSource, senf::ppi::module::debug::PassiveSink, senf::ppi::module::debug::PassiveSource, senf::ppi::module::DiscardSink, senf::ppi::module::MonitorModule< PacketType >, senf::ppi::module::PassiveJoin< PacketType >, senf::ppi::module::PassiveQueue, senf::ppi::module::PassiveQueueingSocketSink< Writer >, senf::ppi::module::PassiveQueueSocketSink< Connector >, senf::ppi::module::PassiveSocketSink< Writer >, senf::ppi::module::PriorityJoin, senf::ppi::module::QueueEthVLanFilter, senf::ppi::module::RateFilter, and senf::ppi::module::ThrottleBarrier.
Public Member Functions | |
virtual | ~Module () |
Protected Member Functions | |
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::DirectoryNode & | sysConsoleDir () const |
void | destroy () |
Module base-class.
senf::ppi::Module is the base-class of all PPI modules. It provides the module implementation with interfaces to several PPI facilities:
To provide internal bookkeeping, most access to the PPI infrastructure is managed through this base class. This is an example module specification:
If your module only has a single input connector, you should call this connector \c input. If it has only a single output connector, you should call it \c output. This allows to setup connections without stating the connector explicitly (see senf::ppi::connect()). \see \ref ppi_modules
|
virtual |
|
protected |
|
protected |
|
protected |
Define terminal connectors.
The noroute() member explicitly declares, that a connector is terminal and does not directly receive/forward data from/to some other connector. It is mandatory to define routing information for terminal connectors.
See the route() documentation for more on routing
[in] | connector | Terminal connector to declare |
|
protected |
Current time of the currently processing event.
|
protected |
Register an external event.
The target argument may be either an arbitrary callable object or it may be a member function pointer pointing to a member function of the Module derived classed. The handler may optionally take an Argument of type Descriptor::Event const &
. This object allows to access detailed information on the event delivered.
The descriptor describes the event to signal like a timer event or some type of I/O event on a file descriptor or socket.
[in] | target | The handler to call whenever the event is signaled |
[in] | descriptor | The type of event to register |
|
protected |
Define flow information.
Using the route() and noroute() members, the information flow within the module is defined. Routing may be defined between inputs, outputs and events. The routing information is used to perform automatic throttling. The throttling behavior may however be controlled manually.
Even if no automatic throttling is desired it is essential to define the flow information for all inputs and outputs. Without flow information important internal state of the module cannot be initialized. This includes, explicitly defining terminal inputs and outputs using noroute. Event routing is optional however.
The return value may be used to alter routing parameters like throttling parameters.
[in] | input | Data source, object which controls incoming data (connector or event) |
[in] | output | Data target, object which controls outgoing data (connector or event) |
|
protected |
Define flow information.
Route from a connector to an event. Routing from a connector to an event defines the event as the conceptual 'receiver' of the data. This means, the event is controlling the processing of received data packets (Example: Routing from an input to an IOEvent defines, that input data will be processed whenever the event is signaled.).
This event routing allows to automatically enable/disable the event on throttling notifications.
|
protected |
Define flow information.
Route from an event to a connector. Routing from an event to a connector defines the event as the conceptual 'source' of the data. This means, the event controls how packets are sent (Example: Routing from an IOEvent to an output defines, that output data will be generated whenever the event is signaled).
This event routing allows to automatically enable/disable the event on throttling notifications.
|
protected |
|
protected |
Time-stamp of the currently processing event.
If available, this returns the scheduled time of the event.
|
protectedvirtual |
Called after module setup.
This member is called directly before the PPI (resumes) execution. It is called after connections have been setup before entering the PPI main loop.
You may overload this member. Your overload should always call the base-class implementation.
Implements senf::ppi::ModuleManager::Initializable.