|
Boost : |
From: Matthias Schabel (boost_at_[hidden])
Date: 2003-11-11 18:57:21
I've written a small class that implements functionality emulating push
buttons (think old radio) but with more flexibility in determining the
precise
behavior which has come in handy for controlling more complex state
flags. A policy class is responsible for determining what internal
invariants are enforced and allows for more or less complete flexibility
in defining the constraints in constructing the push button set.
Currently
there are four policy classes implementing simple cases :
1) ZeroOrOneOn : zero buttons or one button may be on
2) ZeroOrMoreOn : zero buttons and up to N buttons may be on
3) OnlyOneOn : one and only one button may be on
4) OneOrMoreOn : at least one and up to N buttons may be on
where N is the size of the push_button array. The test program also
demonstrates
a policy requiring that two adjacent buttons be on at any time as a
slightly non-trivial
case. The usual place :
http://groups.yahoo.com/group/boost/files/push_button.zip
Tested with Metrowerks CW 8.3 and gcc 3.3 on Mac OS X.
Matthias
------------------------------------------------------------------------
---------------------------
Matthias Schabel, Ph.D.
Utah Center for Advanced Imaging Research
729 Arapeen Drive
Salt Lake City, UT 84108
801-587-9413 (work)
801-585-3592 (fax)
801-706-5760 (cell)
801-484-0811 (home)
mschabel at ucair med utah edu
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk