index previous next 

file name: contbase.hpp, contbase.cpp
classification: simulation
contents: abstract class ACController
derived from: class CControllingObject
use: the base class for the simulation controller
 

Note: all accesses to the listOfSupervisors are preceded by a call to DisableInterrupts() and followed by a call to EnableInterrupts(). The only exception to this are calls to determine if the list is empty.
 

global items used:

 
member functions:

ACController (char qname[4], ACSocketAddress *addr): Sends two messages to the evaluation: the module type (Controller), and the message containing the enum sizes.

virtual ~ACController (): Calls DeleteAllSimulationObjects() to delete all simulation specific objects, and DeleteTemplates() to delete the template objects.

EBool CreateNewApplication (SApplCreateCommand& applc): If applc.area is not in [0, min {NumberOfAreas-1, 15}], if it is equal to g_masterArea, if applc.nodeID is not in [0, 4095], or if an application with that nodeID and area already exists, the function returns False and has no effect. Otherwise, it creates a new supervisor (and thus a new application) and calls StartApplication() to start the application. In that case, the function returns the value of StartApplication(). The name of the supervisor queue is derived from its nodeID and area (the lowest byte is the area, the upper three bytes contain the nodeID).

virtual void DeleteAllSimulationObjects (): The function goes through the global listOfSupervisors, obtains their nodeID and area and calls function StopApplication() to stop their execution. Then, all supervisors in the list are deleted.

EBool DeleteSupervisor (SINT32 nodeID, int area): The function calls
StopApplication() with the given nodeID and area, then deletes the supervisor from the listOfSupervisors. The function returns the return value of StopApplication().

virtual EBool ExecuteCommand (const SCommand& command): If param.module == Controller, the command type is checked, and if it is supported, the command is executed and its result is returned. If some other module is specified, or if the command is not supported, False is returned.

All other commands are passed to the ExecuteCommand() function of the base class and its value is returned.

void ExecuteCommandForAll (ESystemCommand type): The function executes the command (SuspendSimulation or ResumeSimulation) by going through the listOfSupervisors and suspending or resuming all supervisors. If type is not one of SuspendSimulation or ResumeSimulation, an assert fails.

virtual EBool GetParameter (SParameter& param) const: If param.module == Controller, the return value of CControllingObject::GetParameter() is returned. If some other module is specified, False is returned.

virtual int ReportError (EReportType type, char *file, int line, char *expression): Calls the global error report function with the additional information module=Controller.

virtual void Reset(): Calls DeleteAllSimulationObjects() and the Reset() function of the base class.

virtual EBool ResetTheSimulation(): Goes through the listOfSupervisors and calls their Reset() functions. Then calls the Reset() function of the base class. If the listOfSupervisors was not empty, the function returns True, else it returns False.

virtual EBool SetParameter (const SParameter& param): If param.module == Controller, the return value of CControllingObject::SetParameter() is returned. If some other module is specified, False is returned.

virtual EBool StartApplication (SINT32 nodeID, int area): pure virtual
The function should start the application with the given nodeID and area. The application has already been created, and its supervisor is stored in the listOfSupervisors. Derived classes should define this function to implement operating system specific start procedures.

virtual EBool StopApplication (SINT32 nodeID, int area): pure virtual
The function should stop the application with the given nodeID and area. Derived classes should define this function to implement operating system specific stop procedures.

virtual void StopExecution(): pure virtual
The function is called upon exit and should stop the program. It is assumed that the function does not return. Derived classes should define this function to implement operating system specific exit procedures.


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