source: git/factory/cf_switches.h @ e743b3

spielwiese
Last change on this file since e743b3 was e743b3, checked in by Jens Schmidt <schmidt@…>, 27 years ago
* cf_switches.h: doc fix (class CFSwitches): doc fix * cf_switches.h (CFSwitchesMax): new constant * cf_switches.h (class CFSwitches): number of switches replaced by references to 'const int CFSwitchesMax' git-svn-id: file:///usr/local/Singular/svn/trunk@572 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id: cf_switches.h,v 1.4 1997-07-23 15:55:19 schmidt Exp $ */
3
4#ifndef INCL_CF_SWITCHES_H
5#define INCL_CF_SWITCHES_H
6
7//{{{ docu
8//
9// cf_switches.h - header to cf_switches.cc.
10//
11//}}}
12
13#include <config.h>
14
15//{{{ const int CFSwitchesMax
16//{{{ docu
17//
18// const CFSwitchesMax - maximum number of switches.
19//
20//}}}
21const int CFSwitchesMax = 10;
22//}}}
23
24//{{{ class CFSwitches
25//{{{ docu
26//
27// class CFSwitches - manages boolean switches.
28//
29// An object of type CFSwitches is simply an array of booleans
30// with some comfortable access methods (On, Off).  Each object
31// may contain CFSwitchesMax switches.  When a new object of type
32// CFSwitches is created, all its switches are turned off.
33//
34// Note: No range checking is done when accessing switches.
35//
36// switches: the switches
37//
38//}}}
39//{{{ inline method docu
40//
41// void On( int s )
42// void Off( int s )
43// bool isOn( int s )
44// bool isOff( int s )
45//
46// On(), Off() - switch s on or off, resp.
47//
48// isOn(), isOff() - return true iff s is on or off, resp.
49//
50//}}}
51class CFSwitches
52{
53private:
54    bool switches [CFSwitchesMax];
55public:
56    CFSwitches();
57    ~CFSwitches() {}
58
59    void On( int s ) { switches[s] = true; }
60    void Off( int s ) { switches[s] = false; }
61    bool isOn( int s ) const { return switches[s]; }
62    bool isOff( int s ) const { return ! switches[s]; }
63};
64//}}}
65
66#endif /* ! INCL_CF_SWITCHES_H */
Note: See TracBrowser for help on using the repository browser.