BooleVariable.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_BooleVariable_h_
#define polybori_BooleVariable_h_
// include basic definitions
#include <polybori/pbori_defs.h>
// get BoolePolynomial's definition
#include <polybori/BooleEnv.h>
#include <polybori/BoolePolynomial.h>
#include <polybori/BooleSet.h>
BEGIN_NAMESPACE_PBORI
class BooleVariable:
public CAuxTypes {
typedef BooleVariable self;
public:
typedef BooleSet set_type;
typedef BoolePolyRing ring_type;
BooleVariable(idx_type idx, const ring_type& ring):
m_poly( ring.variableDiagram(idx) ) {}
BooleVariable(const ring_type& ring):
m_poly( ring.variableDiagram(0) ) {}
BooleVariable(const self& rhs):
m_poly(rhs.m_poly) {}
operator const BoolePolynomial&() const { return m_poly; }
idx_type index() const { return *m_poly.firstBegin(); }
bool operator== (const self& other) const{
return m_poly==other.m_poly;
}
// Nonequality check
bool operator!= (const self& other) const{
return m_poly!=other.m_poly;
}
hash_type stableHash() const{ return m_poly.stableHash(); }
hash_type hash() const { return m_poly.hash(); }
set_type set() const { return m_poly.set(); }
const ring_type& ring() const { return m_poly.ring(); }
private:
friend class BoolePolyRing;
BooleVariable(const BoolePolynomial& poly):m_poly(poly){}
BoolePolynomial m_poly;
};
inline BoolePolynomial
operator/(const BooleVariable& lhs, const BooleVariable& rhs) {
return BoolePolynomial(BooleConstant(lhs == rhs), lhs.ring());
}
END_NAMESPACE_PBORI
#endif // of polybori_BooleVariable_h_