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