cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
response_or_error.h
Go to the documentation of this file.
1
// Author: Diffblue Ltd.
2
3
#ifndef CPROVER_SOLVERS_SMT2_INCREMENTAL_RESPONSE_OR_ERROR_H
4
#define CPROVER_SOLVERS_SMT2_INCREMENTAL_RESPONSE_OR_ERROR_H
5
6
#include <
util/invariant.h
>
7
8
#include <string>
9
#include <variant>
10
#include <vector>
11
15
template
<
class
smtt>
16
class
response_or_errort
final
17
{
18
public
:
19
explicit
response_or_errort
(smtt smt) :
smt_or_messages
{
std
::move(smt)}
20
{
21
}
22
23
explicit
response_or_errort
(std::vector<std::string> messages)
24
:
smt_or_messages
{
std
::move(messages)}
25
{
26
}
27
30
const
smtt *
get_if_valid
()
const
31
{
32
return
std::get_if<smtt>(&
smt_or_messages
);
33
}
34
37
const
std::vector<std::string> *
get_if_error
()
const
38
{
39
return
std::get_if<std::vector<std::string>>(&
smt_or_messages
);
40
}
41
42
private
:
43
std::variant<smtt, std::vector<std::string>>
smt_or_messages
;
44
};
45
46
#endif
// CPROVER_SOLVERS_SMT2_INCREMENTAL_RESPONSE_OR_ERROR_H
response_or_errort::get_if_error
const std::vector< std::string > * get_if_error() const
Gets the error messages if the response is invalid, or returns nullptr otherwise.
Definition
response_or_error.h:37
response_or_errort::response_or_errort
response_or_errort(smtt smt)
Definition
response_or_error.h:19
response_or_errort::get_if_valid
const smtt * get_if_valid() const
Gets the smt response if the response is valid, or returns nullptr otherwise.
Definition
response_or_error.h:30
response_or_errort::response_or_errort
response_or_errort(std::vector< std::string > messages)
Definition
response_or_error.h:23
response_or_errort::smt_or_messages
std::variant< smtt, std::vector< std::string > > smt_or_messages
Definition
response_or_error.h:43
std
STL namespace.
invariant.h
solvers
smt2_incremental
response_or_error.h
Generated by
1.17.0