file name: network.hpp, network.cpp
classification: pure simulation
contents: class CBroadcastNetwork
derived from: class ACNetwork
use: implements a broadcast network (dedicated messages are
possible as well)
global items used:
CBroadcastNetwork
(CControllingObject *ctrl, SINT32 networkID): Just passes the parameters
to the ctor of the base class.
static ACNetwork
*CreateNetwork (CControllingObject *ctrl, SINT32 networkID): Creates
and returns a new object of type CBroadcastNetwork.
virtual
void SendMsg (SMsg *msg): If inherited member distDataLambda
does not specify a broadcast delay of zero, the broadcast delay is computed
and the message is passed on to the delayer to be kept until the broadcast
delay has passed. If the upper bound on the broadcast delay is zero, Transmit()
is called at once. If msg is NULL, an assert fails.
virtual
void Transmit (SMsg *msg): This function overloads function Transmit()
of ACNetwork and is called by the delayer. The function calls
ModifyCrashStatus(), then checks the return value of Crashed().
If the network is crashed, event MessageLost is
sent and the function has no effect. If the list of nodes stored in the
base class is empty, the function also has no effect. Otherwise, if SMsg::timestamped
is True, the message is timestamped with the clock value of the sender
node. Then, the message is duplicated for the receiving node, SMsg::receiver
is set accordingly, and SMsg::rtime[] is filled with the timestamps
of the UTCSUs of all areas on the receiver node. After that, ACNetwork::Transmit()
is called to transmit the (now dedicated) message. If SMsg::broadcast
is False, only one message will be sent to the node specified in SMsg::receiver.
If SMsg::broadcast is True, all nodes stored in the list of nodes
of the base class will receive a copy of the message. If msg is
NULL, an assert fails.