APRONXX  0.9.12
/builddir/build/BUILD/apron-0.9.13/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 */
Level 0 abstract value (ap_abstract0_t* wrapper).
Definition: apxx_abstract0.hh:78
Dimension change object (ap_dimchange_t wrapper).
Definition: apxx_dimension.hh:102
Dimension permutation object (ap_dimperm_t wrapper).
Definition: apxx_dimension.hh:292
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
friend std::ostream & operator<<(std::ostream &os, const generator0_array &s)
Printing.
Level 0 generator (ap_generator0_t wrapper).
Definition: apxx_generator0.hh:39
generator0(ap_generator0_t &l)
Internal use only. Performs a shallow copy and takes ownership of the contents.
Definition: apxx_generator0.hh:46
void set_linexpr(const linexpr0 &c)
Sets the underlying linear expression to c (copied).
Definition: apxx_generator0_inline.hh:146
generator0(ap_gentyp_t gentyp=AP_GEN_RAY)
Creates a new generator from an empty linear expression.
generator0 & operator=(const generator0 &x)
(Deep) copy.
Definition: apxx_generator0_inline.hh:73
void permute_dimensions(const dimperm &d)
Applies a permutation to the underlying linear expression.
Definition: apxx_generator0_inline.hh:98
bool has_linexpr() const
Returns whether the generator has a valid linear expression.
Definition: apxx_generator0_inline.hh:129
ap_gentyp_t & get_gentyp()
Returns a (modifiable) reference to the constraint type.
Definition: apxx_generator0_inline.hh:119
friend std::ostream & operator<<(std::ostream &os, const generator0 &s)
Printing.
void resize(size_t size)
Resizes the underlying linear expression.
Definition: apxx_generator0_inline.hh:86
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
linexpr0 & get_linexpr()
Returns a (modifiable) reference to the underlying linear expression.
Definition: apxx_generator0_inline.hh:134
void print(char **name_of_dim=NULL, FILE *stream=stdout) const
Prints to a C stream.
Definition: apxx_generator0_inline.hh:172
ap_generator0_t l
Structure managed by APRON.
Definition: apxx_generator0.hh:43
size_t size() const
Returns the size of the underlying linear expression.
Definition: apxx_generator0_inline.hh:110
void add_dimensions(const dimchange &d)
Changes the dimension of the underlying linear expression.
Definition: apxx_generator0_inline.hh:92
~generator0()
Frees the generator, including the embedded linear expression.
Definition: apxx_generator0_inline.hh:64
Array of generators (ap_generator1_array_t wrapper).
Definition: apxx_generator1.hh:272
Level 0 linear expression (ap_linexpr0_t wrapper).
Definition: apxx_linexpr0.hh:44
Definition: apxx_abstract0.hh:27
Inherited by most wrappers to map new and delete to malloc and free.
Definition: apxx_scalar.hh:69