00001 // -*- c++ -*- 00002 //***************************************************************************** 00025 //***************************************************************************** 00026 00027 // include basic definitions 00028 #include "pbori_defs.h" 00029 00030 #ifndef BooleConstant_h_ 00031 #define BooleConstant_h_ 00032 00033 BEGIN_NAMESPACE_PBORI 00034 00044 class BooleConstant { 00045 00046 public: 00048 BooleConstant(): m_value(false) {} 00049 00051 BooleConstant(bool value): m_value(value) {} 00052 00054 BooleConstant(int value): m_value(value % 2) {} 00055 00057 operator bool() const { return m_value; } 00058 00060 BooleConstant operator!() const { return !m_value; } 00061 00062 protected: 00064 const bool m_value; 00065 }; 00066 00068 inline CTypes::ostream_type& 00069 operator<<(CTypes::ostream_type& os, const BooleConstant& rhs) { 00070 return (os << (int) rhs); 00071 } 00072 00073 00074 END_NAMESPACE_PBORI 00075 00076 #endif // BooleConstant_h_