00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _tristate_h
00018 #define _tristate_h
00019
00026 class TriState
00027 {
00028 public:
00029 enum {
00030 TS_HI = 1,
00031 TS_LOW = -1,
00032 TS_UNSET = 0
00033 };
00034
00035 inline byte GetState() { return m_state; }
00036 inline void SetState(byte val) { m_state = val; }
00037 inline bool IsSet() { return m_state != TS_UNSET; }
00038 inline bool IsHigh() { return m_state == TS_HI; }
00039 inline bool IsLow() { return m_state == TS_LOW; }
00040 inline void SetHi() { m_state = TS_HI; }
00041 inline void SetLow() { m_state = TS_LOW; }
00042 inline void Clear() { m_state = TS_UNSET; }
00043
00044 protected:
00045 char m_state;
00046 };
00047
00050 #endif