source: git/factory/cf_switches.h @ e16f7d

spielwiese
Last change on this file since e16f7d was e16f7d, checked in by Martin Lee <martinlee84@…>, 12 years ago
chg: deleted fieldGCD
  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[493c477]1/* emacs edit mode for this file is -*- C++ -*- */
[341696]2/* $Id$ */
[2dd068]3
4#ifndef INCL_CF_SWITCHES_H
5#define INCL_CF_SWITCHES_H
6
[e743b3]7//{{{ docu
8//
9// cf_switches.h - header to cf_switches.cc.
10//
11//}}}
12
[e4fe2b]13// #include "config.h"
[b973c0]14
[e743b3]15//{{{ const int CFSwitchesMax
16//{{{ docu
17//
18// const CFSwitchesMax - maximum number of switches.
19//
20//}}}
[e16f7d]21const int CFSwitchesMax = 13;
[e743b3]22//}}}
[2dd068]23
[e743b3]24//{{{ class CFSwitches
25//{{{ docu
26//
27// class CFSwitches - manages boolean switches.
28//
[a2952c]29// An object of class `CFSwitches' is simply an array of booleans
30// with some comfortable access methods (`On()', `isOn()', etc.).
31// Each object may contain `CFSwitchesMax' switches.  When a new
32// object of type `CFSwitches' is created, all its switches are
33// turned off.
[e743b3]34//
35// Note: No range checking is done when accessing switches.
36//
37// switches: the switches
38//
39//}}}
40//{{{ inline method docu
41//
[5586f4]42// void On ( int s )
43// void Off ( int s )
[f6590b9]44// bool isOn ( int s ) const
45// bool isOff ( int s ) const
[e743b3]46//
[a2952c]47// On(), Off() - switch `s' on or off, resp.
[e743b3]48//
[a2952c]49// isOn(), isOff() - return true iff `s' is on or off, resp.
[e743b3]50//
51//}}}
[2dd068]52class CFSwitches
53{
54private:
[e743b3]55    bool switches [CFSwitchesMax];
[a2952c]56
[2dd068]57public:
[a2952c]58    // constructors, destructors
[5586f4]59    CFSwitches ();
60    ~CFSwitches () {}
[e743b3]61
[a2952c]62    // selectors
[5586f4]63    void On ( int s ) { switches[s] = true; }
64    void Off ( int s ) { switches[s] = false; }
65    bool isOn ( int s ) const { return switches[s]; }
66    bool isOff ( int s ) const { return ! switches[s]; }
[2dd068]67};
[e743b3]68//}}}
[2dd068]69
[493c477]70#endif /* ! INCL_CF_SWITCHES_H */
Note: See TracBrowser for help on using the repository browser.