forked from simbuerg/isl-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIdToAstExpr.hpp
127 lines (115 loc) · 3.58 KB
/
IdToAstExpr.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef ISL_CXX_IdToAstExpr_IMPL_H
#define ISL_CXX_IdToAstExpr_IMPL_H
#include "isl/IdToAstExpr.h"
#include "isl/AstExpr.hpp"
#include "isl/Id.hpp"
#include "isl/Bool.h"
#include "isl/Ctx.hpp"
#include "isl/Format.h"
#include "isl/IslBase.h"
#include "isl/IslException.h"
#include "isl/Stat.h"
#include "isl/ast.h"
#include "isl/id.h"
#include <string>
#include <ostream>
#include <cassert>
namespace isl {
inline isl_id_to_ast_expr *IdToAstExpr::GetCopy() const {
return isl_id_to_ast_expr_copy((isl_id_to_ast_expr *)This);
}
inline IdToAstExpr &IdToAstExpr::operator=(const IdToAstExpr &Other) {
isl_id_to_ast_expr *New = Other.GetCopy();
isl_id_to_ast_expr_free((isl_id_to_ast_expr *)This);
This = New;
return *this;
}
inline IdToAstExpr IdToAstExpr::alloc(const Ctx &ctx, int min_size) {
const Ctx &_ctx = ctx.Context();
_ctx.lock();
isl_id_to_ast_expr *That = isl_id_to_ast_expr_alloc((ctx.Get()), min_size);
ctx.unlock();
_ctx.unlock();
if (_ctx.hasError()) {
handleError("isl_id_to_ast_expr_alloc returned a NULL pointer.");
}
return IdToAstExpr(_ctx, That);
}
inline IdToAstExpr::~IdToAstExpr() {
isl_id_to_ast_expr_free((isl_id_to_ast_expr *)This);
This = nullptr;
}
/// rief Release ownership of the wrapped object.
///
/// You are on your own now buddy.
/// The wrapper cannot be used anymore after calling Give()
///
///@return the wrapped isl object.
inline isl_id_to_ast_expr *IdToAstExpr::Give() {
isl_id_to_ast_expr *res = (isl_id_to_ast_expr *)This;
This = nullptr;
return res;
}
/// \brief Unwrap the stored isl object.
/// \returns A the wrapped isl object.
inline isl_id_to_ast_expr *IdToAstExpr::Get() const { return (isl_id_to_ast_expr *)This;
}
inline IdToAstExpr IdToAstExpr::asIdToAstExpr() const {
return IdToAstExpr(ctx, GetCopy());
}
inline Stat IdToAstExpr::foreach_(const std::function<isl_stat(isl_id *, isl_ast_expr *, void *)> && fn, void * user) const {
ctx.lock();
IdToAstExpr self = asIdToAstExpr();
// Prepare arguments
// Call isl_id_to_ast_expr_foreach
isl_stat res = isl_id_to_ast_expr_foreach((self).Get(), get_fn_ptr<7>(fn), user);
// Handle result argument(s)
ctx.unlock();
// Handle return
return (Stat)res;
}
inline AstExpr IdToAstExpr::get(const Id &key) const {
ctx.lock();
IdToAstExpr self = asIdToAstExpr();
// Prepare arguments
Id _cast_key = key.asId();
// Call isl_id_to_ast_expr_get
isl_ast_expr * res = isl_id_to_ast_expr_get((self).Get(), (_cast_key).Give());
// Handle result argument(s)
ctx.unlock();
// Handle return
if (ctx.hasError()) {
handleError("isl_id_to_ast_expr_get returned a NULL pointer.");
}
return AstExpr(ctx, res);
}
inline Bool IdToAstExpr::has(const Id &key) const {
ctx.lock();
IdToAstExpr self = asIdToAstExpr();
// Prepare arguments
Id _cast_key = key.asId();
// Call isl_id_to_ast_expr_has
isl_bool res = isl_id_to_ast_expr_has((self).Get(), (_cast_key).Get());
// Handle result argument(s)
ctx.unlock();
// Handle return
return (Bool)res;
}
inline IdToAstExpr IdToAstExpr::set(const Id &key, const AstExpr &val) const {
ctx.lock();
IdToAstExpr self = asIdToAstExpr();
// Prepare arguments
Id _cast_key = key.asId();
AstExpr _cast_val = val.asAstExpr();
// Call isl_id_to_ast_expr_set
isl_id_to_ast_expr * res = isl_id_to_ast_expr_set((self).Give(), (_cast_key).Give(), (_cast_val).Give());
// Handle result argument(s)
ctx.unlock();
// Handle return
if (ctx.hasError()) {
handleError("isl_id_to_ast_expr_set returned a NULL pointer.");
}
return IdToAstExpr(ctx, res);
}
} // namespace isl
#endif //ISL_CXX_IdToAstExpr_IMPL_H