SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
ExpressionPool.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../Common.h"
4 
5 #include "ExpressionTypes.h"
6 #include "ExpressionContent.h"
7 
8 namespace smtrat {
9 namespace expression {
10 
11  class ExpressionPool: public carl::Singleton<ExpressionPool>
12  {
13  friend carl::Singleton<ExpressionPool>;
14  friend class ExpressionModifier;
15  private:
16  std::size_t mNextID;
17  std::unordered_set<ExpressionContent*> mPool;
18 
19  protected:
21  carl::Singleton<ExpressionPool>(),
22  mNextID(1),
23  mPool()
24  {}
25 
27 
28  public:
29 
30  const ExpressionContent* create(carl::Variable::Arg var);
31  const ExpressionContent* create(ITEType _type, Expression&& _if, Expression&& _then, Expression&& _else);
32  const ExpressionContent* create(QuantifierType _type, std::vector<carl::Variable>&& _variables, Expression&& _expression);
33  const ExpressionContent* create(UnaryType _type, Expression&& _expression);
34  const ExpressionContent* create(BinaryType _type, Expression&& _lhs, Expression&& _rhs);
35  const ExpressionContent* create(NaryType _type, Expressions&& _expressions);
36  const ExpressionContent* create(NaryType _type, const std::initializer_list<Expression>& _expressions);
37 
38  template<typename... Args>
39  static const ExpressionContent* create(Args&&... args) {
40  return ExpressionPool::getInstance().create(std::forward<Args>(args)...);
41  }
42  };
43 
44 }
45 }
static const ExpressionContent * create(Args &&... args)
const ExpressionContent * create(NaryType _type, Expressions &&_expressions)
const ExpressionContent * create(UnaryType _type, Expression &&_expression)
const ExpressionContent * create(BinaryType _type, Expression &&_lhs, Expression &&_rhs)
const ExpressionContent * create(QuantifierType _type, std::vector< carl::Variable > &&_variables, Expression &&_expression)
const ExpressionContent * create(ITEType _type, Expression &&_if, Expression &&_then, Expression &&_else)
const ExpressionContent * create(NaryType _type, const std::initializer_list< Expression > &_expressions)
std::unordered_set< ExpressionContent * > mPool
const ExpressionContent * add(ExpressionContent *_ec)
const ExpressionContent * create(carl::Variable::Arg var)
int var(Lit p)
Definition: SolverTypes.h:64
std::vector< Expression > Expressions
Class to create the formulas for axioms.