#ifndef GEOMETRYOBSERVER_HPP #define GEOMETRYOBSERVER_HPP // // $Id: GeometryObserver.hpp,v 1.2 2002/08/25 20:24:28 melanson Exp $ // // File: GeometryObserver.hpp // Purpose: // Created: 4-APR-2000 John Hobbs // // $Revision: 1.2 $ // // // Include files namespace dgs { class absObservedGeometer; // Global definitions class GeometryObserver { public: // Since this is an observer, every instance must be registered with // a geometer. GeometryObserver(absObservedGeometer* myGeometer); GeometryObserver(const GeometryObserver& rhs); GeometryObserver& operator =(const GeometryObserver& rhs); virtual ~GeometryObserver(); /// This returns the state of the update (and changes the state to not updated). bool updated(); /** The user may implement this routine. It is called by update() below. If implemented, it should include a call to updated() to reset the state to "not updated". */ virtual void user_update(); private: friend class absObservedGeometer; /// Update is called by the absGeometer when a new geometry shows up bool update(); /// This is set by update, and reset either by is_updated or user_update bool d_updated; /// The geometer which this observer is watching. Needed by destructor. absObservedGeometer* d_myGeometer; }; } #endif //GEOMETRYOBSERVER_HPP