See: Description
Interface | Description |
---|---|
PortMonitor |
Port monitors can be used to modify messages or gather information about
messages that are sent between two ports.
|
Class | Description |
---|---|
Port |
Ports are the main abstraction used for communication between entities.
|
Exception | Description |
---|---|
PortException |
connect()
-method
of the
Entity
class. Ports always belong to one entity. Input and output
ports are only conceptionally different to make type checking easier. They
have the same functionality.
Every port may have several message filters attached to it. They may be used
to filter messages, or to get information about messages, e.g. for counting
or statistics.
A port may also have one input message handler and one output message
handler. Message handlers are the interface between ports and entities.
Whenever a message has to be sent, the corresponding message handler is
called by the port.
The following protocol is used to exchange messages: If an entity has
prepared a new message to send, it calls the
messageIndication()
-method of its output
port. The message then travels along the connected ports to the destination
input port. Finally, the
handleMsgIndication()
-method of the input message handler is
responsible of handling the message. If it can handle the message, it
immediately calls the
getMessage()
-method of the input port, which passes the call
to the output handler of the source port. The
handleGetMessage()
-method of this port
must then supply the message (active sender).
If
getMessage()
is not called, the sender is blocked. A receiver port may call
isMessageAvailable()
which is passed from the input port to the corresponding output port.
There, the
handleIsMessageAvailable()
-method of the output message handler is called (active
receiver).
getMessage()
may only be called within
handleMsgIndication()
or after a successful
isMessageAvaialbale()
-call!
The port registers itself automatically at the port manager.
The difference between input and output ports is implemented by the
introduction of two special port classes
InputPort
and
OutputPort
.
Port
. There are sending ports (base class
OutputPort
) and receiving ports (base class
InputPort
). This is identified by a field
within
Port
, which can be accessed with
getPortType()
.
connect()
method from A or B and while
declaring the
Entity
entities and their corresponding port names. The
following is valid:
connect()
connect()
.
aliasPort()
, so that the port of the
superjacent model component becomes superfluous.
connect()
.
messageIndication()
notifies the receiver, that a message is waiting at the sender.
isMessageAvailable()
can be called from the receiver side to inquire if the sender is
holding a message.
getMessage()
is called from the receiver side to pick up a waiting message from
the sender.
messageIndication()
of the output port.
messageIndication()
of the successor port (= input port of the receiver
entity).
handleMessageIndication()
of its message handler because there is no successor
port.
InputMessageHandler
calls a handler function of the receiver entity (e.g.,
handleMessageIndication()
) or
reacts directly.
InputMessageHandler
decides if the message can be retrieved at the
current time and if necessary calls
getMessage()
of the input port.
getMessage()
of the predecessor port (= output port of the sender
entity).
handleGetMessage()
of its message handler, because there is no
predecessor port.
handleGetMessage())
or reacts directly.
getMessage()
call of the receiver. To be exact, calls made by the
messageIndication()
and
getMessage()
methods of a port are not directly delivered to the succeeding or
preceding port (steps 2 and 6) or the corresponding message handler (steps 3
and 7). In fact the handler methods of any connected message filters are
called first and then the
TPort
method
handleMessageIndication()
or
handleGetMessage()
are called which
take care of delivery.
isMessageAvailable()
of the input port.
isMessageAvailable()
of the output port of the sender entity.
handleIsMessageAvailable()
.
handleIsMessageAvailable()
) or reacts directly. The return value announces if a message is
available or not and finally lands at the receiver entity.
getMessage()
of the input port if true is
returned.
getMessage()
of the output port of the sender entity.
handleGetMessage()
of its message handler because it has no
preceding port.
handleGetMessage()
) or reacts directly.
getMessage()
call by the receiver. The extension and refining of
sequences in reference to message filters and the port's own
handle<*>()
methods
as in the "active sender" scenario. InputPort
or
OutputPort
in the simulation library, that
have ports which represent specially defined functions:
NonBlockingOutputPort
serves to
model output ports which may not be blocked.
OutputPort
.
sendMessage()
in
order to deliver a message which causes a
messageIndication()
call within the port.
getMessage()
before the sending model component can send the next message
with
sendMessage()
.
isMessageAvailable()
are answered with true
until the last message delivered to the output port with
sendMessage()
has been
picked up.
NonBlockingOutputPort
are valid for the class
SynchronousOutputPort
with the single
exception that messages sent by
sendMessage()
and announced to the following model
component with
messageIndication()
must be directly picked up i.e., the
handleMessageIndication()
method
(or the corresponding method with this functionality) within the message
handler or the model component on the receiver side must call
getMessage()
.
PolledInputPort
is publicly derived
from InputPort
. Its main characteristic is
that it ignores message offers by
messageIndication()
, so that a message exchange must
always be initiated by the receiver ("active receiver").