RWModel man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



RWModel(3C++)							 RWModel(3C++)

Name
     RWModel - Rogue Wave library class

Synopsis
	      #include <rw/model.h>

	      (abstract base class)

Description
     This abstract base class has been designed to implement the "Model" leg
     of a Model-View-Controller architecture.  A companion class,
     RWModelClient, supplies the "View" leg. It maintains a list of dependent
     RWModelClient objects.  When member function changed(void*) is called,
     the list of dependents will be traversed, calling updateFrom(RWModel*,
     void*) for each one, with itself as the first argument.  Subclasses of
     RWModelClient should be prepared to accept such a call.

Persistence
     None

Example
     This is an incomplete and somewhat contrived example in that it does not
     completely define the classes involved.  "Dial" is assumed to be a
     graphical representation of the internal settings of "Thermostat."	 The
     essential point is that there is a dependency relationship between the
     "Thermostat" and the "Dial": when the setting of the thermostat is
     changed, the dial must be notified so that it can update itself to
     reflect the new setting of the thermostat.

	      #include <rw/model.h>

	      class Dial : public RWModelClient {
	  public:
	    virtual void     updateFrom(RWModel* m, void* d);
	  };

	      class Thermostat : public RWModel {

		double setting;
	  public:
	    Thermostat( Dial* d )
	      { addDependent(d); }

									Page 1

RWModel(3C++)							 RWModel(3C++)

	    double temperature() const
	      { return setting; }
	    void setTemperature(double t)
	      { setting = t; changed(); }
	  };

	      void Dial::updateFrom(RWModel* m, void*) {

		Thermostat* t = (Thermostat*)m;
	    double temp = t->temperature();
	    // Redraw graphic.
	  }

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.

									Page 2

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net