index previous next 

file name: supervis.hpp, supervis.cpp
classification: simulation
contents: class CSupervisor
derived from: class CControllingObject
use: the object used for controlling a clock synchronization application
 

global items used:

member variables:

int area_: the area number of the application.

CClockInterface *clock_: a pointer to the clock object.

CClockSync *cs_: a pointer to the clock synchronization object.

CLance *lance_: a pointer to the lance object.

SINT32 nodeID_: the node ID of the application.

EBool snapshot_: is True if periodic snapshots are triggered.
default and reset value: False
 

member functions:

CSupervisor (char qname[4], ACSocketAddress *addr, SINT32 nodeID, int area, double clockFrequency): Stores all parameters, sets the other members to their default values. Creates the dynamic members and links the application objects to each other (p.e., sets the clock and lance pointers of cs). Enters itself into the listOfSupervisors. Sends the module type (Supervisor) to the evaluation.
Note: the access to the listOfSupervisors is not atomic.

virtual ~CSupervisor (): Removes itself from the listOfSupervisors. Deletes cs, lance, and clock (in this order!).
Note: the access to the listOfSupervisors is not atomic.

virtual void DoPeriodicActivities(): Is called once every period. If snapshot is True, MakeSystemSnapshot() is called to initiate a system snapshot. If snapshot is False, the function has no effect.

virtual EBool ExecuteCommand (const SCommand& command): Checks the module and calls the appropriate ExecuteCommand() function:

All other modules are not supported and False is returned.

CClockInterface *GetClock (): Returns the pointer to the clock object.

CClockSync *GetClockSync (): Returns the pointer to the clock synchronization object.

void GetIdentification (SINT32& nodeID, int& area) const: Copies the internal nodeID/area into the parameters.

CLance *GetLance (): Returns the pointer to the lance object.

virtual EBool GetParameter (SParameter& param) const: Checks the module and calls the appropriate GetParameter() function:

All other modules are not supported and False is returned.

virtual void NoteEvent (SEvent *event): The function casts the event to type SApplicationEvent and stores the value of clock, the nodeID and the area. Then the event is put into the event queue. If the event is NULL, or if its size is less than the size of SApplicationEvent, an assert fails.

virtual int ReportError (EReportType type, char *file, int line, char *expression): Calls the global error report function with module=Supervisor, plus the nodeID and area.

void Reset(): Disables interrupts, resets the application objects, then enables interrupts. Sets snapshot to False, then calls the Reset() function of the base class.

void ResumeOperation (): Resume the whole application. That is done by calling cs::Resume().

virtual EBool SetParameter (const SParameter& param): Checks the module and calls the appropriate SetParameter() function:

All other modules are not supported and False is returned.

void SuspendOperation (): Suspend the whole application. First, cs::Suspend() is called to disable duty timer interrupts from the UTCSU. Then, lance is suspended to ignore incoming messages. At last, cs is suspended again to throw away any messages that might have arrived between the first suspension and the suspension of the Lance.
Note: cs has to be suspended before lance, because if ClockSync sends a message while the Lance is in suspension mode, suspension is cleared.


last modified: Fri Feb 5 18:56:37 1999