The class
Demultiplexer
is the counter part to
Multiplexer
and is the base class for
StdDemultiplexer
,
LabelDemultiplexer
, and
IPDemultiplexer
. An arriving
message at the input port (
InputPort
) is passed on to one of the output ports
(
OutputPort
) which is determined by calling the method
getOutputPort()
.
Whereas the class
StdDemultiplexer
does not provide an implementation of the method
getOutputPort()
, the classes
LabelDemultiplexer
, and
IPDemultiplexer
are
ready-to-use. In
StdDemultiplexer
the initial number of output ports is given on construction.
Outputs are named: "output 1" ... "output N". Further ports may be added via
addPort()
and removed via
removePort()
.
- The decision which message will reach which port is made with the method
getOutputPort()
, that must be defined in the derived classes. In order for this decision
to be consistent throughout the lifetime of the demultiplexer,
LabelDemultiplexer
and
IPDemultiplexer
are not allowed to use
removePort()
.
-
LabelDemultiplexer
implements the method
getOutputPort()
by returning the
port with the index label of a
LabelMessage
(contained in the data member label of
LabelMessage
) minus the start label (contained in startLabel). The start label can
be given as parameter on construction and defaults to 0.
-
IPDemultiplexer
is a ready-to use static demultiplexer for packets belonging to the
class
IPPacket
and destinguishes between the modes "destination-based", "group-based"
and "type-based". The functionallity is the same as described in
LabelDemultiplexer
except that not the label is taken into consideration but destination, group or type, depending
on the mode that is set. Therefore, additional to the parameters described for
StaticLabelDemux
,
a parameter indicating the mode has to be provided upon construction.
-
Expander
can also be used to define a demultiplexer. The output ports of
this demultiplexer are not allowed to be blocked.