PolyBoRi
BooleVariable.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
89 //*****************************************************************************
90 
91 #ifndef BooleVariable_h_
92 #define BooleVariable_h_
93 
94 // include basic definitions
95 #include "pbori_defs.h"
96 
97 // get BoolePolynomial's definition
98 #include "BooleEnv.h"
99 #include "BoolePolynomial.h"
100 
102 
112 
113  public:
114  //-------------------------------------------------------------------------
115  // types definitions
116  //-------------------------------------------------------------------------
117 
119 
124 
126  typedef BooleVariable self;
127 
130 
133 
135  explicit BooleVariable(idx_type idx = 0):
136  m_poly( BooleEnv::persistentVariable(idx) ) {}
137 
139  BooleVariable(idx_type idx, const ring_type& ring):
140  m_poly( ring.persistentVariable(idx) ) {}
141 
142 
144  BooleVariable(const self& rhs):
145  m_poly(rhs.m_poly) {}
146 
148  operator const BoolePolynomial&() const { return m_poly; }
149 
151  idx_type index() const { return *m_poly.firstBegin(); }
152 
154  bool operator== (const self& other) const{
155  return m_poly==other.m_poly;
156  }
157  bool operator!= (const self& other) const{
158  return m_poly!=other.m_poly;
159  }
160  set_type set() const { return m_poly.set(); }
161 
163  ring_type ring() const { return m_poly.ring(); }
164 
165 private:
166  BoolePolynomial m_poly;
167 };
168 
169 
170 
171 inline BoolePolynomial
172 operator/(const BooleVariable& lhs, const BooleVariable& rhs) {
173  return BoolePolynomial(BooleConstant(lhs == rhs), lhs.ring());
174 }
175 
176 
177 
179 
180 #endif // of BooleVariable_h_