00001 #ifndef __SGNLMAN_H_INCLUDED__
00002 #define __SGNLMAN_H_INCLUDED__
00003
00004 // $Id$
00005
00006 //**********************************************************************
00007 // *
00008 // Description: 'Bell Master' Signalman 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 #include <cstring.h>
00039
00040 namespace Monitor{
00041 // Forward declerations
00042 namespace Utility{
00043 class CallbackBase;
00044 class Timer;
00045 class Timeout;
00046 };
00047 namespace BellMaster {
00048
00049
00050 // Forward declerations within namespace
00051 class Bell;
00052 class Tapper;
00053
00054
00055
00056 class Signalman
00057 {
00058 public:
00059
00065 Signalman(const string& newName = string(""),
00066 const unsigned newBeatInterval = 186,
00067 const unsigned newSetInterval = 750);
00068
00069 virtual ~Signalman();
00070
00071
00072 Signalman&
00073 operator=(const Signalman& other);
00074
00078 int
00079 operator==(const Signalman& other) const;
00080
00085 int
00086 operator<(const Signalman& other) const;
00087
00088
00095 void
00096 beatSequence(Tapper& tapper, const string& sequence) const;
00097
00101 const string&
00102 getName() const { return name; }
00103
00107 unsigned
00108 getBeatInterval() const;
00109
00113 void
00114 setBeatInterval(const unsigned newInterval);
00115
00119 unsigned
00120 getSetInterval() const;
00121
00125 void
00126 setSetInterval(const unsigned newInterval);
00127
00131 int
00132 isBusy();
00133
00140 void
00141 listenToBell(Bell& newBell,
00142 const Monitor::Utility::CallbackBase& timeoutCallback);
00143
00149 const string
00150 stopListeningToBell();
00151
00152 private:
00156 void
00157 hearBell();
00158
00162 string name;
00163
00167 unsigned beatInterval;
00168
00172 unsigned setInterval;
00173
00178 Monitor::Utility::Timer* ringTimer;
00179
00183 Monitor::Utility::Timeout* ringTimeout;
00184
00188 unsigned heardIntervals[65];
00189 }; // class Signalman
00190
00191 }; // namespace BellMaster
00192 }; // namespace Monitor
00193
00194
00195 #endif // __SGNLMAN_H_INCLUDED__
1.2.14 written by Dimitri van Heesch,
© 1997-2002