source: git/factory/cf_switches.h @ bb82f0

spielwiese
Last change on this file since bb82f0 was bb82f0, checked in by Hans Schönemann <hannes@…>, 15 years ago
*hannes: SW_USE_QGCD git-svn-id: file:///usr/local/Singular/svn/trunk@10762 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[493c477]1/* emacs edit mode for this file is -*- C++ -*- */
[bb82f0]2/* $Id: cf_switches.h,v 1.13 2008-06-16 12:54:05 Singular Exp $ */
[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
[b973c0]13#include <config.h>
14
[e743b3]15//{{{ const int CFSwitchesMax
16//{{{ docu
17//
18// const CFSwitchesMax - maximum number of switches.
19//
20//}}}
[bb82f0]21const int CFSwitchesMax = 16;
[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.