carl  24.04
Computer ARithmetic Library
BVConstraint.cpp
Go to the documentation of this file.
1 /**
2  * @file BVConstraint.cpp
3  * @author Andreas Krueger <andreas.krueger@rwth-aachen.de>
4  */
5 
6 #include "BVConstraint.h"
7 #include "BVConstraintPool.h"
8 
9 namespace carl {
11  return *(BVConstraintPool::getInstance().create(_consistent));
12 }
13 
15  const BVTerm& _lhs, const BVTerm& _rhs) {
16  return *(BVConstraintPool::getInstance().create(_relation, _lhs, _rhs));
17 }
18 
19 bool operator==(const BVConstraint& lhs, const BVConstraint& rhs) {
20  if (lhs.id() != 0 && rhs.id() != 0) {
21  return lhs.id() == rhs.id();
22  }
23  return std::forward_as_tuple(lhs.relation(), lhs.lhs(), lhs.rhs()) == std::forward_as_tuple(rhs.relation(), rhs.lhs(), rhs.rhs());
24 }
25 bool operator<(const BVConstraint& lhs, const BVConstraint& rhs) {
26  if (lhs.id() != 0 && rhs.id() != 0) {
27  return lhs.id() < rhs.id();
28  }
29  return std::forward_as_tuple(lhs.relation(), lhs.lhs(), lhs.rhs()) < std::forward_as_tuple(rhs.relation(), rhs.lhs(), rhs.rhs());
30 }
31 
32 std::ostream& operator<<(std::ostream& os, const BVConstraint& c) {
33  if (c.isAlwaysConsistent()) return os << "TRUE";
34  if (c.isAlwaysInconsistent()) return os << "FALSE";
35  return os << c.lhs() << " " << c.relation() << " " << c.rhs();
36 }
37 } // namespace carl
carl is the main namespace for the library.
bool operator<(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
std::ostream & operator<<(std::ostream &os, const BasicConstraint< Poly > &c)
Prints the given constraint on the given stream.
bool operator==(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
static BVConstraintPool & getInstance()
Returns the single instance of this class by reference.
Definition: Singleton.h:45
const BVTerm & rhs() const
Definition: BVConstraint.h:62
bool isAlwaysInconsistent() const
Definition: BVConstraint.h:115
bool isAlwaysConsistent() const
Definition: BVConstraint.h:111
const BVTerm & lhs() const
Definition: BVConstraint.h:55
std::size_t id() const
Definition: BVConstraint.h:76
BVCompareRelation relation() const
Definition: BVConstraint.h:69
static BVConstraint create(bool _consistent=true)
ConstConstraintPtr create(bool _consistent=true)