PolyBoRi
BooleVariable.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
16 //*****************************************************************************
17 
18 #ifndef polybori_BooleVariable_h_
19 #define polybori_BooleVariable_h_
20 
21 // include basic definitions
22 #include <polybori/pbori_defs.h>
23 
24 // get BoolePolynomial's definition
25 #include <polybori/BooleEnv.h>
27 #include <polybori/BooleSet.h>
28 
30 
40  public CAuxTypes {
41 
43  typedef BooleVariable self;
44 
45  public:
46 
48  typedef BooleSet set_type;
49 
52 
54 
58 
59  BooleVariable(idx_type idx, const ring_type& ring):
60  m_poly( ring.variableDiagram(idx) ) {}
61 
63  BooleVariable(const ring_type& ring):
64  m_poly( ring.variableDiagram(0) ) {}
65 
67  BooleVariable(const self& rhs):
68  m_poly(rhs.m_poly) {}
69 
71  operator const BoolePolynomial&() const { return m_poly; }
72 
74  idx_type index() const { return *m_poly.firstBegin(); }
75 
77  bool operator== (const self& other) const{
78  return m_poly==other.m_poly;
79  }
80 
81  // Nonequality check
82  bool operator!= (const self& other) const{
83  return m_poly!=other.m_poly;
84  }
85 
87  hash_type stableHash() const{ return m_poly.stableHash(); }
88 
90  hash_type hash() const { return m_poly.hash(); }
91 
93  set_type set() const { return m_poly.set(); }
94 
96  const ring_type& ring() const { return m_poly.ring(); }
97 
98 private:
99  friend class BoolePolyRing;
100  BooleVariable(const BoolePolynomial& poly):m_poly(poly){}
101 
102  BoolePolynomial m_poly;
103 };
104 
105 
107 inline BoolePolynomial
108 operator/(const BooleVariable& lhs, const BooleVariable& rhs) {
109  return BoolePolynomial(BooleConstant(lhs == rhs), lhs.ring());
110 }
111 
113 
114 #endif // of polybori_BooleVariable_h_