5#include "dlinear/symbolic/symbolic_formula.h"
7namespace dlinear::drake::symbolic {
18template<
typename Result,
typename Visitor,
typename... Args>
19Result VisitFormula(Visitor *v,
const Formula &f, Args &&... args) {
20 switch (f.get_kind()) {
21 case FormulaKind::False:
return v->VisitFalse(f, std::forward<Args>(args)...);
22 case FormulaKind::True:
return v->VisitTrue(f, std::forward<Args>(args)...);
23 case FormulaKind::Var:
return v->VisitVariable(f, std::forward<Args>(args)...);
24 case FormulaKind::Eq:
return v->VisitEqualTo(f, std::forward<Args>(args)...);
25 case FormulaKind::Neq:
return v->VisitNotEqualTo(f, std::forward<Args>(args)...);
26 case FormulaKind::Gt:
return v->VisitGreaterThan(f, std::forward<Args>(args)...);
27 case FormulaKind::Geq:
return v->VisitGreaterThanOrEqualTo(f, std::forward<Args>(args)...);
28 case FormulaKind::Lt:
return v->VisitLessThan(f, std::forward<Args>(args)...);
29 case FormulaKind::Leq:
return v->VisitLessThanOrEqualTo(f, std::forward<Args>(args)...);
30 case FormulaKind::And:
return v->VisitConjunction(f, std::forward<Args>(args)...);
31 case FormulaKind::Or:
return v->VisitDisjunction(f, std::forward<Args>(args)...);
32 case FormulaKind::Not:
return v->VisitNegation(f, std::forward<Args>(args)...);
33 case FormulaKind::Forall:
return v->VisitForall(f, std::forward<Args>(args)...);
37 throw std::runtime_error(
"Should not be reachable.");