Darin Petkov | 703ec97 | 2010-04-27 11:02:18 -0700 | [diff] [blame^] | 1 | // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // A table of power states, to be included when building tabular things. |
| 6 | // |
| 7 | // This file is used to construct two things: an enumerated type in |
| 8 | // metrics_daemon.h, and a table of structures with state names in |
| 9 | // metrics_daemon.cc. Including this file ensures that the two tables are |
| 10 | // always in sync (and saves typing). I don't know of other ways of achieving |
| 11 | // the same result in C/C++, but it doesn't mean there isn't one. |
| 12 | |
| 13 | // Before you include this file, define STATE to do something useful, or else |
| 14 | // if will be a no-op. STATE will be undefined on exit. Don't worry about |
| 15 | // collisions for the STATE macro (as long as it's a macro) because the |
| 16 | // compiler will flag them---in that case, just change the name. If someone is |
| 17 | // misguided enough to use STATE for something other than a macro, the error |
| 18 | // messages will be slightly more complicated. |
| 19 | |
| 20 | |
| 21 | #ifndef STATE |
| 22 | #define STATE(name, capname) |
| 23 | #endif |
| 24 | |
| 25 | STATE(on, On) |
| 26 | STATE(mem, Mem) |
| 27 | |
| 28 | #undef STATE |