CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
api.h
Go to the documentation of this file.
1// Author: Fotis Koutoulakis for Diffblue Ltd.
2
3#ifndef CPROVER_LIBCPROVER_CPP_API_H
4#define CPROVER_LIBCPROVER_CPP_API_H
5
6#include <memory>
7#include <string>
8#include <vector>
9
10// Forward declaration of API dependencies
12
13// There has been a design decision to allow users to include all of
14// the API headers by just including `api.h`, so we want to have an
15// include for all the API headers below. If we get any auxiliary
16// development tools complaining about the includes, please use
17// a pragma like below to silence the warning (at least as long
18// as the design principle is to be followed.)
19
20#include "api_options.h" // IWYU pragma: keep
21#include "verification_result.h" // IWYU pragma: keep
22
25struct api_messaget;
26
31const char *api_message_get_string(const api_messaget &message);
32
34bool api_message_is_error(const api_messaget &message);
35
41
51 const api_messaget &message,
53
54// An object in the pattern of Session Facade - owning all of the memory
55// the API is using and being responsible for the management of that.
57{
58 // Initialising constructor
60 explicit api_sessiont(const api_optionst &options);
61 ~api_sessiont(); // default constructed in the .cpp file
62
68 api_message_callbackt callback,
70
73 void load_model_from_files(const std::vector<std::string> &files) const;
74
75 // Run the verification engine against previously loaded model and return
76 // results object pointer.
77 std::unique_ptr<verification_resultt> verify_model() const;
78
80 void drop_unused_functions() const;
81
83 void validate_goto_model() const;
84
86 std::unique_ptr<std::string> get_api_version() const;
87
90 std::unique_ptr<verification_resultt> run_verifier() const;
91
94 void read_goto_binary(std::string &file) const;
95
97 bool is_goto_binary(std::string &file) const;
98
99private:
100 std::unique_ptr<api_session_implementationt> implementation;
101
106 bool preprocess_model() const;
107};
108
109#endif
bool api_message_is_error(const api_messaget &message)
Definition api.cpp:87
const char * api_message_get_string(const api_messaget &message)
Given a api_message, this function returns that message expressed as a C language string.
Definition api.cpp:82
void(*)(const api_messaget &message, api_call_back_contextt call_back_context) api_message_callbackt
The type of call back for feedback of status information and results.
Definition api.h:52
void * api_call_back_contextt
The type of pointers to contextual data passed to the api_message_callback functions.
Definition api.h:40
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
std::unique_ptr< std::string > get_api_version() const
A simple API version information function.
Definition api.cpp:37
std::unique_ptr< verification_resultt > run_verifier() const
Process the model by running symex and the decision procedure.
Definition api.cpp:223
bool preprocess_model() const
Implement necessary transformations to reduce model to symex-ready-GOTO, before being fed to symex.
Definition api.cpp:178
void load_model_from_files(const std::vector< std::string > &files) const
Load a goto_model from a given vector of filenames.
Definition api.cpp:136
bool is_goto_binary(std::string &file) const
True if file is goto-binary.
Definition api.cpp:173
std::unique_ptr< verification_resultt > verify_model() const
Definition api.cpp:143
void set_message_callback(api_message_callbackt callback, api_call_back_contextt context)
Definition api.cpp:128
void drop_unused_functions() const
Drop unused functions from the loaded goto_model simplifying it.
Definition api.cpp:243
void validate_goto_model() const
Validate the loaded goto model.
Definition api.cpp:258
std::unique_ptr< api_session_implementationt > implementation
Definition api.h:100
api_sessiont()
Definition api.cpp:49
void read_goto_binary(std::string &file) const
Read a goto-binary from a given filename.
Definition api.cpp:156
Interface for the various verification engines providing results.