00001 #ifndef __WATCHBLE_H_INCLUDED__
00002 #define __WATCHBLE_H_INCLUDED__
00003
00004 // $Id$
00005
00006 //**********************************************************************
00007 // *
00008 // Description: Watchable object base class. *
00009 // *
00010 // Author: Chris White (whitecf@bcs.org.uk) *
00011 // *
00012 // Copyright (C) 2003 Monitor Computing Services Ltd. *
00013 // *
00014 // This program is free software; you can redistribute it and/or *
00015 // modify it under the terms of the GNU General Public License *
00016 // as published by the Free Software Foundation; either version 2 *
00017 // of the License, or any later version. *
00018 // *
00019 // This program is distributed in the hope that it will be useful, *
00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of *
00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
00022 // GNU General Public License for more details. *
00023 // *
00024 // You should have received a copy of the GNU General Public *
00025 // License (http://www.gnu.org/copyleft/gpl.html) along with this *
00026 // program; if not, write to: *
00027 // The Free Software Foundation Inc., *
00028 // 59 Temple Place - Suite 330, *
00029 // Boston, MA 02111-1307, *
00030 // USA. *
00031 // *
00032 //**********************************************************************
00033 // *
00034 // Notes: *
00035 // *
00036 //**********************************************************************
00037
00038
00039 namespace Monitor {
00040 namespace Utility {
00041
00042 // Forward declerations within namespace
00043 class CallbackBase;
00044 class CallbackList;
00045
00046
00047
00051 class Watchable
00052 {
00053 public:
00057 Watchable();
00058
00062 virtual ~Watchable();
00063
00064
00072 const CallbackBase&
00073 addWatch(const CallbackBase& newWatch) const;
00074
00080 void
00081 removeWatch(const CallbackBase& oldWatch) const;
00082
00088 void
00089 removeWatcher(const void* watcher) const;
00090
00096 virtual void
00097 updated(const void* updateData = 0) const;
00098
00102 void
00103 freeze() const;
00104
00108 void
00109 thaw() const;
00110
00111
00112 private:
00116 mutable CallbackList* watchList;
00117
00121 mutable int frozen;
00122 };
00123
00124 }; // namespace Utility
00125 }; // namespace Monitor
00126
00127 #endif // __WATCHBLE_H_INCLUDED__
00128
1.2.14 written by Dimitri van Heesch,
© 1997-2002