APRONXX 0.9.15
/home/mine/apron/apronxx/apxx_var.hh
Go to the documentation of this file.
1/* -*- C++ -*-
2 * apxx_var.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_VAR_HH
17#define __APXX_VAR_HH
18
19#include "ap_var.h"
20
21
22namespace apron {
23
24
25/* ================================= */
26/* var */
27/* ================================= */
29
32
33 * Variable names replace dimensions in all level 1 operations.
34 * Variable names can be copied, freed, compared, and converted to string.
35 * The actual implementation of these operators is defined using the global pointer ap_var_operations.
36 * By default, ap_var_operations implements dynamically allocated C-style
37 * NULL-terminated strings.
38 */
39class var {
40
41protected:
42 ap_var_t v;
43
44public:
45
46 /* constructors */
47 /* ============ */
48
51
53 var(const void* x);
54
56 var(const std::string& x);
57
59 var(const var& x);
60
62
63
64 /* destructor */
65 /* ========== */
69
71 ~var();
72
73 //@}
74
75
76 /* assignments */
77 /* =========== */
78
79
81
83 var& operator=(const var& x);
86 var& operator=(const std::string& x);
87
88
89 var& operator=(const void* x);
90
92
93
94 /* conversions */
95 /* =========== */
96
99
102 * The C string should be freed with malloc by the caller.
103 */
104 operator char*() const;
105
106 //! \brief Converts to a C++ string (calls ap_var_operations->to_string).
107 operator std::string() const;
108
110
112 /* comparisons */
113 /* =========== */
114
115
116 //@{
117
119 friend int compare(const var& x, const var& y);
120
121 //! \brief Compares two variables names (calls ap_var_operations->to_compare).
122 friend bool operator==(const var& x, const var& y);
123
125 friend bool operator!=(const var& x, const var& y);
128 friend bool operator>=(const var& x, const var& y);
129
130
131 friend bool operator<=(const var& x, const var& y);
132
134 friend bool operator>(const var& x, const var& y);
135
137 friend bool operator<(const var& x, const var& y);
138
139 //@}
140
141
142 /* print */
143 /* ===== */
144
145 /** @name Printing */
147
149 friend std::ostream& operator<< (std::ostream& os, const var& s);
150
151
152 void print(FILE* stream=stdout) const;
153
155
156
157 /* C-level compatibility */
158 /* ===================== */
159
161
164 const ap_var_t& get_ap_var_t() const;
165
166
167 ap_var_t& get_ap_var_t();
168
170
171};
172
173#include "apxx_var_inline.hh"
174
175}
176
177
178#endif /* __APXX_VAR_HH */
friend bool operator>(const var &x, const var &y)
Compares two variable names (calls ap_var_operations->to_compare).
Definition apxx_var.hh:126
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition apxx_var.hh:145
friend bool operator>=(const var &x, const var &y)
Compares two variable names (calls ap_var_operations->to_compare).
Definition apxx_var.hh:116
var & operator=(const var &x)
Assigns the variable name (calls ap_var_operations->copy, ->free).
Definition apxx_var.hh:56
const ap_var_t & get_ap_var_t() const
Returns a reference to the APRON object wrapped (no copy).
Definition apxx_var.hh:157
friend bool operator==(const var &x, const var &y)
Compares two variables names (calls ap_var_operations->to_compare).
Definition apxx_var.hh:106
ap_var_t v
Definition apxx_var.hh:42
friend bool operator<(const var &x, const var &y)
Compares two variable names (calls ap_var_operations->to_compare).
Definition apxx_var.hh:131
~var()
Frees the variable name (calls ap_var_operations->free).
Definition apxx_var.hh:47
friend bool operator<=(const var &x, const var &y)
Compares two variable names (calls ap_var_operations->to_compare).
Definition apxx_var.hh:121
ap_var_t & get_ap_var_t()
Returns a (modifiable) reference to the APRON object wrapped (no copy).
Definition apxx_var.hh:162
var(const void *x)
Makes a variable name from a pointer (copied with ap_var_operations->copy).
Definition apxx_var.hh:28
friend std::ostream & operator<<(std::ostream &os, const var &s)
Printing.
Definition apxx_var.hh:139
friend int compare(const var &x, const var &y)
Compares two variable names (calls ap_var_operations->to_compare).
Definition apxx_var.hh:101
friend bool operator!=(const var &x, const var &y)
Compares two variable names (calls ap_var_operations->to_compare).
Definition apxx_var.hh:111
Definition apxx_abstract0.hh:27