User Manual, Developers Guide and API Documentation

wns::ldk::multiplexer::FrameDispatcher Class Reference

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

#include <ldk/multiplexer/FrameDispatcher.hpp>

Inheritance diagram for wns::ldk::multiplexer::FrameDispatcher:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void calculateSizes (const CommandPool *commandPool, Bit &commandPoolSize, Bit &sduSize) const
 Default calculateSizes implementation.
 FrameDispatcher (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.

Private Member Functions

virtual void doDownConnect (FunctionalUnit *that, const std::string &srcPort, const std::string &dstPort)
 Connect functional units in the outgoing data flow only. Virtual backend.
virtual void doUpConnect (FunctionalUnit *that, const std::string &srcPort, const std::string &dstPort)
 Connect functional units in the incoming data flow only. Virtual backend.

Private Attributes

pyconfig::View config
bool downConnected
logger::Logger logger
int opcode
int opcodeSize
FunctionalUnitpending
bool upConnected


Detailed Description

         -------    -------         -------
        | FU 1a |  | FU 2a |  ...  | FU Na |
         -------    -------         -------
            |          |               |
            v          v               v
         ----------------------------------
        |          FrameDispatcher         | <---
         ----------------------------------      |
            |          |               |         | incoming injection
            v          v               v
         -------    -------         -------
        | FU 1b |  | FU 2b |  ...  | FU Nb |
         -------    -------         -------
 

FrameDispatcher is an OpcodeProvider. Incoming compounds get tagged according to the FU they came from. After tagging, they get delivered to the matching FU below: Compounds received from FU Ia get deliverd to FU Ib. Thus, in the outgoing direction, FrameDispatcher is completely transparent to the different flows.

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

Use a FrameDispatcher to realize different roles in a FUN. Sub FUNs connected to a FrameDispatcher from above enrich a compound with information. FUs below the FrameDispatcher realize the interface to the PHY. E.g., FU 1a could implement the BCH, while FU 1b drives the PHY to transmit the information provided by FU 1a; FU 2a could be part of the user data plane, while FU 2b drives the PHY for user data transmission.

Definition at line 82 of file FrameDispatcher.hpp.


Constructor & Destructor Documentation

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

Todo:
OpcodeSetter instances are leaking

Definition at line 40 of file FrameDispatcher.cpp.


Member Function Documentation

void FrameDispatcher::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 126 of file FrameDispatcher.cpp.

void FrameDispatcher::doDownConnect ( FunctionalUnit that,
const std::string &  srcPort,
const std::string &  dstPort 
) [private, virtual]

Implement this method to modify the connect behavior in the outgoing data flow.

Warning:
Do not call this method.
In almost any case it is not wise to call this method and it may be prohibited in future ldk versions.

See also:
connect for a description of FU interconnections.

Reimplemented from wns::ldk::FunctionalUnit.

Definition at line 80 of file FrameDispatcher.cpp.

void FrameDispatcher::doUpConnect ( FunctionalUnit that,
const std::string &  srcPort,
const std::string &  dstPort 
) [private, virtual]

Implement this method to modify the connect behavior in the incoming data flow.

Warning:
Do not call this method.
In almost any case it is not wise to call this method and it may be prohibited in future ldk versions.

See also:
connect for a description of FU interconnections.

Reimplemented from wns::ldk::FunctionalUnit.

Definition at line 91 of file FrameDispatcher.cpp.

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

Definition at line 103 of file FrameDispatcher.hpp.

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

Override this method to handle incoming compounds.

Implements wns::ldk::ProcessorInterface.

Definition at line 114 of file FrameDispatcher.cpp.

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

Override this method to handle outgoing compounds.

Implements wns::ldk::ProcessorInterface.

Definition at line 102 of file FrameDispatcher.cpp.

FunctionalUnit * FrameDispatcher::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 58 of file FrameDispatcher.cpp.


Member Data Documentation

Definition at line 112 of file FrameDispatcher.hpp.

Definition at line 119 of file FrameDispatcher.hpp.

Definition at line 121 of file FrameDispatcher.hpp.

Definition at line 115 of file FrameDispatcher.hpp.

Definition at line 114 of file FrameDispatcher.hpp.

Definition at line 117 of file FrameDispatcher.hpp.

Definition at line 118 of file FrameDispatcher.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