User Manual, Developers Guide and API Documentation

wns::ldk::multiplexer::Dispatcher Class Reference

Tag compounds of multiple paths, delivering incoming compounds to the right FU. More...

#include <ldk/multiplexer/Dispatcher.hpp>

Inheritance diagram for wns::ldk::multiplexer::Dispatcher:

Inheritance graph
[legend]
Collaboration diagram for wns::ldk::multiplexer::Dispatcher:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void calculateSizes (const CommandPool *commandPool, Bit &commandPoolSize, Bit &sduSize) const
 Default calculateSizes implementation.
 Dispatcher (fun::FUN *fuNet, const pyconfig::View &_config)
int getOpcodeSize () const
virtual void processIncoming (const CompoundPtr &compound)
 Process compounds on uplink.
virtual void processOutgoing (const CompoundPtr &compound)
 Process compounds on downlink.
virtual FunctionalUnitwhenConnecting ()
 Return the FunctionalUnit holding the connector set for this FunctionalUnit.
virtual ~Dispatcher ()

Private Attributes

pyconfig::View config
logger::Logger logger
int opcode
std::list< OpcodeSetter * > opcodeSetters
int opcodeSize


Detailed Description

         ------    ------           ------
        | FU 1 |  | FU 2 |   ...   | FU N |
         ------    ------           ------
            |         |                |
            v         v                v
         ----------------------------------
        |             Dispatcher           |
         ----------------------------------
                          |
                          v
                       -------
                      | lower |
                       -------
 

Dispatcher is an OpcodeProvider. Incoming compounds get tagged according to the FU they came from. After tagging, they get delivered to the lower FU.

Incoming compounds can be directly delivered to the FrameDispatcher. They get delivered to the FU they have been originally received from.

Definition at line 73 of file Dispatcher.hpp.


Constructor & Destructor Documentation

Dispatcher::Dispatcher ( fun::FUN fuNet,
const pyconfig::View _config 
)

Definition at line 38 of file Dispatcher.cpp.

Dispatcher::~Dispatcher (  )  [virtual]

Definition at line 55 of file Dispatcher.cpp.


Member Function Documentation

void Dispatcher::calculateSizes ( const CommandPool commandPool,
Bit commandPoolSize,
Bit dataSize 
) const [virtual]

The default implementation delegates calculation to upper functional units, modifying the result to include the size of the provided Command.

Reimplemented from wns::ldk::CommandTypeSpecifier< T >.

Definition at line 117 of file Dispatcher.cpp.

int wns::ldk::multiplexer::Dispatcher::getOpcodeSize (  )  const [inline]

Definition at line 95 of file Dispatcher.hpp.

void Dispatcher::processIncoming ( const CompoundPtr compound  )  [virtual]

Override this method to handle incoming compounds.

Implements wns::ldk::ProcessorInterface.

Definition at line 105 of file Dispatcher.cpp.

void Dispatcher::processOutgoing ( const CompoundPtr  )  [virtual]

Override this method to handle outgoing compounds.

Implements wns::ldk::ProcessorInterface.

Definition at line 93 of file Dispatcher.cpp.

FunctionalUnit * Dispatcher::whenConnecting (  )  [virtual]

whenConnecting is used during fun::FUN setup as part of the connect mechanism. The default implementation provided here are perfectly fine for most cases.

Some units need to react differently on requests of other units depending on the identity of that other unit. The only solution without extending the interfaces and without borrowing the COMEFROM statement from another popular high level programming language... is to create different contacts.

A motivating example (actually the reason for all this):

Dispatcher

The dispatcher is a functional unit having multiple other units in its receptor/deliverer sets (they must be equal), but only one unit in its connector set. It promises to deliver every compound to the same unit that it received it from.

Unfortunately, there is no way to tell the caller from a doSendData method call. The dispatcher needs to store an opcode in its command to remember to whom the command has to be delivered to.

The idea is to create an additional FU for every FU connecting from above (remember that we only allow full connects from above). When connecting from above, during connection setup a new FU has to be created, that gets connected and activates the dispatcher command with the right opcode.

Details

To allow the connectee to insert a newly created FU in between, the connect methods (connect, downConnect, upConnect) do not operate on the FUs involved in the connect method calls directly. Instead they let the connectee specify a FU to connect to using the whenConnecting method.

See also:
connect for a description of FU interconnections.

Reimplemented from wns::ldk::FunctionalUnit.

Definition at line 72 of file Dispatcher.cpp.


Member Data Documentation

Definition at line 97 of file Dispatcher.hpp.

Reimplemented in wns::ldk::fcf::FrameBuilder.

Definition at line 104 of file Dispatcher.hpp.

Definition at line 102 of file Dispatcher.hpp.

Definition at line 99 of file Dispatcher.hpp.

Definition at line 101 of file Dispatcher.hpp.


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

Generated on Sat May 26 03:32:57 2012 for openWNS by  doxygen 1.5.5