GateKeeper(PtGate *& gateToKeep);The argument is a reference to a pointer to a GateKeeper, and the function of the constructor is to add this reference to a master list. It will later be possible to "enable" the pointer, by setting it to point to a newly created PtGate of the appropriate type, or "disable" it, by deleting the PtGate object and setting the pointer to null. The GateKeeper destructor deletes the reference from the master list and also deletes any PtGate object that may be pointed to by the PtGate pointer. The public method
int enabled() const;returns 1 if the GateKeeper's PtGate pointer is enabled (points to a PtGate) and 0 otherwise (the pointer is null). There are two public static functions:
static void enableAll(const PtGate& master);This function creates a PtGate object for each GateKeeper on the list, by calling
makeNew()on the master object.
static void disableAll();This function destroys all the PtGate objects and sets the pointers to be null. This function must never be called from within a block controlled by a CriticalSection, or while multithreading operation is in progress. A GateKeeper may be used as the argument to a CriticalSection constructor call; the effect is the same as if the PtGate pointer were passed to the constructor directly.