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

jengelh-datetimespielwiese
Last change on this file since 362fc67 was 362fc67, checked in by Martin Lee <martinlee84@…>, 11 years ago
chg: remove $Id$
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2
3#ifndef INCL_CF_SWITCHES_H
4#define INCL_CF_SWITCHES_H
5
6//{{{ docu
7//
8// cf_switches.h - header to cf_switches.cc.
9//
10//}}}
11
12// #include "config.h"
13
14//{{{ const int CFSwitchesMax
15//{{{ docu
16//
17// const CFSwitchesMax - maximum number of switches.
18//
19//}}}
20const int CFSwitchesMax = 13;
21//}}}
22
23//{{{ class CFSwitches
24//{{{ docu
25//
26// class CFSwitches - manages boolean switches.
27//
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.
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 ) const
44// bool isOff ( int s ) const
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];
55
56public:
57    // constructors, destructors
58    CFSwitches ();
59    ~CFSwitches () {}
60
61    // selectors
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]; }
66};
67//}}}
68
69#endif /* ! INCL_CF_SWITCHES_H */
Note: See TracBrowser for help on using the repository browser.