27 inline generator0::generator0(ap_gentyp_t gentyp)
29 ap_linexpr0_t* llin = ap_linexpr0_alloc(AP_LINEXPR_SPARSE,0);
30 l = ap_generator0_make(gentyp, llin);
33 inline generator0::generator0(ap_gentyp_t gentyp,
const linexpr0& lin)
35 ap_linexpr0_t* llin = ap_linexpr0_copy(
const_cast<ap_linexpr0_t*
>(lin.
get_ap_linexpr0_t()));
36 l = ap_generator0_make(gentyp, llin);
41 l = ap_generator0_copy(
const_cast<ap_generator0_t*
>(&x.
l));
47 if (!x.
l.linexpr0)
throw std::invalid_argument(
"apron::generator0::generator0(const generator0&, cont dimchange&) empty expression");
48 l = ap_generator0_add_dimensions(
const_cast<ap_generator0_t*
>(&x.
l),
54 if (!x.
l.linexpr0)
throw std::invalid_argument(
"apron::generator0::generator0(const generator0&, cont dimperm&) empty expression");
55 l = ap_generator0_permute_dimensions(
const_cast<ap_generator0_t*
>(&x.
l),
64 inline generator0::~generator0()
66 ap_generator0_clear(
const_cast<ap_generator0_t*
>(&l));
76 ap_generator0_clear(
const_cast<ap_generator0_t*
>(&l));
77 l = ap_generator0_copy(
const_cast<ap_generator0_t*
>(&x.
l));
86 inline void generator0::resize(
size_t size)
88 if (!l.linexpr0)
throw std::invalid_argument(
"apron::generator0::resize(size_t) empty expression");
89 ap_linexpr0_realloc(l.linexpr0, size);
94 if (!l.linexpr0)
throw std::invalid_argument(
"apron::generator0::add_dimensions(const dimchange&) empty expression");
95 ap_generator0_add_dimensions_with(&l,
const_cast<ap_dimchange_t*
>(d.
get_ap_dimchange_t()));
100 if (!l.linexpr0)
throw std::invalid_argument(
"apron::generator0::permute_dimensions(const dimperm&) empty expression");
101 ap_generator0_permute_dimensions_with(&l,
const_cast<ap_dimperm_t*
>(d.
get_ap_dimperm_t()));
110 inline size_t generator0::size()
const
112 if (!l.linexpr0)
throw std::invalid_argument(
"apron::generator0::size() empty expression");
113 return ap_linexpr0_size(
const_cast<ap_linexpr0_t*
>(l.linexpr0));
119 inline ap_gentyp_t& generator0::get_gentyp()
124 inline const ap_gentyp_t& generator0::get_gentyp()
const
129 inline bool generator0::has_linexpr()
const
131 return l.linexpr0!=NULL;
136 if (!l.linexpr0)
throw std::invalid_argument(
"apron::generator0::get_linexpr() empty expression");
137 return reinterpret_cast<linexpr0&
>(*l.linexpr0);
140 inline const linexpr0& generator0::get_linexpr()
const
142 if (!l.linexpr0)
throw std::invalid_argument(
"apron::generator0::get_linexpr() empty expression");
143 return reinterpret_cast<linexpr0&
>(*l.linexpr0);
146 inline void generator0::set_linexpr(
const linexpr0& c)
148 if (l.linexpr0) ap_linexpr0_free(l.linexpr0);
149 l.linexpr0 = ap_linexpr0_copy(
const_cast<ap_linexpr0_t*
>(c.
get_ap_linexpr0_t()));
156 inline std::ostream&
operator<< (std::ostream& os,
const generator0& s)
158 if (!s.has_linexpr())
159 throw std::invalid_argument(
"apron::operator<<(ostream&, const generator0&) empty expression");
160 switch (s.get_gentyp()) {
161 case AP_GEN_LINE: os <<
"LINE: ";
break;
162 case AP_GEN_RAY: os <<
"RAY: ";
break;
163 case AP_GEN_VERTEX: os <<
"VERTEX: ";
break;
164 case AP_GEN_LINEMOD: os <<
"LINEMOD: ";
break;
165 case AP_GEN_RAYMOD: os <<
"RAYMOD: ";
break;
166 default:
throw std::invalid_argument(
"apron::operator<<(ostream&, const generator0&) invalid generator type");
168 return os << s.get_linexpr();
172 inline void generator0::print(
char** name_of_dim, FILE* stream)
const
174 ap_generator0_fprint(stream,
const_cast<ap_generator0_t*
>(&l), name_of_dim);
181 inline const ap_generator0_t* generator0::get_ap_generator0_t()
const
186 inline ap_generator0_t* generator0::get_ap_generator0_t()
201 inline generator0_array::generator0_array(
size_t size)
202 : a(ap_generator0_array_make(size))
207 : a(ap_generator0_array_make(x.a.size))
209 for (
size_t i=0; i<
a.size; i++)
210 a.p[i] = ap_generator0_copy(&x.
a.p[i]);
214 : a(ap_generator0_array_make(size))
216 for (
size_t i=0; i<
size; i++)
217 a.p[i] = ap_generator0_copy(
const_cast<ap_generator0_t*
>(x[i].get_ap_generator0_t()));
221 : a(ap_generator0_array_make(x.size()))
223 for (
size_t i=0; i<
a.size; i++)
224 a.p[i] = ap_generator0_copy(
const_cast<ap_generator0_t*
>(x[i].get_ap_generator0_t()));
229 a = ap_generator0_array_add_dimensions(
const_cast<ap_generator0_array_t*
>(&x.
a),
235 a = ap_generator0_array_permute_dimensions(
const_cast<ap_generator0_array_t*
>(&x.
a),
245 ap_generator0_array_clear(&
a);
255 ap_generator0_array_clear(&
a);
256 a = ap_generator0_array_make(x.
a.size);
257 for (
size_t i=0; i<
a.size; i++)
a.p[i] = ap_generator0_copy(&x.
a.p[i]);
264 size_t size =
a.size;
265 ap_generator0_array_clear(&
a);
266 a = ap_generator0_array_make(
size);
267 for (
size_t i=0; i<
size; i++)
268 a.p[i] = ap_generator0_copy(
const_cast<ap_generator0_t*
>(x[i].get_ap_generator0_t()));
274 size_t size = x.size();
275 ap_generator0_array_clear(&
a);
276 a = ap_generator0_array_make(
size);
277 for (
size_t i=0; i<
size; i++)
278 a.p[i] = ap_generator0_copy(
const_cast<ap_generator0_t*
>(x[i].get_ap_generator0_t()));
288 ap_generator0_array_resize(&
a,
size);
293 ap_generator0_array_add_dimensions_with(&
a,
const_cast<ap_dimchange_t*
>(d.
get_ap_dimchange_t()));
298 ap_generator0_array_permute_dimensions_with(&
a,
const_cast<ap_dimperm_t*
>(d.
get_ap_dimperm_t()));
332 if (i >=
a.size)
throw std::out_of_range(
"apron::generator0_array::get(size_t)");
338 if (i >=
a.size)
throw std::out_of_range(
"apron::generator0_array::get(size_t)");
346 inline generator0_array::operator std::vector<generator0>()
const
349 std::vector<generator0> v = std::vector<generator0>(sz);
350 for (
size_t i=0;i<sz;i++)
359 inline std::ostream&
operator<< (std::ostream& os,
const generator0_array& s)
361 size_t size = s.size();
363 for (
size_t i=0;i<size;i++)
370 ap_generator0_array_fprint(stream,
const_cast<ap_generator0_array_t*
>(&
a), name_of_dim);
abstract0 & permute_dimensions(manager &m, abstract0 &dst, const abstract0 &src, const dimperm &d)
Definition: apxx_abstract0_inline.hh:1060
abstract0 & add_dimensions(manager &m, abstract0 &dst, const abstract0 &src, const dimchange &d, bool project=false)
Definition: apxx_abstract0_inline.hh:1037
std::ostream & operator<<(std::ostream &os, const generator0 &s)
Definition: apxx_generator0_inline.hh:156
Dimension change object (ap_dimchange_t wrapper).
Definition: apxx_dimension.hh:102
const ap_dimchange_t * get_ap_dimchange_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_dimension_inline.hh:204
Dimension permutation object (ap_dimperm_t wrapper).
Definition: apxx_dimension.hh:292
const ap_dimperm_t * get_ap_dimperm_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_dimension_inline.hh:422
Array of generators (ap_generator0_array_t wrapper).
Definition: apxx_generator0.hh:214
generator0 & get(size_t i)
Returns a (modifiable) reference to an element (bound-checked).
Definition: apxx_generator0_inline.hh:330
void permute_dimensions(const dimperm &d)
Applies permute_dimensions to all generators in the array.
Definition: apxx_generator0_inline.hh:296
size_t size() const
Returns the size of the array.
Definition: apxx_generator0_inline.hh:305
ap_generator0_array_t a
Structure managed by APRON.
Definition: apxx_generator0.hh:218
generator0_array(ap_generator0_array_t &a)
Internal use only. Performs a shallow copy and takes ownership of the contents.
Definition: apxx_generator0.hh:221
void resize(size_t size)
Resizes the array.
Definition: apxx_generator0_inline.hh:286
generator0 & operator[](size_t i)
Returns a (modifiable) reference to an element, no bound checking.
Definition: apxx_generator0_inline.hh:320
generator0_array & operator=(const generator0_array &x)
(Deep) copy.
Definition: apxx_generator0_inline.hh:252
~generator0_array()
Frees the space used by the array and all its generators.
Definition: apxx_generator0_inline.hh:243
generator0 * contents()
Returns a pointer to the start of the internal array holding the generators.
Definition: apxx_generator0_inline.hh:310
void add_dimensions(const dimchange &d)
Applies add_dimensions to all generators in the array.
Definition: apxx_generator0_inline.hh:291
const ap_generator0_array_t * get_ap_generator0_array_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_generator0_inline.hh:377
void print(char **name_of_dim=NULL, FILE *stream=stdout) const
Prints to a C stream.
Definition: apxx_generator0_inline.hh:368
Level 0 generator (ap_generator0_t wrapper).
Definition: apxx_generator0.hh:39
ap_generator0_t l
Structure managed by APRON.
Definition: apxx_generator0.hh:43
Level 0 linear expression (ap_linexpr0_t wrapper).
Definition: apxx_linexpr0.hh:44
const ap_linexpr0_t * get_ap_linexpr0_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_linexpr0_inline.hh:459