libTriton version 1.0 build 1590
Loading...
Searching...
No Matches
solverModel.cpp
Go to the documentation of this file.
1
2/*
3** Copyright (C) - Triton
4**
5** This program is under the terms of the Apache License 2.0.
6*/
7
8#include <cstdlib>
9
12
13
14
15namespace triton {
16 namespace engines {
17 namespace solver {
18
20 this->value = 0;
21 }
22
23
25 this->value = value;
26 this->variable = variable;
27 }
28
29
31 this->copy(other);
32 }
33
34
35 void SolverModel::copy(const SolverModel& other) {
36 this->value = other.value;
37 this->variable = other.variable;
38 }
39
40
42 return this->variable->getId();
43 }
44
45
47 return this->value;
48 }
49
50
52 return this->variable->getSize();
53 }
54
55
59
60
62 this->copy(other);
63 return *this;
64 }
65
66
67 bool SolverModel::operator==(const SolverModel& other) const {
68 return (this->value == other.value && this->variable->getId() == other.variable->getId());
69 }
70
71
72 std::ostream& operator<<(std::ostream& stream, const SolverModel& model) {
73 stream << model.getVariable() << " = 0x" << std::hex << model.getValue() << std::dec;
74 return stream;
75 }
76
77
78 std::ostream& operator<<(std::ostream& stream, const SolverModel* model) {
79 stream << *model;
80 return stream;
81 }
82
83 };
84 };
85};
This class is used to represent a constraint model solved.
TRITON_EXPORT triton::usize getId(void) const
Returns the id of the variable.
TRITON_EXPORT SolverModel & operator=(const SolverModel &other)
Copies a SolverModel.
TRITON_EXPORT bool operator==(const SolverModel &other) const
Operator ==.
TRITON_EXPORT triton::uint32 getSize(void) const
Returns the size (in bits) of the symbolic variable.
TRITON_EXPORT SolverModel()
Constructor.
triton::uint512 value
The value of the model.
triton::engines::symbolic::SharedSymbolicVariable variable
The symbolic variable.
TRITON_EXPORT triton::uint512 getValue(void) const
Returns the value of the model.
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable & getVariable(void) const
Returns the symbolic variable.
std::ostream & operator<<(std::ostream &stream, const SolverModel &model)
Display a solver model.
std::shared_ptr< triton::engines::symbolic::SymbolicVariable > SharedSymbolicVariable
Shared Symbolic variable.
Definition ast.hpp:43
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
math::wide_integer::uint512_t uint512
unsigned 512-bits
std::uint32_t uint32
unisgned 32-bits
The Triton namespace.