27 #ifndef CDPL_MATH_IO_HPP
28 #define CDPL_MATH_IO_HPP
49 template <
typename C,
typename T,
typename E>
52 typename std::basic_ostream<C, T>::sentry se(os);
53 std::ios_base::iostate state(std::ios_base::goodbit);
57 std::basic_ostringstream<C, T, std::allocator<C> > oss;
59 oss.flags(os.flags());
60 oss.imbue(os.getloc());
61 oss.precision(os.precision());
63 typedef typename E::SizeType SizeType;
65 SizeType size = e().getSize();
67 oss <<
'[' << size <<
"](";
72 for (SizeType i = 1; i < size; i++)
78 state |= std::ios_base::failbit;
80 os << oss.str().c_str();
83 os.setstate(std::ios_base::failbit);
88 if (state != std::ios_base::goodbit)
94 template <
typename C,
typename T,
typename E>
97 typename std::basic_ostream<C, T>::sentry se(os);
98 std::ios_base::iostate state(std::ios_base::goodbit);
102 std::basic_ostringstream<C, T, std::allocator<C> > oss;
104 oss.flags(os.flags());
105 oss.imbue(os.getloc());
106 oss.precision(os.precision());
108 typedef typename E::SizeType SizeType;
110 SizeType size1 = e().getSize1();
111 SizeType size2 = e().getSize2();
113 oss <<
'[' << size1 <<
',' << size2 <<
"](";
115 if (size1 > 0 && size2 > 0) {
116 for (SizeType i = 0; i < size1; i++) {
122 for (SizeType j = 0; j < size2; j++) {
136 state |= std::ios_base::failbit;
138 os << oss.str().c_str();
141 os.setstate(std::ios_base::failbit);
146 if (state != std::ios_base::goodbit)
152 template <
typename C,
typename T,
typename E>
155 typename std::basic_ostream<C, T>::sentry se(os);
156 std::ios_base::iostate state(std::ios_base::goodbit);
160 std::basic_ostringstream<C, T, std::allocator<C> > oss;
162 oss.flags(os.flags());
163 oss.imbue(os.getloc());
164 oss.precision(os.precision());
166 oss <<
'(' << e().getC1() <<
',' << e().getC2() <<
',' << e().getC3() <<
',' << e().getC4() <<
')';
169 state |= std::ios_base::failbit;
171 os << oss.str().c_str();
174 os.setstate(std::ios_base::failbit);
179 if (state != std::ios_base::goodbit)
185 template <
typename C,
typename T,
typename E>
188 typename std::basic_ostream<C, T>::sentry se(os);
189 std::ios_base::iostate state(std::ios_base::goodbit);
193 std::basic_ostringstream<C, T, std::allocator<C> > oss;
195 oss.flags(os.flags());
196 oss.imbue(os.getloc());
197 oss.precision(os.precision());
199 typedef typename E::SizeType SizeType;
201 SizeType size1 = e().getSize1();
202 SizeType size2 = e().getSize2();
203 SizeType size3 = e().getSize3();
205 oss <<
'[' << size1 <<
',' << size2 <<
',' << size3 <<
"](";
207 if (size1 > 0 && size2 > 0 && size3 > 0) {
208 for (SizeType i = 0; i < size1; i++) {
214 for (SizeType j = 0; j < size2; j++) {
220 for (SizeType k = 0; k < size3; k++) {
237 state |= std::ios_base::failbit;
239 os << oss.str().c_str();
242 os.setstate(std::ios_base::failbit);
247 if (state != std::ios_base::goodbit)
Definition: Expression.hpp:120
Definition: Expression.hpp:76
Definition: Expression.hpp:98
Definition: Expression.hpp:54
std::basic_ostream< C, T > & operator<<(std::basic_ostream< C, T > &os, const VectorExpression< E > &e)
Definition: IO.hpp:50
The namespace of the Chemical Data Processing Library.