p1788 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +8 -0
- data/AUTHORS +6 -0
- data/LICENSE +201 -0
- data/NOTICE +29 -0
- data/README.md +65 -0
- data/ext/libieeep1788_copy/README +3 -0
- data/ext/libieeep1788_copy/p1788/AUTHORS +16 -0
- data/ext/libieeep1788_copy/p1788/LICENSE +202 -0
- data/ext/libieeep1788_copy/p1788/NOTICE +14 -0
- data/ext/libieeep1788_copy/p1788/decoration/decoration.hpp +265 -0
- data/ext/libieeep1788_copy/p1788/exception/exception.hpp +302 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor.hpp +3443 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_bool_func_impl.hpp +608 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_cancel_func_impl.hpp +229 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_class_impl.hpp +526 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_elem_func_impl.hpp +4533 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_io_impl.hpp +1421 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_mul_rev_to_pair_func_impl.hpp +347 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_num_func_impl.hpp +655 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_rec_bool_func_impl.hpp +146 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_rec_overlap_impl.hpp +188 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_rev_func_impl.hpp +1674 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_set_op_impl.hpp +216 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_setup_func_impl.hpp +68 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_util_func_impl.hpp +135 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_validation_func_impl.hpp +93 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval.hpp +1529 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_bool_func_impl.hpp +481 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_cancel_func_impl.hpp +126 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_elem_func_impl.hpp +1581 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_io_impl.hpp +59 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_mul_rev_to_pair_func_impl.hpp +88 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_num_func_impl.hpp +345 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_rec_bool_func_impl.hpp +92 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_rec_overlap_impl.hpp +72 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_rev_func_impl.hpp +656 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_set_op_impl.hpp +126 -0
- data/ext/libieeep1788_copy/p1788/infsup/decorated_interval.hpp +464 -0
- data/ext/libieeep1788_copy/p1788/infsup/forward_declaration.hpp +66 -0
- data/ext/libieeep1788_copy/p1788/infsup/interval.hpp +275 -0
- data/ext/libieeep1788_copy/p1788/io/io_manip.hpp +531 -0
- data/ext/libieeep1788_copy/p1788/overlapping/overlapping.hpp +241 -0
- data/ext/libieeep1788_copy/p1788/p1788.hpp +45 -0
- data/ext/libieeep1788_copy/p1788/reduction/reduction.hpp +341 -0
- data/ext/libieeep1788_copy/p1788/util/io.hpp +63 -0
- data/ext/libieeep1788_copy/p1788/util/mixed_type_traits.hpp +140 -0
- data/ext/libieeep1788_copy/p1788/util/mpfr_util.hpp +77 -0
- data/ext/libieeep1788_copy/p1788/util/mpfr_var.hpp +119 -0
- data/ext/libieeep1788_copy/p1788/util/mpfr_var_impl.hpp +382 -0
- data/ext/libieeep1788_copy/p1788/version.hpp +34 -0
- data/ext/p1788/extconf.rb +49 -0
- data/ext/p1788/p1788.cc +3764 -0
- data/lib/p1788/version.rb +4 -0
- data/lib/p1788.rb +25 -0
- data/p1788.gemspec +72 -0
- metadata +99 -0
@@ -0,0 +1,531 @@
|
|
1
|
+
//
|
2
|
+
// libieeep1788
|
3
|
+
//
|
4
|
+
// An implementation of the preliminary IEEE P1788 standard for
|
5
|
+
// interval arithmetic
|
6
|
+
//
|
7
|
+
//
|
8
|
+
// Copyright 2013 - 2015
|
9
|
+
//
|
10
|
+
// Marco Nehmeier (nehmeier@informatik.uni-wuerzburg.de)
|
11
|
+
// Department of Computer Science,
|
12
|
+
// University of Wuerzburg, Germany
|
13
|
+
//
|
14
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
15
|
+
// you may not use this file except in compliance with the License.
|
16
|
+
// You may obtain a copy of the License at
|
17
|
+
//
|
18
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
//
|
20
|
+
// Unless required by applicable law or agreed to in writing, software
|
21
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
22
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
23
|
+
// See the License for the specific language governing permissions and
|
24
|
+
// limitations under the License.
|
25
|
+
|
26
|
+
#ifndef LIBIEEEP1788_P1788_IO_IO_MANIP_HPP
|
27
|
+
#define LIBIEEEP1788_P1788_IO_IO_MANIP_HPP
|
28
|
+
|
29
|
+
#include <iostream>
|
30
|
+
|
31
|
+
namespace p1788
|
32
|
+
{
|
33
|
+
|
34
|
+
namespace io
|
35
|
+
{
|
36
|
+
|
37
|
+
// Unique ID for a manipulator to choose between lower and upper case
|
38
|
+
int const text_representation_manip_id = std::ios_base::xalloc();
|
39
|
+
|
40
|
+
enum text_representation_flags
|
41
|
+
{
|
42
|
+
lower_case_text_representation,
|
43
|
+
upper_case_text_representation
|
44
|
+
};
|
45
|
+
|
46
|
+
///@name Output manipulators to choose between lower and upper case text representation.
|
47
|
+
///
|
48
|
+
/// Default manipulator is \link lower_case(std::basic_ostream<CharT, Traits>& os) lower_case \endlink .
|
49
|
+
///
|
50
|
+
///@{
|
51
|
+
|
52
|
+
/// \brief Output manipulator to print the text representation in lower case.
|
53
|
+
/// \param os Output stream which should be manipulated
|
54
|
+
/// \return Output stream \p os to support operator chaining
|
55
|
+
///
|
56
|
+
template<typename CharT, typename Traits>
|
57
|
+
std::basic_ostream<CharT, Traits>& lower_case(std::basic_ostream<CharT, Traits>& os)
|
58
|
+
{
|
59
|
+
os.iword(text_representation_manip_id) = lower_case_text_representation;
|
60
|
+
return os;
|
61
|
+
}
|
62
|
+
|
63
|
+
/// \brief Output manipulator to print the first character of a text representation in upper case.
|
64
|
+
/// \param os Output stream which should be manipulated
|
65
|
+
/// \return Output stream \p os to support operator chaining
|
66
|
+
///
|
67
|
+
template<typename CharT, typename Traits>
|
68
|
+
std::basic_ostream<CharT, Traits>& upper_case(std::basic_ostream<CharT, Traits>& os)
|
69
|
+
{
|
70
|
+
os.iword(text_representation_manip_id) = upper_case_text_representation;
|
71
|
+
return os;
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
///@}
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
// Unique ID for a manipulator to choose the preferred string width of an interval or decorated interval
|
80
|
+
int const string_width_manip_id = std::ios_base::xalloc();
|
81
|
+
|
82
|
+
///@name Output manipulators to choose the preferred width of the whole interval or decorated interval string.
|
83
|
+
///
|
84
|
+
/// Default manipulator is \link string_width(0) \endlink .
|
85
|
+
///
|
86
|
+
///@{
|
87
|
+
|
88
|
+
/// \brief Class used as an output manipulator to set the preferred string width of an interval.
|
89
|
+
struct string_width
|
90
|
+
{
|
91
|
+
unsigned int width_;
|
92
|
+
|
93
|
+
string_width(unsigned int width) : width_(width) {}
|
94
|
+
};
|
95
|
+
|
96
|
+
template<typename CharT, typename Traits>
|
97
|
+
std::basic_ostream<CharT, Traits>& operator<< (std::basic_ostream<CharT, Traits>& os, string_width const& w)
|
98
|
+
{
|
99
|
+
os.iword(string_width_manip_id) = w.width_;
|
100
|
+
return os;
|
101
|
+
}
|
102
|
+
|
103
|
+
///@}
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
// Unique ID for a manipulator to choose between inf sup and uncertain representation
|
108
|
+
int const representation_manip_id = std::ios_base::xalloc();
|
109
|
+
|
110
|
+
enum representation_flags
|
111
|
+
{
|
112
|
+
inf_sup_representation,
|
113
|
+
uncertain_representation,
|
114
|
+
uncertain_up_representation,
|
115
|
+
uncertain_down_representation
|
116
|
+
};
|
117
|
+
|
118
|
+
///@name Output manipulators to choose between inf sup and uncertain representation.
|
119
|
+
///
|
120
|
+
/// Default manipulator is \link inf_sup_form(std::basic_ostream<CharT, Traits>& os) inf_sup_form \endlink .
|
121
|
+
///
|
122
|
+
///@{
|
123
|
+
|
124
|
+
/// \brief Output manipulator to print intervals in inf sup form.
|
125
|
+
/// \param os Output stream which should be manipulated
|
126
|
+
/// \return Output stream \p os to support operator chaining
|
127
|
+
///
|
128
|
+
template<typename CharT, typename Traits>
|
129
|
+
std::basic_ostream<CharT, Traits>& inf_sup_form(std::basic_ostream<CharT, Traits>& os)
|
130
|
+
{
|
131
|
+
os.iword(representation_manip_id) = inf_sup_representation;
|
132
|
+
return os;
|
133
|
+
}
|
134
|
+
|
135
|
+
/// \brief Output manipulator to print intervals in uncertain form.
|
136
|
+
/// \param os Output stream which should be manipulated
|
137
|
+
/// \return Output stream \p os to support operator chaining
|
138
|
+
///
|
139
|
+
template<typename CharT, typename Traits>
|
140
|
+
std::basic_ostream<CharT, Traits>& uncertain_form(std::basic_ostream<CharT, Traits>& os)
|
141
|
+
{
|
142
|
+
os.iword(representation_manip_id) = uncertain_representation;
|
143
|
+
return os;
|
144
|
+
}
|
145
|
+
|
146
|
+
/// \brief Output manipulator to print intervals in uncertain upward form.
|
147
|
+
/// \param os Output stream which should be manipulated
|
148
|
+
/// \return Output stream \p os to support operator chaining
|
149
|
+
///
|
150
|
+
template<typename CharT, typename Traits>
|
151
|
+
std::basic_ostream<CharT, Traits>& uncertain_up_form(std::basic_ostream<CharT, Traits>& os)
|
152
|
+
{
|
153
|
+
os.iword(representation_manip_id) = uncertain_up_representation;
|
154
|
+
return os;
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
/// \brief Output manipulator to print intervals in uncertain downward form.
|
159
|
+
/// \param os Output stream which should be manipulated
|
160
|
+
/// \return Output stream \p os to support operator chaining
|
161
|
+
///
|
162
|
+
template<typename CharT, typename Traits>
|
163
|
+
std::basic_ostream<CharT, Traits>& uncertain_down_form(std::basic_ostream<CharT, Traits>& os)
|
164
|
+
{
|
165
|
+
os.iword(representation_manip_id) = uncertain_down_representation;
|
166
|
+
return os;
|
167
|
+
}
|
168
|
+
///@}
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
// Unique ID for a manipulator to choose between decimal, scientifc or hex representation
|
173
|
+
int const number_representation_manip_id = std::ios_base::xalloc();
|
174
|
+
|
175
|
+
enum number_representation_flags
|
176
|
+
{
|
177
|
+
decimal_scientific_representation,
|
178
|
+
decimal_representation,
|
179
|
+
scientific_representation,
|
180
|
+
hex_representation
|
181
|
+
};
|
182
|
+
|
183
|
+
///@name Output manipulators to choose between decimal, scientifc or hex representation.
|
184
|
+
///
|
185
|
+
/// Default manipulator is \link decimal_scientific(std::basic_ostream<CharT, Traits>& os) decimal_scientific \endlink .
|
186
|
+
///
|
187
|
+
///@{
|
188
|
+
|
189
|
+
/// \brief Output manipulator to print numbers in decimal or scientific form.
|
190
|
+
/// \param os Output stream which should be manipulated
|
191
|
+
/// \return Output stream \p os to support operator chaining
|
192
|
+
/// \note This equals the "%g" or "%G" format option of the common <c>printf</c> function.
|
193
|
+
template<typename CharT, typename Traits>
|
194
|
+
std::basic_ostream<CharT, Traits>& decimal_scientific(std::basic_ostream<CharT, Traits>& os)
|
195
|
+
{
|
196
|
+
os.iword(number_representation_manip_id) = decimal_scientific_representation;
|
197
|
+
return os;
|
198
|
+
}
|
199
|
+
|
200
|
+
/// \brief Output manipulator to print numbers in decimal form.
|
201
|
+
/// \param os Output stream which should be manipulated
|
202
|
+
/// \return Output stream \p os to support operator chaining
|
203
|
+
/// \note This equals the "%f" or "%F" format option of the common <c>printf</c> function.
|
204
|
+
template<typename CharT, typename Traits>
|
205
|
+
std::basic_ostream<CharT, Traits>& decimal(std::basic_ostream<CharT, Traits>& os)
|
206
|
+
{
|
207
|
+
os.iword(number_representation_manip_id) = decimal_representation;
|
208
|
+
return os;
|
209
|
+
}
|
210
|
+
|
211
|
+
/// \brief Output manipulator to print numbers in scientific form.
|
212
|
+
/// \param os Output stream which should be manipulated
|
213
|
+
/// \return Output stream \p os to support operator chaining
|
214
|
+
/// \note This equals the "%e" or "%E" format option of the common <c>printf</c> function.
|
215
|
+
template<typename CharT, typename Traits>
|
216
|
+
std::basic_ostream<CharT, Traits>& scientific(std::basic_ostream<CharT, Traits>& os)
|
217
|
+
{
|
218
|
+
os.iword(number_representation_manip_id) = scientific_representation;
|
219
|
+
return os;
|
220
|
+
}
|
221
|
+
|
222
|
+
/// \brief Output manipulator to print numbers in hex form.
|
223
|
+
/// \param os Output stream which should be manipulated
|
224
|
+
/// \return Output stream \p os to support operator chaining
|
225
|
+
/// \note This equals the "%a" or "%A" format option of the common <c>printf</c> function.
|
226
|
+
template<typename CharT, typename Traits>
|
227
|
+
std::basic_ostream<CharT, Traits>& hex(std::basic_ostream<CharT, Traits>& os)
|
228
|
+
{
|
229
|
+
os.iword(number_representation_manip_id) = hex_representation;
|
230
|
+
return os;
|
231
|
+
}
|
232
|
+
|
233
|
+
///@}
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
// Unique ID for a manipulator to choose the preferred width of a number
|
238
|
+
int const width_manip_id = std::ios_base::xalloc();
|
239
|
+
|
240
|
+
///@name Output manipulators to choose the preferred width of a number.
|
241
|
+
///
|
242
|
+
/// Default manipulator is \link width(0) \endlink .
|
243
|
+
///
|
244
|
+
///@{
|
245
|
+
|
246
|
+
/// \brief Class used as an output manipulator to set the preferred width of a number.
|
247
|
+
/// \note This equals the width format option of the common <c>printf</c> function excepted that
|
248
|
+
/// the value 0 means that no width is specified.
|
249
|
+
struct width
|
250
|
+
{
|
251
|
+
unsigned int width_;
|
252
|
+
|
253
|
+
width(unsigned int width) : width_(width) {}
|
254
|
+
};
|
255
|
+
|
256
|
+
template<typename CharT, typename Traits>
|
257
|
+
std::basic_ostream<CharT, Traits>& operator<< (std::basic_ostream<CharT, Traits>& os, width const& w)
|
258
|
+
{
|
259
|
+
os.iword(width_manip_id) = w.width_;
|
260
|
+
return os;
|
261
|
+
}
|
262
|
+
|
263
|
+
///@}
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
// Unique ID for a manipulator to choose the preferred precision of a number
|
268
|
+
int const precision_manip_id = std::ios_base::xalloc();
|
269
|
+
|
270
|
+
///@name Output manipulators to choose the precision of a number.
|
271
|
+
///
|
272
|
+
/// Default manipulator is \link precision(0) \endlink .
|
273
|
+
///
|
274
|
+
///@{
|
275
|
+
|
276
|
+
/// \brief Class used as an output manipulator to set the precision of a number.
|
277
|
+
/// \note This equals the precision format option of the common C99 <c>printf</c> function excepted that
|
278
|
+
/// the value 0 means that no precision is specified.
|
279
|
+
struct precision
|
280
|
+
{
|
281
|
+
unsigned int precision_;
|
282
|
+
|
283
|
+
precision(unsigned int precision) : precision_(precision) {}
|
284
|
+
};
|
285
|
+
|
286
|
+
template<typename CharT, typename Traits>
|
287
|
+
std::basic_ostream<CharT, Traits>& operator<< (std::basic_ostream<CharT, Traits>& os, precision const& p)
|
288
|
+
{
|
289
|
+
os.iword(precision_manip_id) = p.precision_;
|
290
|
+
return os;
|
291
|
+
}
|
292
|
+
|
293
|
+
///@}
|
294
|
+
|
295
|
+
|
296
|
+
// Unique ID for a manipulator to choose between different text representaions for special intervals
|
297
|
+
int const special_representation_manip_id = std::ios_base::xalloc();
|
298
|
+
|
299
|
+
enum interval_special_representation_flags
|
300
|
+
{
|
301
|
+
text_special_representation,
|
302
|
+
bounds_special_representation,
|
303
|
+
no_bounds_special_representation
|
304
|
+
};
|
305
|
+
|
306
|
+
///@name Output manipulators to choose between different text representaions for special intervals.
|
307
|
+
///
|
308
|
+
/// Default manipulator is \link special_text(std::basic_ostream<CharT, Traits>& os) special_text \endlink .
|
309
|
+
///
|
310
|
+
///@{
|
311
|
+
|
312
|
+
/// \brief Output manipulator to print a textual representation for special intervals.
|
313
|
+
/// \param os Output stream which should be manipulated
|
314
|
+
/// \return Output stream \p os to support operator chaining
|
315
|
+
///
|
316
|
+
template<typename CharT, typename Traits>
|
317
|
+
std::basic_ostream<CharT, Traits>& special_text(std::basic_ostream<CharT, Traits>& os)
|
318
|
+
{
|
319
|
+
os.iword(special_representation_manip_id) = text_special_representation;
|
320
|
+
return os;
|
321
|
+
}
|
322
|
+
|
323
|
+
/// \brief Output manipulator to print the bounds for special intervals.
|
324
|
+
/// \param os Output stream which should be manipulated
|
325
|
+
/// \return Output stream \p os to support operator chaining
|
326
|
+
///
|
327
|
+
template<typename CharT, typename Traits>
|
328
|
+
std::basic_ostream<CharT, Traits>& special_bounds(std::basic_ostream<CharT, Traits>& os)
|
329
|
+
{
|
330
|
+
os.iword(special_representation_manip_id) = bounds_special_representation;
|
331
|
+
return os;
|
332
|
+
}
|
333
|
+
|
334
|
+
/// \brief Output manipulator to print special intervals without bounds.
|
335
|
+
/// \param os Output stream which should be manipulated
|
336
|
+
/// \return Output stream \p os to support operator chaining
|
337
|
+
///
|
338
|
+
template<typename CharT, typename Traits>
|
339
|
+
std::basic_ostream<CharT, Traits>& special_no_bounds(std::basic_ostream<CharT, Traits>& os)
|
340
|
+
{
|
341
|
+
os.iword(special_representation_manip_id) = no_bounds_special_representation;
|
342
|
+
return os;
|
343
|
+
}
|
344
|
+
|
345
|
+
///@}
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
// Unique ID for a manipulator to choose between interval representaions with or without punctuation
|
350
|
+
int const punctuation_manip_id = std::ios_base::xalloc();
|
351
|
+
|
352
|
+
enum interval_punctuation_flags
|
353
|
+
{
|
354
|
+
show_punctuation,
|
355
|
+
show_no_punctuation
|
356
|
+
};
|
357
|
+
|
358
|
+
///@name Output manipulators to choose between interval representaions with or without punctuation.
|
359
|
+
///
|
360
|
+
/// Default manipulator is \link punctuation(std::basic_ostream<CharT, Traits>& os) punctuation \endlink .
|
361
|
+
///
|
362
|
+
///@{
|
363
|
+
|
364
|
+
/// \brief Output manipulator to print a textual representation with punctuation.
|
365
|
+
/// \param os Output stream which should be manipulated
|
366
|
+
/// \return Output stream \p os to support operator chaining
|
367
|
+
///
|
368
|
+
template<typename CharT, typename Traits>
|
369
|
+
std::basic_ostream<CharT, Traits>& punctuation(std::basic_ostream<CharT, Traits>& os)
|
370
|
+
{
|
371
|
+
os.iword(punctuation_manip_id) = show_punctuation;
|
372
|
+
return os;
|
373
|
+
}
|
374
|
+
|
375
|
+
/// \brief Output manipulator to print a textual representation without punctuation.
|
376
|
+
/// \param os Output stream which should be manipulated
|
377
|
+
/// \return Output stream \p os to support operator chaining
|
378
|
+
///
|
379
|
+
template<typename CharT, typename Traits>
|
380
|
+
std::basic_ostream<CharT, Traits>& no_punctuation(std::basic_ostream<CharT, Traits>& os)
|
381
|
+
{
|
382
|
+
os.iword(punctuation_manip_id) = show_no_punctuation;
|
383
|
+
return os;
|
384
|
+
}
|
385
|
+
|
386
|
+
|
387
|
+
///@}
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
// Unique ID for a manipulator to choose if an exponent is shown in uncertain mode
|
392
|
+
int const uncertain_exponent_manip_id = std::ios_base::xalloc();
|
393
|
+
|
394
|
+
enum uncertain_exponent_flags
|
395
|
+
{
|
396
|
+
show_no_uncertain_exponent,
|
397
|
+
show_uncertain_exponent
|
398
|
+
};
|
399
|
+
|
400
|
+
///@name Output manipulators to choose if an exponent is shown in uncertain mode.
|
401
|
+
///
|
402
|
+
/// Default manipulator is \link no_uncertain_exponent(std::basic_ostream<CharT, Traits>& os) no_uncertain_exponent \endlink .
|
403
|
+
///
|
404
|
+
///@{
|
405
|
+
|
406
|
+
/// \brief Output manipulator to print no exponent in uncertain mode.
|
407
|
+
/// \param os Output stream which should be manipulated
|
408
|
+
/// \return Output stream \p os to support operator chaining
|
409
|
+
///
|
410
|
+
template<typename CharT, typename Traits>
|
411
|
+
std::basic_ostream<CharT, Traits>& no_uncertain_exponent(std::basic_ostream<CharT, Traits>& os)
|
412
|
+
{
|
413
|
+
os.iword(uncertain_exponent_manip_id) = show_no_uncertain_exponent;
|
414
|
+
return os;
|
415
|
+
}
|
416
|
+
|
417
|
+
/// \brief Output manipulator to print anexponent in uncertain mode.
|
418
|
+
/// \param os Output stream which should be manipulated
|
419
|
+
/// \return Output stream \p os to support operator chaining
|
420
|
+
///
|
421
|
+
template<typename CharT, typename Traits>
|
422
|
+
std::basic_ostream<CharT, Traits>& uncertain_exponent(std::basic_ostream<CharT, Traits>& os)
|
423
|
+
{
|
424
|
+
os.iword(uncertain_exponent_manip_id) = show_uncertain_exponent;
|
425
|
+
return os;
|
426
|
+
}
|
427
|
+
|
428
|
+
|
429
|
+
///@}
|
430
|
+
|
431
|
+
|
432
|
+
//-----------------------------------------------------------------------------
|
433
|
+
// Decoration specific
|
434
|
+
//-----------------------------------------------------------------------------
|
435
|
+
|
436
|
+
// Unique ID for a manipulator to print decorations
|
437
|
+
int const dec_manip_id = std::ios_base::xalloc();
|
438
|
+
|
439
|
+
// enum for the manipulator to print decorations
|
440
|
+
enum dec_manip_flags
|
441
|
+
{
|
442
|
+
dec_alpha_representation,
|
443
|
+
dec_numeric_representation
|
444
|
+
};
|
445
|
+
|
446
|
+
///@name Decoration specific Output manipulators
|
447
|
+
///
|
448
|
+
/// Default manipulator is \link dec_alpha(std::basic_ostream<CharT, Traits>& os) dec_alpha \endlink .
|
449
|
+
///
|
450
|
+
///@{
|
451
|
+
|
452
|
+
|
453
|
+
/// \brief Output manipulator to use the text representation for decorations.
|
454
|
+
/// \param os Output stream which should be manipulated
|
455
|
+
/// \return Output stream \p os to support operator chaining
|
456
|
+
///
|
457
|
+
template<typename CharT, typename Traits>
|
458
|
+
std::basic_ostream<CharT, Traits>& dec_alpha(std::basic_ostream<CharT, Traits>& os)
|
459
|
+
{
|
460
|
+
os.iword(dec_manip_id) = dec_alpha_representation;
|
461
|
+
return os;
|
462
|
+
}
|
463
|
+
|
464
|
+
/// \brief IO manipulator to use the numeric representation for decorations.
|
465
|
+
/// \param os Output stream which should be manipulated
|
466
|
+
/// \return Output stream \p os to support operator chaining
|
467
|
+
///
|
468
|
+
template<typename CharT, typename Traits>
|
469
|
+
std::basic_ostream<CharT, Traits>& dec_numeric(std::basic_ostream<CharT, Traits>& os)
|
470
|
+
{
|
471
|
+
os.iword(dec_manip_id) = dec_numeric_representation;
|
472
|
+
return os;
|
473
|
+
}
|
474
|
+
|
475
|
+
///@}
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
//-----------------------------------------------------------------------------
|
480
|
+
// Overlapping specific
|
481
|
+
//-----------------------------------------------------------------------------
|
482
|
+
|
483
|
+
// Unique ID for a manipulator to print decorations
|
484
|
+
int const overlapping_manip_id = std::ios_base::xalloc();
|
485
|
+
|
486
|
+
// enum for the manipulator to print decorations
|
487
|
+
enum overlapping_manip_flags
|
488
|
+
{
|
489
|
+
overlapping_alpha_representation,
|
490
|
+
overlapping_numeric_representation
|
491
|
+
};
|
492
|
+
|
493
|
+
///@name Overlapping specific output manipulators
|
494
|
+
///
|
495
|
+
/// Default manipulator is \link overlapping_alpha(std::basic_ostream<CharT, Traits>& os) overlapping_alpha \endlink .
|
496
|
+
///
|
497
|
+
///@{
|
498
|
+
|
499
|
+
|
500
|
+
/// \brief Output manipulator to use the text representation for overlapping states.
|
501
|
+
/// \param os Output stream which should be manipulated
|
502
|
+
/// \return Output stream \p os to support operator chaining
|
503
|
+
///
|
504
|
+
template<typename CharT, typename Traits>
|
505
|
+
std::basic_ostream<CharT, Traits>& overlapping_alpha(std::basic_ostream<CharT, Traits>& os)
|
506
|
+
{
|
507
|
+
os.iword(overlapping_manip_id) = overlapping_alpha_representation;
|
508
|
+
return os;
|
509
|
+
}
|
510
|
+
|
511
|
+
/// \brief IO manipulator to use the numeric representation for overlapping states.
|
512
|
+
/// \param os Output stream which should be manipulated
|
513
|
+
/// \return Output stream \p os to support operator chaining
|
514
|
+
///
|
515
|
+
template<typename CharT, typename Traits>
|
516
|
+
std::basic_ostream<CharT, Traits>& overlapping_numeric(std::basic_ostream<CharT, Traits>& os)
|
517
|
+
{
|
518
|
+
os.iword(overlapping_manip_id) = overlapping_numeric_representation;
|
519
|
+
return os;
|
520
|
+
}
|
521
|
+
|
522
|
+
///@}
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
} // namespace io
|
527
|
+
|
528
|
+
} // namespace p1788
|
529
|
+
|
530
|
+
|
531
|
+
#endif // LIBIEEEP1788_P1788_IO_IO_MANIP_HPP
|