Vaucanson  1.4.1
element_ops.hh
Go to the documentation of this file.
1 // element_ops.hh: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 The Vaucanson Group.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // The complete GNU General Public Licence Notice can be found as the
13 // `COPYING' file in the root directory.
14 //
15 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
16 //
17 #ifndef VCSN_DESIGN_PATTERN_ELEMENT_OPS_HH
18 # define VCSN_DESIGN_PATTERN_ELEMENT_OPS_HH
19 
30 
31 namespace vcsn {
32 
36  /*-------------------.
37  | Ordered comparison |
38  `-------------------*/
39 
41  template<typename S1, typename T1, typename S2, typename T2>
42  static
43  bool operator<(const vcsn::Element<S1, T1>& e1,
44  const vcsn::Element<S2, T2>& e2);
45 
47  template<typename S1, typename T1, typename S2, typename T2>
48  static
49  bool operator>(const vcsn::Element<S1, T1>& e1,
50  const vcsn::Element<S2, T2>& e2);
51 
53  template<typename S1, typename T1, typename S2, typename T2>
54  static
55  bool operator<=(const vcsn::Element<S1, T1>& e1,
56  const vcsn::Element<S2, T2>& e2);
57 
59  template<typename S1, typename T1, typename S2, typename T2>
60  static
61  bool operator>=(const vcsn::Element<S1, T1>& e1,
62  const vcsn::Element<S2, T2>& e2);
63 
65  template<typename S, typename T, typename U>
66  static
67  bool operator <(const vcsn::Element<S, T>& e,
68  const U& v);
69 
71  template<typename S, typename T, typename U>
72  static
73  bool operator >(const vcsn::Element<S, T>& e,
74  const U& v);
75 
77  template<typename S, typename T, typename U>
78  static
79  bool operator >=(const vcsn::Element<S, T>& e,
80  const U& v);
81 
83  template<typename S, typename T, typename U>
84  static
85  bool operator <=(const vcsn::Element<S, T>& e,
86  const U& v);
87 
89  template<typename U, typename S, typename T>
90  static
91  bool operator <(const U& v,
92  const vcsn::Element<S, T>& e);
93 
95  template<typename U, typename S, typename T>
96  static
97  bool operator >(const U& v,
98  const vcsn::Element<S, T>& e);
99 
101  template<typename U, typename S, typename T>
102  static
103  bool operator >=(const U& v,
104  const vcsn::Element<S, T>& e);
105 
107  template<typename U, typename S, typename T>
108  static
109  bool operator <=(const U& v,
110  const vcsn::Element<S, T>& e);
111 
112  /*---------.
113  | Equality |
114  `---------*/
115 
117  template<typename S1, typename T1, typename S2, typename T2>
118  static
119  bool operator ==(const vcsn::Element<S1, T1>& e1,
120  const vcsn::Element<S2, T2>& e2);
121 
123  template<typename S, typename T, typename U>
124  static
125  bool operator ==(const vcsn::Element<S, T>& e,
126  const U& v);
127 
129  template<typename U, typename S, typename T>
130  static
131  bool operator ==(const U& v,
132  const vcsn::Element<S, T>& e);
133 
134  /*-----------.
135  | Difference |
136  `-----------*/
137 
139  template<typename S1, typename T1, typename S2, typename T2>
140  static
141  bool operator !=(const vcsn::Element<S1, T1>& e1,
142  const vcsn::Element<S2, T2>& e2);
143 
145  template<typename S, typename T, typename U>
146  static
147  bool operator !=(const vcsn::Element<S, T>& e,
148  const U& v);
149 
151  template<typename U, typename S, typename T>
152  static
153  bool operator !=(const U& v,
154  const vcsn::Element<S, T>& e);
155 
156  /*---------.
157  | Addition |
158  `---------*/
159 
161  template<typename S1, typename T1, typename S2, typename T2>
162  static
165  const vcsn::Element<S2, T2>& e2);
166 
168  template<typename S, typename T, typename U>
169  static vcsn::Element<S, T>
171  const U& v);
172 
174  template<typename U, typename S, typename T>
175  static vcsn::Element<S, T>
176  operator +(const U& v,
177  const vcsn::Element<S, T>& e);
178 
179  /*-------------.
180  | Substraction |
181  `-------------*/
182 
184  template<typename S1, typename T1, typename S2, typename T2>
185  static
188  const vcsn::Element<S2, T2>& e2);
189 
191  template<typename S, typename T, typename U>
192  static vcsn::Element<S, T>
194  const U& v);
195 
197  template<typename U, typename S, typename T>
198  static vcsn::Element<S, T>
199  operator-(const U& v,
200  const vcsn::Element<S, T>& e);
201 
202  /*---------------.
203  | Multiplication |
204  `---------------*/
205 
207  template<typename S1, typename T1, typename S2, typename T2>
208  static
211  const vcsn::Element<S2, T2>& e2);
212 
214  template<typename S, typename T, typename U>
215  static vcsn::Element<S, T>
217  const U& v);
218 
220  template<typename U, typename S, typename T>
221  static vcsn::Element<S, T>
222  operator*(const U& v,
223  const vcsn::Element<S, T>& e);
224 
225  /*---------.
226  | Division |
227  `---------*/
228 
230  template<typename S1, typename T1, typename S2, typename T2>
231  static
234  const vcsn::Element<S2, T2>& e2);
235 
237  template<typename S, typename T, typename U>
238  static vcsn::Element<S, T>
240  const U& v);
241 
243  template<typename U, typename S, typename T>
244  static vcsn::Element<S, T>
245  operator/(const U& v,
246  const vcsn::Element<S, T>& e);
247 
248  /*--------.
249  | Modulus |
250  `--------*/
251 
253  template<typename S1, typename T1, typename S2, typename T2>
254  static
257  const vcsn::Element<S2, T2>& e2);
258 
260  template<typename S, typename T, typename U>
261  static vcsn::Element<S, T>
263  const U& v);
264 
266  template<typename U, typename S, typename T>
267  static vcsn::Element<S, T>
268  operator%(const U& v,
269  const vcsn::Element<S, T>& e);
270 
271  /*---------------.
272  | Unary negation |
273  `---------------*/
274 
276  template<typename S, typename T>
277  static vcsn::Element<S, T>
279 
280  /*-----------------.
281  | Input and Output |
282  `-----------------*/
283 
285  template<typename St, typename S, typename T>
286  static St&
287  operator <<(St& s, const vcsn::Element<S, T>& e);
288 
290  template<typename St, typename S, typename T>
291  static St&
292  operator >>(St& s, const vcsn::Element<S, T>& e);
293 
294  // This operator does not exist.
295 
296 // template<typename S1, typename T1, typename S2, typename T2>
297 // static void /* do not use or specialize */
298 // operator <<(const vcsn::Element<S1, T1>& e1,
299 // const vcsn::Element<S2, T2>& e2);
300 
301 
305 } // vcsn
306 
307 namespace std {
308 
312  /*-----.
313  | Swap |
314  `-----*/
315 
320  template<typename S, typename T1, typename T2>
321  void swap(vcsn::Element<S, T1>& e1,
323 
325  template<typename S, typename T>
326  void swap(vcsn::Element<S, T>& e1, T& v2);
327 
329  template<typename T, typename S>
330  void swap(T& v1, vcsn::Element<S, T>& e2);
331 
335 } // std
336 
337 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
338 # include <vaucanson/design_pattern/element_ops.hxx>
339 # endif // VCSN_USE_INTERFACE_ONLY
340 
341 #endif // ! VCSN_DESIGN_PATTERN_ELEMENT_OPS_HH