23 inline tbool::tbool(
bool a) : x(a ? tbool_true : tbool_false)
31 inline tbool::operator tbool_t()
36 inline tbool::operator bool()
43 return tbool(tbool_or(a.x,b.x));
48 return tbool(tbool_and(a.x,b.x));
53 return tbool(tbool_not(a.x));
56 inline std::ostream&
operator<<(std::ostream& os, tbool x)
59 case tbool_true:
return os <<
"true";
60 case tbool_false:
return os <<
"false";
61 case tbool_top:
return os <<
"top";
62 default:
throw std::invalid_argument(
"apron::operator<<(ostream&, tbool) invalid boolean");
76 if (!m)
throw std::invalid_argument(
"apron::manager::manager(ap_manager_t* m) m is NULL");
78 for (
size_t i=0; i<AP_EXC_SIZE; i++)
79 m->option.abort_if_exception[i] = 0;
82 inline bool manager::exception_raised()
84 return (m->result.exclog && m->result.exclog->exn!=AP_EXC_NONE);
88 inline void manager::raise(ap_manager_t* m,
const char* msg, ap_abstract0_t* a)
90 if (!m->result.exclog)
return;
92 std::string s = std::string(msg)+
" : "+m->result.exclog->msg;
94 switch (m->result.exclog->exn) {
100 ap_manager_clear_exclog(m);
101 if (a) ap_abstract0_free(m,a);
105 case AP_EXC_OUT_OF_SPACE:
106 ap_manager_clear_exclog(m);
107 if (a) ap_abstract0_free(m,a);
108 throw std::length_error(s);
111 case AP_EXC_OVERFLOW:
112 ap_manager_clear_exclog(m);
113 if (a) ap_abstract0_free(m,a);
114 throw std::overflow_error(s);
117 case AP_EXC_INVALID_ARGUMENT:
118 ap_manager_clear_exclog(m);
119 if (a) ap_abstract0_free(m,a);
120 throw std::invalid_argument(s);
123 case AP_EXC_NOT_IMPLEMENTED:
124 ap_manager_clear_exclog(m);
125 if (a) ap_abstract0_free(m,a);
126 throw not_implemented(s);
130 ap_manager_clear_exclog(m);
131 if (a) ap_abstract0_free(m,a);
132 throw std::range_error(s+
" (unknwon exception type)");
137 inline void manager::raise(
const char* msg, ap_abstract0_t* a)
139 manager::raise(m, msg, a);
142 inline void manager::raise(ap_manager_t* m,
const char* msg, ap_abstract1_t a)
144 if (!m->result.exclog || m->result.exclog->exn==AP_EXC_NONE)
return;
145 ap_environment_free(a.env);
146 raise(m,msg,a.abstract0);
150 inline void manager::raise(
const char* msg, ap_abstract1_t a)
152 manager::raise(m, msg, a);
155 inline manager::manager(
const manager& x)
156 : m(ap_manager_copy(x.m))
160 inline manager::~manager()
165 inline manager& manager::operator= (
const manager& x)
167 ap_manager_t* mm = ap_manager_copy(x.m);
173 inline std::string manager::get_library()
const 175 return std::string(ap_manager_get_library(m));
178 inline std::string manager::get_version()
const 180 return std::string(ap_manager_get_version(m));
183 inline ap_funopt_t& manager::get_funopt(ap_funid_t funid)
185 if (funid<=AP_FUNID_UNKNOWN || funid>=AP_FUNID_SIZE)
186 throw std::out_of_range(
"apron::manager::get_funopt(ap_funid_t) unknown funid");
187 return m->option.funopt[funid];
190 inline ap_scalar_discr_t& manager::get_scalar_discr()
192 return m->option.scalar_discr;
195 inline bool manager::get_flag_exact()
197 return ap_manager_get_flag_exact(m);
200 inline bool manager::get_flag_best()
202 return ap_manager_get_flag_best(m);
206 inline ap_manager_t* manager::get_ap_manager_t()
211 inline const ap_manager_t* manager::get_ap_manager_t()
const 216 inline void manager::fpu_init()
219 throw std::runtime_error(
"apron::manager::fpu_init() failed");
222 inline std::ostream&
operator<< (std::ostream& os,
const manager& s)
224 return os << ap_manager_get_library(s.m) <<
", " << ap_manager_get_version(s.m);
tbool(bool a)
Converts true to tbool_true and false to tbool_false.
Definition: apxx_manager.hh:24
tbool operator!(tbool a)
Definition: apxx_manager.hh:52
tbool operator||(tbool a, tbool b)
Definition: apxx_manager.hh:42
std::ostream & operator<<(std::ostream &os, tbool x)
Definition: apxx_manager_inline.hh:56
std::ostream & operator<<(std::ostream &os, const abstract0 &s)
Definition: apxx_abstract0.hh:293
manager(ap_manager_t *m)
Internal use only (by subclasses). Initialise from a ap_manager_t* and take ownership (no copy).
Definition: apxx_manager.hh:75
tbool operator &&(tbool a, tbool b)
Definition: apxx_manager.hh:47