PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00089 //***************************************************************************** 00090 00091 #ifndef BooleVariable_h_ 00092 #define BooleVariable_h_ 00093 00094 // include basic definitions 00095 #include "pbori_defs.h" 00096 00097 // get BoolePolynomial's definition 00098 #include "BooleEnv.h" 00099 #include "BoolePolynomial.h" 00100 00101 BEGIN_NAMESPACE_PBORI 00102 00111 class BooleVariable { 00112 00113 public: 00114 //------------------------------------------------------------------------- 00115 // types definitions 00116 //------------------------------------------------------------------------- 00117 00119 00120 typedef CTypes::dd_type dd_type; 00121 typedef CTypes::size_type size_type; 00122 typedef CTypes::idx_type idx_type; 00124 00126 typedef BooleVariable self; 00127 00129 typedef BooleSet set_type; 00130 00132 typedef BooleRing ring_type; 00133 00135 explicit BooleVariable(idx_type idx = 0): 00136 m_poly( BooleEnv::persistentVariable(idx) ) {} 00137 00139 BooleVariable(idx_type idx, const ring_type& ring): 00140 m_poly( ring.persistentVariable(idx) ) {} 00141 00142 00144 BooleVariable(const self& rhs): 00145 m_poly(rhs.m_poly) {} 00146 00148 operator const BoolePolynomial&() const { return m_poly; } 00149 00151 idx_type index() const { return *m_poly.firstBegin(); } 00152 00154 bool operator== (const self& other) const{ 00155 return m_poly==other.m_poly; 00156 } 00157 bool operator!= (const self& other) const{ 00158 return m_poly!=other.m_poly; 00159 } 00160 set_type set() const { return m_poly.set(); } 00161 00163 ring_type ring() const { return m_poly.ring(); } 00164 00165 private: 00166 BoolePolynomial m_poly; 00167 }; 00168 00169 00170 00171 inline BoolePolynomial 00172 operator/(const BooleVariable& lhs, const BooleVariable& rhs) { 00173 return BoolePolynomial(BooleConstant(lhs == rhs), lhs.ring()); 00174 } 00175 00176 00177 00178 END_NAMESPACE_PBORI 00179 00180 #endif // of BooleVariable_h_