My Project
Loading...
Searching...
No Matches
cf_switches.h
Go to the documentation of this file.
1/* emacs edit mode for this file is -*- C++ -*- */
2
3/**
4 *
5 * @file cf_switches.h
6 *
7 * header to cf_switches.cc.
8 *
9**/
10
11
12#ifndef INCL_CF_SWITCHES_H
13#define INCL_CF_SWITCHES_H
14
15// #include "config.h"
16
17/** const int CFSwitchesMax
18 *
19 * const CFSwitchesMax - maximum number of switches.
20 *
21**/
22const int CFSwitchesMax = 15;
23
24/** class CFSwitches
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**/
40{
41private:
43
44public:
45 // constructors, destructors
46 CFSwitches ();
48
49 // selectors
50 /// switch 's' on
51 void On ( int s ) { switches[s] = true; }
52 /// switch 's' off
53 void Off ( int s ) { switches[s] = false; }
54 /// check if 's' is on
55 bool isOn ( int s ) const { return switches[s]; }
56 /// check if 's' is off
57 bool isOff ( int s ) const { return ! switches[s]; }
58};
59/** CFSwitches cf_glob_switches;
60 *
61 * cf_glob_switches - factory switches.
62 *
63 * This is the only object of type CFSwitches in factory. It is
64 * used either directly in the low level algorithms or by the
65 * functions On(), Off(), isOn() defined in canonicalform.cc.
66 *
67**/
68// extern CFSwitches& cf_glob_switches;
69// CFSwitches& cf_glob_switches = CFSwitches::getInstance();
71
72#endif /* ! INCL_CF_SWITCHES_H */
EXTERN_INST_VAR CFSwitches cf_glob_switches
CFSwitches cf_glob_switches;.
Definition: cf_switches.h:70
const int CFSwitchesMax
const int CFSwitchesMax
Definition: cf_switches.h:22
class CFSwitches
Definition: cf_switches.h:40
bool isOff(int s) const
check if 's' is off
Definition: cf_switches.h:57
void On(int s)
switch 's' on
Definition: cf_switches.h:51
CFSwitches()
CFSwitches::CFSwitches ()
Definition: cf_switches.cc:31
void Off(int s)
switch 's' off
Definition: cf_switches.h:53
bool switches[CFSwitchesMax]
Definition: cf_switches.h:42
bool isOn(int s) const
check if 's' is on
Definition: cf_switches.h:55
const CanonicalForm int s
Definition: facAbsFact.cc:51
#define EXTERN_INST_VAR
Definition: globaldefs.h:9