-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTerm.hpp
More file actions
70 lines (61 loc) · 1.64 KB
/
Term.hpp
File metadata and controls
70 lines (61 loc) · 1.64 KB
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
#ifndef ISL_CXX_Term_IMPL_H
#define ISL_CXX_Term_IMPL_H
#include "isl/Term.h"
#include "isl/Aff.hpp"
#include "isl/DimType.h"
#include "isl/IslBase.h"
#include "isl/IslException.h"
#include <string>
#include <cassert>
namespace isl {
inline isl_term *Term::GetCopy() const {
return isl_term_copy((isl_term *)This);
}
inline Term &Term::operator=(const Term &Other) {
isl_term *New = Other.GetCopy();
ctx = Other.Context();
isl_term_free((isl_term *)This);
This = New;
return *this;
}inline Term::~Term() {
isl_term_free((isl_term *)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_term *Term::Give() {
isl_term *res = (isl_term *)This;
This = nullptr;
return res;
}
/// \brief Unwrap the stored isl object.
/// \returns A the wrapped isl object.
inline isl_term *Term::Get() const { return (isl_term *)This;
}
inline unsigned int Term::dim(DimType type) const {
ctx.lock();
unsigned int res = isl_term_dim((*this).Get(), (enum isl_dim_type)type);
ctx.unlock();
return res;
}
inline Aff Term::getDiv(unsigned int pos) const {
ctx.lock();
isl_aff * res = isl_term_get_div((*this).Get(), pos);
ctx.unlock();
if (ctx.hasError()) {
handleError("isl_term_get_div returned a NULL pointer.");
}
return Aff(ctx, res);
}
inline int Term::getExp(DimType type, unsigned int pos) const {
ctx.lock();
int res = isl_term_get_exp((*this).Get(), (enum isl_dim_type)type, pos);
ctx.unlock();
return res;
}
} // namespace isl
#endif //ISL_CXX_Term_IMPL_H