index previous next




file name: crashing.hpp, crashing.cpp
classification: simulation
contents: class CCrashingModule
use: provides a database for the storage of network transmission delays; the delays are associated with a pair of keys <SINT32 key1, SINT32 key2>


global items used by CAccountant:


member variables of CAccountant:

 EBool crashed_: the crash status of the module.
default and reset value: False

 double probCrash_: probability of crashing.
default and reset value: 0

 double probRecover_: probability of recovering.
default and reset value: 0


member functions of CAccountant:

 CCrashingModule (): Calls Reset() to set all members to their default values.

 virtual void Crash (): Sets crashed to True and calls ReportCrashChange().

 EBool Crashed () const: Returns the value of member crashed.

 virtual EBool ExecuteCommand (const SCommand& command): Returns True if the command is supported. Supported commands:

All other commands are not supported and False is returned.

 double GetProbability (EBool probCrash) const: If probCrash is True, the value of member probCrash is returned, else the value of member probRecover is returned.

 virtual EBool ModifyCrashStatus (): May change the crash status of the module (according to the current crash status and the appropriate probability for leaving that state). The status is changed through a call to function Crash() or Recover(), whatever is appropriate. The function returns True if the status was changed.

 virtual void Recover (): Sets crashed to False and calls ReportCrashChange().

 virtual void ReportCrashChange(): Empty.
Derived modules should send an event with the type CrashStatusChange to the evaluation.

 void Reset (): Sets or restores the initial state.

 EBool SetProbability (EBool probCrash, double prob): If prob is not in [0,1], the function returns False and has no effect. Otherwise, if probCrash is True, member probCrash is set to prob, else member probRecover is set to prob. In any case, the function returns True if the member was set.


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