APRONXX  0.9.12
/builddir/build/BUILD/apron-0.9.12/apronxx/apxx_generator0.hh
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * apxx_generator0.hh
3  *
4  * APRON Library / C++ class wrappers
5  *
6  * Copyright (C) Antoine Mine' 2007
7  *
8  */
9 /* This file is part of the APRON Library, released under LGPL license
10  with an exception allowing the redistribution of statically linked
11  executables.
12 
13  Please read the COPYING file packaged in the distribution.
14 */
15 
16 #ifndef __APXX_GENERATOR0_HH
17 #define __APXX_GENERATOR0_HH
18 
19 #include <vector>
20 #include "ap_generator0.h"
21 #include "apxx_linexpr0.hh"
22 
23 
24 namespace apron {
25 
26 
27 
28 /* ================================= */
29 /* generator0 */
30 /* ================================= */
31 
32 
39 class generator0 : public use_malloc {
40 
41 protected:
42 
43  ap_generator0_t l;
44 
46  generator0(ap_generator0_t& l) : l(l) {}
47 
48  friend class abstract0;
49 
50 public:
51 
52 
53  /* constructors */
54  /* ============ */
55 
62  generator0(ap_gentyp_t gentyp=AP_GEN_RAY);
63 
71  generator0(ap_gentyp_t gentyp, const linexpr0& lin);
72 
74  generator0(const generator0& x);
75 
77  generator0(const generator0& x, const dimchange& d);
78 
80  generator0(const generator0& x, const dimperm& d);
81 
82 
83  /* destructor */
84  /* ========== */
85 
87  ~generator0();
88 
89 
90  /* assignment */
91  /* ========== */
92 
94  generator0& operator= (const generator0& x);
95 
96 
97  /* dimension operations */
98  /* ==================== */
99 
104  void resize(size_t size);
105 
110  void add_dimensions(const dimchange& d);
111 
116  void permute_dimensions(const dimperm& d);
117 
118 
119  /* access */
120  /* ====== */
121 
122  /* size */
123 
128  size_t size() const;
129 
130 
131  /* get */
132 
137  ap_gentyp_t& get_gentyp();
138 
143  const ap_gentyp_t& get_gentyp() const;
144 
150  bool has_linexpr() const;
151 
157 
162  const linexpr0& get_linexpr() const;
163 
170  void set_linexpr(const linexpr0& c);
171 
172 
173  /* print */
174  /* ===== */
175 
182  friend std::ostream& operator<< (std::ostream& os, const generator0& s);
183 
185  void print(char** name_of_dim=NULL, FILE* stream=stdout) const;
186 
187 
188  /* TODO: intelligent constructors */
189 
190 
191  /* C-level compatibility */
192  /* ===================== */
193 
195  const ap_generator0_t* get_ap_generator0_t() const;
196 
198  ap_generator0_t* get_ap_generator0_t();
199 
200 };
201 
202 
203 
204 
205 /* ================================= */
206 /* generator0_array */
207 /* ================================= */
208 
209 
214 class generator0_array : public use_malloc {
215 
216 protected:
217 
218  ap_generator0_array_t a;
219 
221  generator0_array(ap_generator0_array_t& a) : a(a) {}
222 
223  friend class abstract0;
224  friend class generator1_array;
225 
226 public:
227 
228  /* constructors */
229  /* ============ */
230 
233 
238  generator0_array(size_t size);
239 
242 
244  generator0_array(const generator0_array& x, const dimchange& d);
245 
247  generator0_array(const generator0_array& x, const dimperm& d);
248 
250  generator0_array(size_t size, const generator0 x[]);
251 
253  generator0_array(const std::vector<generator0>& x);
254 
256 
257 
258  /* destructor */
259  /* ========== */
260 
263 
266 
268 
269 
270  /* assignment */
271  /* ========== */
272 
275 
278 
284 
286  generator0_array& operator= (const std::vector<generator0>& x);
287 
289 
290 
291  /* dimension operations */
292  /* ==================== */
293 
296 
298  void resize(size_t size);
299 
301  void add_dimensions(const dimchange& d);
302 
304  void permute_dimensions(const dimperm& d);
305 
307 
308 
309  /* access */
310  /* ====== */
311 
314 
316  size_t size() const;
317 
319  generator0* contents();
320 
322  const generator0* contents() const;
323 
325  generator0& operator[](size_t i);
326 
328  const generator0& operator[](size_t i) const;
329 
334  generator0& get(size_t i);
335 
340  const generator0& get(size_t i) const;
341 
343 
344 
345  /* conversion */
346  /* ========== */
347 
350 
352  operator std::vector<generator0>() const;
353 
355 
356 
357  /* print */
358  /* ===== */
359 
362 
369  friend std::ostream& operator<< (std::ostream& os, const generator0_array& s);
370 
372  void print(char** name_of_dim=NULL, FILE* stream=stdout) const;
373 
375 
376 
377  /* C-level compatibility */
378  /* ===================== */
379 
382 
384  const ap_generator0_array_t* get_ap_generator0_array_t() const;
385 
387  ap_generator0_array_t* get_ap_generator0_array_t();
388 
390 };
391 
392 
393 #include "apxx_generator0_inline.hh"
394 
395 }
396 
397 #endif /* __APXX_GENERATOR0_HH */
apron::generator0_array::generator0_array
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
apron::generator0_array::a
ap_generator0_array_t a
Structure managed by APRON.
Definition: apxx_generator0.hh:218
apron::abstract0
Level 0 abstract value (ap_abstract0_t* wrapper).
Definition: apxx_abstract0.hh:78
apron::generator0_array::resize
void resize(size_t size)
Resizes the array.
Definition: apxx_generator0_inline.hh:286
apron::generator0::get_linexpr
linexpr0 & get_linexpr()
Returns a (modifiable) reference to the underlying linear expression.
Definition: apxx_generator0_inline.hh:134
apron::generator0_array::~generator0_array
~generator0_array()
Frees the space used by the array and all its generators.
Definition: apxx_generator0_inline.hh:243
apron::dimchange
Dimension change object (ap_dimchange_t wrapper).
Definition: apxx_dimension.hh:102
apron::generator0::add_dimensions
void add_dimensions(const dimchange &d)
Changes the dimension of the underlying linear expression.
Definition: apxx_generator0_inline.hh:92
apron::generator0_array::operator[]
generator0 & operator[](size_t i)
Returns a (modifiable) reference to an element, no bound checking.
Definition: apxx_generator0_inline.hh:320
apron::generator0_array::size
size_t size() const
Returns the size of the array.
Definition: apxx_generator0_inline.hh:305
apxx_generator0_inline.hh
apron::generator1_array
Array of generators (ap_generator1_array_t wrapper).
Definition: apxx_generator1.hh:272
apron::generator0_array::permute_dimensions
void permute_dimensions(const dimperm &d)
Applies permute_dimensions to all generators in the array.
Definition: apxx_generator0_inline.hh:296
apron::use_malloc
Inherited by most wrappers to map new and delete to malloc and free.
Definition: apxx_scalar.hh:69
apron::generator0
Level 0 generator (ap_generator0_t wrapper).
Definition: apxx_generator0.hh:39
apxx_linexpr0.hh
apron::generator0_array::operator=
generator0_array & operator=(const generator0_array &x)
(Deep) copy.
Definition: apxx_generator0_inline.hh:252
apron::generator0::operator<<
friend std::ostream & operator<<(std::ostream &os, const generator0 &s)
Printing.
apron::generator0::size
size_t size() const
Returns the size of the underlying linear expression.
Definition: apxx_generator0_inline.hh:110
apron::generator0::get_gentyp
ap_gentyp_t & get_gentyp()
Returns a (modifiable) reference to the constraint type.
Definition: apxx_generator0_inline.hh:119
apron::generator0_array::contents
generator0 * contents()
Returns a pointer to the start of the internal array holding the generators.
Definition: apxx_generator0_inline.hh:310
apron::generator0::l
ap_generator0_t l
Structure managed by APRON.
Definition: apxx_generator0.hh:43
apron::generator0::~generator0
~generator0()
Frees the generator, including the embedded linear expression.
Definition: apxx_generator0_inline.hh:64
apron::dimperm
Dimension permutation object (ap_dimperm_t wrapper).
Definition: apxx_dimension.hh:292
apron::generator0::set_linexpr
void set_linexpr(const linexpr0 &c)
Sets the underlying linear expression to c (copied).
Definition: apxx_generator0_inline.hh:146
apron::generator0_array::print
void print(char **name_of_dim=NULL, FILE *stream=stdout) const
Prints to a C stream.
Definition: apxx_generator0_inline.hh:368
apron::generator0::operator=
generator0 & operator=(const generator0 &x)
(Deep) copy.
Definition: apxx_generator0_inline.hh:73
apron::generator0_array::operator<<
friend std::ostream & operator<<(std::ostream &os, const generator0_array &s)
Printing.
apron::linexpr0
Level 0 linear expression (ap_linexpr0_t wrapper).
Definition: apxx_linexpr0.hh:44
apron::generator0::get_ap_generator0_t
const ap_generator0_t * get_ap_generator0_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_generator0_inline.hh:181
apron::generator0_array::get
generator0 & get(size_t i)
Returns a (modifiable) reference to an element (bound-checked).
Definition: apxx_generator0_inline.hh:330
apron::generator0::has_linexpr
bool has_linexpr() const
Returns whether the generator has a valid linear expression.
Definition: apxx_generator0_inline.hh:129
apron::generator0::resize
void resize(size_t size)
Resizes the underlying linear expression.
Definition: apxx_generator0_inline.hh:86
apron::generator0_array::get_ap_generator0_array_t
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
apron::generator0::generator0
generator0(ap_generator0_t &l)
Internal use only. Performs a shallow copy and takes ownership of the contents.
Definition: apxx_generator0.hh:46
apron
Definition: apxx_abstract0.hh:27
apron::generator0_array::add_dimensions
void add_dimensions(const dimchange &d)
Applies add_dimensions to all generators in the array.
Definition: apxx_generator0_inline.hh:291
apron::generator0_array
Array of generators (ap_generator0_array_t wrapper).
Definition: apxx_generator0.hh:214
apron::generator0::permute_dimensions
void permute_dimensions(const dimperm &d)
Applies a permutation to the underlying linear expression.
Definition: apxx_generator0_inline.hh:98
apron::generator0::print
void print(char **name_of_dim=NULL, FILE *stream=stdout) const
Prints to a C stream.
Definition: apxx_generator0_inline.hh:172