********************************************************************
* NOTE: This file is generated automatically from the event
* definition file PktRoute.evt.
********************************************************************
MODULE PktRouteAlgClass ;
<*NOWARN*> IMPORT TextConv, Rd, ZeusClass, IntList, Fmt, Algorithm;
<*NOWARN*> IMPORT Wr, ZeusPanel, IntListUtils, FormsVBT;
<*NOWARN*> IMPORT RefIntArray, Text, VBT, OblFmt, ZeusUtil;
<* PRAGMA LL *>
Fix any FormsVBT errors; don't handle exceptions for them.
<* FATAL FormsVBT.Error, FormsVBT.Unimplemented *>
REVEAL
T = Public BRANDED OBJECT
OVERRIDES
<* LL = VBT.mu *>
init := PktRouteDefaultInit;
snapshot := PktRouteDefaultSnapshot;
restore := PktRouteDefaultRestore;
updateEventCounts := PktRouteDefaultUpdateCts;
END;
PROCEDURE PktRouteDefaultInit (v: T): Algorithm.T =
<* LL = VBT.mu *>
PROCEDURE Attach (id: TEXT; proc: FormsVBT.Proc) =
BEGIN
FormsVBT.AttachProc(v.eventData, id, proc, v);
END Attach;
BEGIN
v.eventData := ZeusPanel.NewForm("PktRouteEventData.fv");
Attach("stopatCodeEvents", PktRouteDoIt);
Attach("waitatCodeEvents", PktRouteDoIt);
Attach("eventCounts", PktRouteRefreshCts);
Attach("stopAtStartGraph", PktRouteDoIt);
Attach("waitAtStartGraph", PktRouteDoIt);
Attach("stopAtNewNode", PktRouteDoIt);
Attach("waitAtNewNode", PktRouteDoIt);
Attach("stopAtNewStraightEdge", PktRouteDoIt);
Attach("waitAtNewStraightEdge", PktRouteDoIt);
Attach("stopAtNewCurvedEdge", PktRouteDoIt);
Attach("waitAtNewCurvedEdge", PktRouteDoIt);
Attach("stopAtNewLabel", PktRouteDoIt);
Attach("waitAtNewLabel", PktRouteDoIt);
Attach("stopAtEndGraph", PktRouteDoIt);
Attach("waitAtEndGraph", PktRouteDoIt);
Attach("stopAtStartPackets", PktRouteDoIt);
Attach("waitAtStartPackets", PktRouteDoIt);
Attach("stopAtNewPacket", PktRouteDoIt);
Attach("waitAtNewPacket", PktRouteDoIt);
Attach("stopAtEndPackets", PktRouteDoIt);
Attach("waitAtEndPackets", PktRouteDoIt);
Attach("stopAtBlocked", PktRouteDoIt);
Attach("waitAtBlocked", PktRouteDoIt);
Attach("stopAtMovePacket", PktRouteDoIt);
Attach("waitAtMovePacket", PktRouteDoIt);
Attach("stopAtQueueSizes", PktRouteDoIt);
Attach("waitAtQueueSizes", PktRouteDoIt);
Attach("stopAtAbsorb", PktRouteDoIt);
Attach("waitAtAbsorb", PktRouteDoIt);
Attach("stopAtStep", PktRouteDoIt);
Attach("waitAtStep", PktRouteDoIt);
FromFV (v.eventData, v); (* Get FV and internal data in sync *)
RETURN Algorithm.T.init(v);
END PktRouteDefaultInit;
PROCEDURE PktRouteDoIt ( fv : FormsVBT.T;
e : TEXT;
arg: REFANY;
<*UNUSED*> t : VBT.TimeStamp) =
<* LL = VBT.mu *>
BEGIN
IF Text.Equal(e, "stopatCodeEvents") THEN
NARROW(arg, T).stopatCodeEvents :=
FormsVBT.GetBoolean(fv, "stopatCodeEvents");
END;
IF Text.Equal(e, "waitatCodeEvents") THEN
NARROW(arg, T).waitatCodeEvents :=
FormsVBT.GetInteger(fv, "waitatCodeEvents");
END;
IF Text.Equal(e, "stopAtStartGraph") THEN
NARROW(arg, T).eventDataRec.stopAtStartGraph :=
FormsVBT.GetBoolean(fv, "stopAtStartGraph");
END;
IF Text.Equal(e, "waitAtStartGraph") THEN
NARROW(arg, T).eventDataRec.waitAtStartGraph :=
FormsVBT.GetInteger(fv, "waitAtStartGraph");
END;
IF Text.Equal(e, "stopAtNewNode") THEN
NARROW(arg, T).eventDataRec.stopAtNewNode :=
FormsVBT.GetBoolean(fv, "stopAtNewNode");
END;
IF Text.Equal(e, "waitAtNewNode") THEN
NARROW(arg, T).eventDataRec.waitAtNewNode :=
FormsVBT.GetInteger(fv, "waitAtNewNode");
END;
IF Text.Equal(e, "stopAtNewStraightEdge") THEN
NARROW(arg, T).eventDataRec.stopAtNewStraightEdge :=
FormsVBT.GetBoolean(fv, "stopAtNewStraightEdge");
END;
IF Text.Equal(e, "waitAtNewStraightEdge") THEN
NARROW(arg, T).eventDataRec.waitAtNewStraightEdge :=
FormsVBT.GetInteger(fv, "waitAtNewStraightEdge");
END;
IF Text.Equal(e, "stopAtNewCurvedEdge") THEN
NARROW(arg, T).eventDataRec.stopAtNewCurvedEdge :=
FormsVBT.GetBoolean(fv, "stopAtNewCurvedEdge");
END;
IF Text.Equal(e, "waitAtNewCurvedEdge") THEN
NARROW(arg, T).eventDataRec.waitAtNewCurvedEdge :=
FormsVBT.GetInteger(fv, "waitAtNewCurvedEdge");
END;
IF Text.Equal(e, "stopAtNewLabel") THEN
NARROW(arg, T).eventDataRec.stopAtNewLabel :=
FormsVBT.GetBoolean(fv, "stopAtNewLabel");
END;
IF Text.Equal(e, "waitAtNewLabel") THEN
NARROW(arg, T).eventDataRec.waitAtNewLabel :=
FormsVBT.GetInteger(fv, "waitAtNewLabel");
END;
IF Text.Equal(e, "stopAtEndGraph") THEN
NARROW(arg, T).eventDataRec.stopAtEndGraph :=
FormsVBT.GetBoolean(fv, "stopAtEndGraph");
END;
IF Text.Equal(e, "waitAtEndGraph") THEN
NARROW(arg, T).eventDataRec.waitAtEndGraph :=
FormsVBT.GetInteger(fv, "waitAtEndGraph");
END;
IF Text.Equal(e, "stopAtStartPackets") THEN
NARROW(arg, T).eventDataRec.stopAtStartPackets :=
FormsVBT.GetBoolean(fv, "stopAtStartPackets");
END;
IF Text.Equal(e, "waitAtStartPackets") THEN
NARROW(arg, T).eventDataRec.waitAtStartPackets :=
FormsVBT.GetInteger(fv, "waitAtStartPackets");
END;
IF Text.Equal(e, "stopAtNewPacket") THEN
NARROW(arg, T).eventDataRec.stopAtNewPacket :=
FormsVBT.GetBoolean(fv, "stopAtNewPacket");
END;
IF Text.Equal(e, "waitAtNewPacket") THEN
NARROW(arg, T).eventDataRec.waitAtNewPacket :=
FormsVBT.GetInteger(fv, "waitAtNewPacket");
END;
IF Text.Equal(e, "stopAtEndPackets") THEN
NARROW(arg, T).eventDataRec.stopAtEndPackets :=
FormsVBT.GetBoolean(fv, "stopAtEndPackets");
END;
IF Text.Equal(e, "waitAtEndPackets") THEN
NARROW(arg, T).eventDataRec.waitAtEndPackets :=
FormsVBT.GetInteger(fv, "waitAtEndPackets");
END;
IF Text.Equal(e, "stopAtBlocked") THEN
NARROW(arg, T).eventDataRec.stopAtBlocked :=
FormsVBT.GetBoolean(fv, "stopAtBlocked");
END;
IF Text.Equal(e, "waitAtBlocked") THEN
NARROW(arg, T).eventDataRec.waitAtBlocked :=
FormsVBT.GetInteger(fv, "waitAtBlocked");
END;
IF Text.Equal(e, "stopAtMovePacket") THEN
NARROW(arg, T).eventDataRec.stopAtMovePacket :=
FormsVBT.GetBoolean(fv, "stopAtMovePacket");
END;
IF Text.Equal(e, "waitAtMovePacket") THEN
NARROW(arg, T).eventDataRec.waitAtMovePacket :=
FormsVBT.GetInteger(fv, "waitAtMovePacket");
END;
IF Text.Equal(e, "stopAtQueueSizes") THEN
NARROW(arg, T).eventDataRec.stopAtQueueSizes :=
FormsVBT.GetBoolean(fv, "stopAtQueueSizes");
END;
IF Text.Equal(e, "waitAtQueueSizes") THEN
NARROW(arg, T).eventDataRec.waitAtQueueSizes :=
FormsVBT.GetInteger(fv, "waitAtQueueSizes");
END;
IF Text.Equal(e, "stopAtAbsorb") THEN
NARROW(arg, T).eventDataRec.stopAtAbsorb :=
FormsVBT.GetBoolean(fv, "stopAtAbsorb");
END;
IF Text.Equal(e, "waitAtAbsorb") THEN
NARROW(arg, T).eventDataRec.waitAtAbsorb :=
FormsVBT.GetInteger(fv, "waitAtAbsorb");
END;
IF Text.Equal(e, "stopAtStep") THEN
NARROW(arg, T).eventDataRec.stopAtStep :=
FormsVBT.GetBoolean(fv, "stopAtStep");
END;
IF Text.Equal(e, "waitAtStep") THEN
NARROW(arg, T).eventDataRec.waitAtStep :=
FormsVBT.GetInteger(fv, "waitAtStep");
END;
END PktRouteDoIt;
PROCEDURE PktRouteRefreshCts (
<*UNUSED*> fv : FormsVBT.T;
<*UNUSED*> e : TEXT;
arg : REFANY;
<*UNUSED*> t : VBT.TimeStamp) =
<* LL = VBT.mu *>
BEGIN
NARROW(arg, T).updateEventCounts(FALSE);
END PktRouteRefreshCts;
PROCEDURE FromFV (fv : FormsVBT.T; alg: T) =
<* LL = VBT.mu *>
BEGIN
alg.stopatCodeEvents :=
FormsVBT.GetBoolean(fv, "stopatCodeEvents");
alg.waitatCodeEvents :=
FormsVBT.GetInteger(fv, "waitatCodeEvents");
alg.eventDataRec.stopAtStartGraph :=
FormsVBT.GetBoolean(fv, "stopAtStartGraph");
alg.eventDataRec.waitAtStartGraph :=
FormsVBT.GetInteger(fv, "waitAtStartGraph");
alg.eventDataRec.stopAtNewNode :=
FormsVBT.GetBoolean(fv, "stopAtNewNode");
alg.eventDataRec.waitAtNewNode :=
FormsVBT.GetInteger(fv, "waitAtNewNode");
alg.eventDataRec.stopAtNewStraightEdge :=
FormsVBT.GetBoolean(fv, "stopAtNewStraightEdge");
alg.eventDataRec.waitAtNewStraightEdge :=
FormsVBT.GetInteger(fv, "waitAtNewStraightEdge");
alg.eventDataRec.stopAtNewCurvedEdge :=
FormsVBT.GetBoolean(fv, "stopAtNewCurvedEdge");
alg.eventDataRec.waitAtNewCurvedEdge :=
FormsVBT.GetInteger(fv, "waitAtNewCurvedEdge");
alg.eventDataRec.stopAtNewLabel :=
FormsVBT.GetBoolean(fv, "stopAtNewLabel");
alg.eventDataRec.waitAtNewLabel :=
FormsVBT.GetInteger(fv, "waitAtNewLabel");
alg.eventDataRec.stopAtEndGraph :=
FormsVBT.GetBoolean(fv, "stopAtEndGraph");
alg.eventDataRec.waitAtEndGraph :=
FormsVBT.GetInteger(fv, "waitAtEndGraph");
alg.eventDataRec.stopAtStartPackets :=
FormsVBT.GetBoolean(fv, "stopAtStartPackets");
alg.eventDataRec.waitAtStartPackets :=
FormsVBT.GetInteger(fv, "waitAtStartPackets");
alg.eventDataRec.stopAtNewPacket :=
FormsVBT.GetBoolean(fv, "stopAtNewPacket");
alg.eventDataRec.waitAtNewPacket :=
FormsVBT.GetInteger(fv, "waitAtNewPacket");
alg.eventDataRec.stopAtEndPackets :=
FormsVBT.GetBoolean(fv, "stopAtEndPackets");
alg.eventDataRec.waitAtEndPackets :=
FormsVBT.GetInteger(fv, "waitAtEndPackets");
alg.eventDataRec.stopAtBlocked :=
FormsVBT.GetBoolean(fv, "stopAtBlocked");
alg.eventDataRec.waitAtBlocked :=
FormsVBT.GetInteger(fv, "waitAtBlocked");
alg.eventDataRec.stopAtMovePacket :=
FormsVBT.GetBoolean(fv, "stopAtMovePacket");
alg.eventDataRec.waitAtMovePacket :=
FormsVBT.GetInteger(fv, "waitAtMovePacket");
alg.eventDataRec.stopAtQueueSizes :=
FormsVBT.GetBoolean(fv, "stopAtQueueSizes");
alg.eventDataRec.waitAtQueueSizes :=
FormsVBT.GetInteger(fv, "waitAtQueueSizes");
alg.eventDataRec.stopAtAbsorb :=
FormsVBT.GetBoolean(fv, "stopAtAbsorb");
alg.eventDataRec.waitAtAbsorb :=
FormsVBT.GetInteger(fv, "waitAtAbsorb");
alg.eventDataRec.stopAtStep :=
FormsVBT.GetBoolean(fv, "stopAtStep");
alg.eventDataRec.waitAtStep :=
FormsVBT.GetInteger(fv, "waitAtStep");
END FromFV;
<*UNUSED*>
PROCEDURE ToFV (fv : FormsVBT.T; alg: T) =
<* LL = VBT.mu *>
BEGIN
FormsVBT.PutBoolean(fv, "stopatCodeEvents", alg.stopatCodeEvents);
FormsVBT.PutInteger(fv, "waitatCodeEvents", alg.waitatCodeEvents);
FormsVBT.PutBoolean(fv, "stopAtStartGraph",
alg.eventDataRec.stopAtStartGraph);
FormsVBT.PutInteger(fv, "waitAtStartGraph",
alg.eventDataRec.waitAtStartGraph);
FormsVBT.PutBoolean(fv, "stopAtNewNode",
alg.eventDataRec.stopAtNewNode);
FormsVBT.PutInteger(fv, "waitAtNewNode",
alg.eventDataRec.waitAtNewNode);
FormsVBT.PutBoolean(fv, "stopAtNewStraightEdge",
alg.eventDataRec.stopAtNewStraightEdge);
FormsVBT.PutInteger(fv, "waitAtNewStraightEdge",
alg.eventDataRec.waitAtNewStraightEdge);
FormsVBT.PutBoolean(fv, "stopAtNewCurvedEdge",
alg.eventDataRec.stopAtNewCurvedEdge);
FormsVBT.PutInteger(fv, "waitAtNewCurvedEdge",
alg.eventDataRec.waitAtNewCurvedEdge);
FormsVBT.PutBoolean(fv, "stopAtNewLabel",
alg.eventDataRec.stopAtNewLabel);
FormsVBT.PutInteger(fv, "waitAtNewLabel",
alg.eventDataRec.waitAtNewLabel);
FormsVBT.PutBoolean(fv, "stopAtEndGraph",
alg.eventDataRec.stopAtEndGraph);
FormsVBT.PutInteger(fv, "waitAtEndGraph",
alg.eventDataRec.waitAtEndGraph);
FormsVBT.PutBoolean(fv, "stopAtStartPackets",
alg.eventDataRec.stopAtStartPackets);
FormsVBT.PutInteger(fv, "waitAtStartPackets",
alg.eventDataRec.waitAtStartPackets);
FormsVBT.PutBoolean(fv, "stopAtNewPacket",
alg.eventDataRec.stopAtNewPacket);
FormsVBT.PutInteger(fv, "waitAtNewPacket",
alg.eventDataRec.waitAtNewPacket);
FormsVBT.PutBoolean(fv, "stopAtEndPackets",
alg.eventDataRec.stopAtEndPackets);
FormsVBT.PutInteger(fv, "waitAtEndPackets",
alg.eventDataRec.waitAtEndPackets);
FormsVBT.PutBoolean(fv, "stopAtBlocked",
alg.eventDataRec.stopAtBlocked);
FormsVBT.PutInteger(fv, "waitAtBlocked",
alg.eventDataRec.waitAtBlocked);
FormsVBT.PutBoolean(fv, "stopAtMovePacket",
alg.eventDataRec.stopAtMovePacket);
FormsVBT.PutInteger(fv, "waitAtMovePacket",
alg.eventDataRec.waitAtMovePacket);
FormsVBT.PutBoolean(fv, "stopAtQueueSizes",
alg.eventDataRec.stopAtQueueSizes);
FormsVBT.PutInteger(fv, "waitAtQueueSizes",
alg.eventDataRec.waitAtQueueSizes);
FormsVBT.PutBoolean(fv, "stopAtAbsorb",
alg.eventDataRec.stopAtAbsorb);
FormsVBT.PutInteger(fv, "waitAtAbsorb",
alg.eventDataRec.waitAtAbsorb);
FormsVBT.PutBoolean(fv, "stopAtStep",
alg.eventDataRec.stopAtStep);
FormsVBT.PutInteger(fv, "waitAtStep",
alg.eventDataRec.waitAtStep);
CountsToFV (fv, alg);
END ToFV;
PROCEDURE CountsToFV (fv : FormsVBT.T; alg: T) =
<* LL = VBT.mu *>
BEGIN
FormsVBT.PutText(fv, "ctOfStartGraph",
Fmt.Int(alg.eventDataRec.ctOfStartGraph));
FormsVBT.PutText(fv, "ctOfNewNode",
Fmt.Int(alg.eventDataRec.ctOfNewNode));
FormsVBT.PutText(fv, "ctOfNewStraightEdge",
Fmt.Int(alg.eventDataRec.ctOfNewStraightEdge));
FormsVBT.PutText(fv, "ctOfNewCurvedEdge",
Fmt.Int(alg.eventDataRec.ctOfNewCurvedEdge));
FormsVBT.PutText(fv, "ctOfNewLabel",
Fmt.Int(alg.eventDataRec.ctOfNewLabel));
FormsVBT.PutText(fv, "ctOfEndGraph",
Fmt.Int(alg.eventDataRec.ctOfEndGraph));
FormsVBT.PutText(fv, "ctOfStartPackets",
Fmt.Int(alg.eventDataRec.ctOfStartPackets));
FormsVBT.PutText(fv, "ctOfNewPacket",
Fmt.Int(alg.eventDataRec.ctOfNewPacket));
FormsVBT.PutText(fv, "ctOfEndPackets",
Fmt.Int(alg.eventDataRec.ctOfEndPackets));
FormsVBT.PutText(fv, "ctOfBlocked",
Fmt.Int(alg.eventDataRec.ctOfBlocked));
FormsVBT.PutText(fv, "ctOfMovePacket",
Fmt.Int(alg.eventDataRec.ctOfMovePacket));
FormsVBT.PutText(fv, "ctOfQueueSizes",
Fmt.Int(alg.eventDataRec.ctOfQueueSizes));
FormsVBT.PutText(fv, "ctOfAbsorb",
Fmt.Int(alg.eventDataRec.ctOfAbsorb));
FormsVBT.PutText(fv, "ctOfStep",
Fmt.Int(alg.eventDataRec.ctOfStep));
END CountsToFV;
PROCEDURE PktRouteDefaultUpdateCts ( v: T; reset: BOOLEAN) =
<* LL = VBT.mu *>
BEGIN
IF reset THEN
v.eventDataRec.ctOfStartGraph := 0;
v.eventDataRec.ctOfNewNode := 0;
v.eventDataRec.ctOfNewStraightEdge := 0;
v.eventDataRec.ctOfNewCurvedEdge := 0;
v.eventDataRec.ctOfNewLabel := 0;
v.eventDataRec.ctOfEndGraph := 0;
v.eventDataRec.ctOfStartPackets := 0;
v.eventDataRec.ctOfNewPacket := 0;
v.eventDataRec.ctOfEndPackets := 0;
v.eventDataRec.ctOfBlocked := 0;
v.eventDataRec.ctOfMovePacket := 0;
v.eventDataRec.ctOfQueueSizes := 0;
v.eventDataRec.ctOfAbsorb := 0;
v.eventDataRec.ctOfStep := 0;
END;
CountsToFV (v.eventData, v);
END PktRouteDefaultUpdateCts;
PROCEDURE PktRouteDefaultSnapshot (v: T; wr: Wr.T)
RAISES {ZeusClass.Error} =
<* LL = VBT.mu *>
BEGIN
TRY
Wr.PutChar(wr, '(')
EXCEPT
ELSE
RAISE ZeusClass.Error(
"PktRouteAlgClass.PktRouteDefaultSnapshot write error");
END;
IF v.eventData = NIL THEN
RAISE ZeusClass.Error(
"PktRouteAlgClass.PktRouteDefaultSnapshot: " &
"eventData not set!");
END;
TRY
v.eventData.snapshot(wr)
EXCEPT
FormsVBT.Error (msg) =>
RAISE ZeusClass.Error(
"PktRouteAlgClass.PktRouteDefaultSnapshot FV error: "
& msg);
ELSE
RAISE ZeusClass.Error(
"PktRouteAlgClass.PktRouteDefaultSnapshot error");
END;
Algorithm.T.snapshot(v, wr);
TRY
Wr.PutChar(wr, ')')
EXCEPT
ELSE
RAISE ZeusClass.Error(
"PktRouteAlgClass.PktRouteDefaultSnapshot write error");
END;
END PktRouteDefaultSnapshot;
PROCEDURE PktRouteDefaultRestore (v: T; rd: Rd.T)
RAISES {ZeusClass.Error} =
<* LL = VBT.mu *>
BEGIN
IF rd = NIL THEN RETURN END;
IF NOT ZeusUtil.EatChar(rd, '(') THEN
RAISE ZeusClass.Error(
"PktRouteAlgClass.PktRouteDefaultRestore read error");
END;
IF v.eventData = NIL THEN
RAISE ZeusClass.Error(
"PktRouteAlgClass.PktRouteDefaultRestore: " &
"eventData not set!");
END;
TRY
v.eventData.restore(rd);
v.updateEventCounts(FALSE);
FromFV(v.eventData, v);
EXCEPT
ELSE
RAISE ZeusClass.Error(
"PktRouteAlgClass.PktRouteDefaultRestore error");
END;
Algorithm.T.restore(v, rd);
IF NOT ZeusUtil.EatChar(rd, ')') THEN
RAISE ZeusClass.Error(
"PktRouteAlgClass.PktRouteDefaultRestore read error");
END;
END PktRouteDefaultRestore;
BEGIN
END PktRouteAlgClass.