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  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_
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
BoolePolyRing ring_type
Type for Boolean polynomial rings (without ordering)
Definition: BooleVariable.h:51
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
BooleVariable(const self &rhs)
Copy constructor.
Definition: BooleVariable.h:67
This class reinterprets decicion diagram managers as Boolean polynomial rings, adds an ordering and v...
Definition: BoolePolyRing.h:40
This struct contains auxiliary type definitions.
Definition: pbori_defs.h:210
idx_type index() const
Get index of the variable.
Definition: BooleVariable.h:74
BoolePolynomial::bool_type operator==(BoolePolynomial::bool_type lhs, const BoolePolynomial &rhs)
Equality check (with constant lhs)
Definition: BoolePolynomial.h:579
This class wraps the underlying decicion diagram type and defines the necessary operations.
Definition: BoolePolynomial.h:85
hash_type stableHash() const
Hash value of the variable.
Definition: BooleVariable.h:87
std::size_t hash_type
Type for hashing.
Definition: pbori_defs.h:231
BooleSet set_type
Type of sets of Boolean variables.
Definition: BooleVariable.h:48
const ring_type & ring() const
Access ring, where this belongs to.
Definition: BooleVariable.h:96
int idx_type
Type for indices.
Definition: pbori_defs.h:228
BoolePolynomial operator/(const BooleVariable &lhs, const BooleVariable &rhs)
Division.
Definition: BooleVariable.h:108
hash_type hash() const
Get unique hash value (valid only per runtime)
Definition: BooleVariable.h:90
set_type set() const
Convert to Boolean set.
Definition: BooleVariable.h:93
BooleVariable(const ring_type &ring)
Construct first variable of a given ring.
Definition: BooleVariable.h:63
BoolePolynomial::bool_type operator!=(BoolePolynomial::bool_type lhs, const BoolePolynomial &rhs)
Nonquality check (with constant lhs)
Definition: BoolePolynomial.h:586
Definition: BooleSet.h:57
This class wraps a bool value, which was not converted to a boolean polynomial or monomial yet...
Definition: BooleConstant.h:40
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleVariable.h:39