[493c477] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
[2dd068] | 2 | |
---|
[b52d27] | 3 | /** |
---|
| 4 | * |
---|
| 5 | * @file cf_switches.h |
---|
| 6 | * |
---|
| 7 | * header to cf_switches.cc. |
---|
| 8 | * |
---|
| 9 | **/ |
---|
| 10 | |
---|
| 11 | |
---|
[2dd068] | 12 | #ifndef INCL_CF_SWITCHES_H |
---|
| 13 | #define INCL_CF_SWITCHES_H |
---|
| 14 | |
---|
[e4fe2b] | 15 | // #include "config.h" |
---|
[b973c0] | 16 | |
---|
[b52d27] | 17 | /** const int CFSwitchesMax |
---|
| 18 | * |
---|
| 19 | * const CFSwitchesMax - maximum number of switches. |
---|
| 20 | * |
---|
| 21 | **/ |
---|
[f53c82] | 22 | const int CFSwitchesMax = 15; |
---|
[2dd068] | 23 | |
---|
[b52d27] | 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 | **/ |
---|
[2dd068] | 39 | class CFSwitches |
---|
| 40 | { |
---|
| 41 | private: |
---|
[e743b3] | 42 | bool switches [CFSwitchesMax]; |
---|
[a2952c] | 43 | |
---|
[2dd068] | 44 | public: |
---|
[a2952c] | 45 | // constructors, destructors |
---|
[cbecbd3] | 46 | CFSwitches (); |
---|
[5586f4] | 47 | ~CFSwitches () {} |
---|
[e743b3] | 48 | |
---|
[a2952c] | 49 | // selectors |
---|
[b52d27] | 50 | /// switch 's' on |
---|
[5586f4] | 51 | void On ( int s ) { switches[s] = true; } |
---|
[b52d27] | 52 | /// switch 's' off |
---|
[5586f4] | 53 | void Off ( int s ) { switches[s] = false; } |
---|
[b52d27] | 54 | /// check if 's' is on |
---|
[5586f4] | 55 | bool isOn ( int s ) const { return switches[s]; } |
---|
[b52d27] | 56 | /// check if 's' is off |
---|
[5586f4] | 57 | bool isOff ( int s ) const { return ! switches[s]; } |
---|
[2dd068] | 58 | }; |
---|
[b52d27] | 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 | **/ |
---|
[64b9bf] | 68 | // extern CFSwitches& cf_glob_switches; |
---|
| 69 | // CFSwitches& cf_glob_switches = CFSwitches::getInstance(); |
---|
[a3f0fea] | 70 | EXTERN_INST_VAR CFSwitches cf_glob_switches; |
---|
[2dd068] | 71 | |
---|
[493c477] | 72 | #endif /* ! INCL_CF_SWITCHES_H */ |
---|