Tools.h++ Manual
104011 Tandem Computers Incorporated 21-143
21
Public constructor
RWModel();
When called by the specializing class, sets up the internal ordered list of
dependents.
Public member functions
void addDependent(RWModelClient* m);
Adds the object pointed to by
m
to the list of dependents of self.
void removeDependent(RWModelClient* m);
Removes the object pointed to by
m
from the list of dependents of self.
virtual void changed(void* d);
Traverse the internal list of dependents, calling member function
updateFrom(RWModel*, void*)
for each one, with self as the first
argument and
d
as the second argument.
void setTemperature(double t)
{ setting = t; changed(); }
};
void Dial::updateFrom(RWModel* m, void*){
Thermostat* t = (Thermostat*)m;
double temp = t-temperature();
// Redraw graphic.
}
Code Example 21-4 (Continued)