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