source: git/factory/cf_switches.h @ 362fc67

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