1 /* Expression_Adapter class implementation: inline functions.
2 Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3 Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4
5 This file is part of the Parma Polyhedra Library (PPL).
6
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23
24 #ifndef PPL_Expression_Adapter_inlines_hh
25 #define PPL_Expression_Adapter_inlines_hh 1
26
27 #include "Variables_Set_defs.hh"
28
29 namespace Parma_Polyhedra_Library {
30
31 template <typename T>
32 inline
Expression_Adapter(const raw_type & expr)33 Expression_Adapter<T>::Expression_Adapter(const raw_type& expr)
34 : raw_(expr) {
35 }
36
37 template <typename T>
38 inline typename Expression_Adapter<T>::inner_type
inner() const39 Expression_Adapter<T>::inner() const {
40 return inner_type(raw_);
41 }
42
43 template <typename T>
44 inline Representation
representation() const45 Expression_Adapter<T>::representation() const {
46 return inner().representation();
47 }
48
49 template <typename T>
50 inline typename Expression_Adapter<T>::const_iterator
begin() const51 Expression_Adapter<T>::begin() const {
52 return inner().begin();
53 }
54
55 template <typename T>
56 inline typename Expression_Adapter<T>::const_iterator
end() const57 Expression_Adapter<T>::end() const {
58 return inner().end();
59 }
60
61 template <typename T>
62 inline typename Expression_Adapter<T>::const_iterator
lower_bound(Variable v) const63 Expression_Adapter<T>::lower_bound(Variable v) const {
64 return inner().lower_bound(v);
65 }
66
67 template <typename T>
68 inline dimension_type
space_dimension() const69 Expression_Adapter<T>::space_dimension() const {
70 return inner().space_dimension();
71 }
72
73 template <typename T>
74 inline Coefficient_traits::const_reference
coefficient(Variable v) const75 Expression_Adapter<T>::coefficient(Variable v) const {
76 return inner().coefficient(v);
77 }
78
79 template <typename T>
80 inline Coefficient_traits::const_reference
inhomogeneous_term() const81 Expression_Adapter<T>::inhomogeneous_term() const {
82 return inner().inhomogeneous_term();
83 }
84
85 template <typename T>
86 inline bool
is_zero() const87 Expression_Adapter<T>::is_zero() const {
88 return inner().is_zero();
89 }
90
91 template <typename T>
92 inline bool
all_homogeneous_terms_are_zero() const93 Expression_Adapter<T>::all_homogeneous_terms_are_zero() const {
94 return inner().all_homogeneous_terms_are_zero();
95 }
96
97 template <typename T>
98 template <typename Expression>
99 inline bool
is_equal_to(const Expression & y) const100 Expression_Adapter<T>::is_equal_to(const Expression& y) const {
101 return inner().is_equal_to(y);
102 }
103
104 template <typename T>
105 inline bool
106 Expression_Adapter<T>
all_zeroes(const Variables_Set & vars) const107 ::all_zeroes(const Variables_Set& vars) const {
108 return inner().all_zeroes(vars);
109 }
110
111 template <typename T>
112 inline Coefficient_traits::const_reference
get(dimension_type i) const113 Expression_Adapter<T>::get(dimension_type i) const {
114 return inner().get(i);
115 }
116
117 template <typename T>
118 inline Coefficient_traits::const_reference
get(Variable v) const119 Expression_Adapter<T>::get(Variable v) const {
120 return inner().get(v);
121 }
122
123 template <typename T>
124 inline bool
all_zeroes(dimension_type start,dimension_type end) const125 Expression_Adapter<T>::all_zeroes(dimension_type start,
126 dimension_type end) const {
127 return inner().all_zeroes(start, end);
128 }
129
130 template <typename T>
131 inline dimension_type
num_zeroes(dimension_type start,dimension_type end) const132 Expression_Adapter<T>::num_zeroes(dimension_type start,
133 dimension_type end) const {
134 return inner().num_zeroes(start, end);
135 }
136
137 template <typename T>
138 inline Coefficient
gcd(dimension_type start,dimension_type end) const139 Expression_Adapter<T>::gcd(dimension_type start,
140 dimension_type end) const {
141 return inner().gcd(start, end);
142 }
143
144 template <typename T>
145 inline dimension_type
last_nonzero() const146 Expression_Adapter<T>::last_nonzero() const {
147 return inner().last_nonzero();
148 }
149
150 template <typename T>
151 inline dimension_type
last_nonzero(dimension_type first,dimension_type last) const152 Expression_Adapter<T>::last_nonzero(dimension_type first,
153 dimension_type last) const {
154 return inner().last_nonzero(first, last);
155 }
156
157 template <typename T>
158 inline dimension_type
first_nonzero(dimension_type first,dimension_type last) const159 Expression_Adapter<T>::first_nonzero(dimension_type first,
160 dimension_type last) const {
161 return inner().first_nonzero(first, last);
162 }
163
164 template <typename T>
165 inline bool
166 Expression_Adapter<T>
all_zeroes_except(const Variables_Set & vars,dimension_type start,dimension_type end) const167 ::all_zeroes_except(const Variables_Set& vars,
168 dimension_type start, dimension_type end) const {
169 return inner().all_zeroes_except(vars, start, end);
170 }
171
172 template <typename T>
173 inline void
174 Expression_Adapter<T>
has_a_free_dimension_helper(std::set<dimension_type> & x) const175 ::has_a_free_dimension_helper(std::set<dimension_type>& x) const {
176 inner().has_a_free_dimension_helper(x);
177 }
178
179 template <typename T>
180 template <typename Expression>
181 inline bool
182 Expression_Adapter<T>
is_equal_to(const Expression & y,dimension_type start,dimension_type end) const183 ::is_equal_to(const Expression& y,
184 dimension_type start, dimension_type end) const {
185 return inner().is_equal_to(y, start, end);
186 }
187
188 template <typename T>
189 template <typename Expression>
190 inline bool
191 Expression_Adapter<T>
is_equal_to(const Expression & y,Coefficient_traits::const_reference c1,Coefficient_traits::const_reference c2,dimension_type start,dimension_type end) const192 ::is_equal_to(const Expression& y,
193 Coefficient_traits::const_reference c1,
194 Coefficient_traits::const_reference c2,
195 dimension_type start, dimension_type end) const {
196 return inner().is_equal_to(y, c1, c2, start, end);
197 }
198
199 template <typename T>
200 inline void
get_row(Dense_Row & r) const201 Expression_Adapter<T>::get_row(Dense_Row& r) const {
202 inner().get_row(r);
203 }
204
205 template <typename T>
206 inline void
get_row(Sparse_Row & r) const207 Expression_Adapter<T>::get_row(Sparse_Row& r) const {
208 inner().get_row(r);
209 }
210
211 template <typename T>
212 template <typename Expression>
213 inline bool
214 Expression_Adapter<T>
have_a_common_variable(const Expression & y,Variable first,Variable last) const215 ::have_a_common_variable(const Expression& y,
216 Variable first, Variable last) const {
217 return inner().have_a_common_variable(y, first, last);
218 }
219
220 template <typename T>
221 inline
222 Expression_Adapter_Transparent<T>
Expression_Adapter_Transparent(const raw_type & expr)223 ::Expression_Adapter_Transparent(const raw_type& expr)
224 : base_type(expr) {
225 }
226
227 } // namespace Parma_Polyhedra_Library
228
229 #endif // !defined(PPL_Expression_Adapter_inlines_hh)
230