P4C
The P4 Compiler
Loading...
Searching...
No Matches
accessor.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TEST_Z3_SOLVER_ACCESSOR_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TEST_Z3_SOLVER_ACCESSOR_H_
3
4#include <vector>
5
6#include "backends/p4tools/common/core/z3_solver.h"
7
8namespace P4::P4Tools {
9
10// The main class for access to a private members
12 public:
15
17 z3::expr_vector getAssertions(std::optional<bool> assertionType = std::nullopt) {
18 if (!assertionType) {
19 return solver.isIncremental ? solver.z3solver.assertions() : solver.z3Assertions;
20 }
21 if (assertionType.value()) {
22 return solver.z3solver.assertions();
23 }
24 return solver.z3Assertions;
25 }
26
29
31 const z3::context &getContext() { return solver.getZ3Ctx(); }
32
34 std::vector<size_t> &getCheckpoints() { return solver.checkpoints; }
35
36 private:
39};
40
41} // namespace P4::P4Tools
42
43#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TEST_Z3_SOLVER_ACCESSOR_H_ */
Definition accessor.h:11
z3::expr_vector getAssertions(std::optional< bool > assertionType=std::nullopt)
Gets all assertions. Used by GTests only.
Definition accessor.h:17
const z3::context & getContext()
Get Z3 context. Used by GTests only.
Definition accessor.h:31
std::vector< size_t > & getCheckpoints()
Gets checkpoints that have been made. Used by GTests only.
Definition accessor.h:34
safe_vector< const Constraint * > getP4Assertions()
Gets all P4 assertions. Used by GTests only.
Definition accessor.h:28
Z3SolverAccessor(Z3Solver &solver)
Default constructor.
Definition accessor.h:14
A Z3-based implementation of AbstractSolver. Encapsulates a z3::solver and a z3::context.
Definition z3_solver.h:29
Definition safe_vector.h:27
Definition common/compiler/compiler_result.cpp:3
Definition phv/solver/action_constraint_solver.cpp:33