16 #ifndef INCLUDED_numeric_xyzMatrix_io_hh
17 #define INCLUDED_numeric_xyzMatrix_io_hh
34 template<
typename T >
36 operator <<( std::ostream & stream, xyzMatrix< T >
const & m )
43 std::ios_base::fmtflags
const old_flags = stream.flags();
44 int const old_precision = stream.precision( Traits::precision() );
48 int const w = Traits::width();
50 << setw( w ) << m.xx() <<
' ' << setw( w ) << m.xy() <<
' ' << setw( w ) << m.xz() <<
'\n'
51 << setw( w ) << m.yx() <<
' ' << setw( w ) << m.yy() <<
' ' << setw( w ) << m.yz() <<
'\n'
52 << setw( w ) << m.zx() <<
' ' << setw( w ) << m.zy() <<
' ' << setw( w ) << m.zz() <<
'\n';
55 stream.precision( old_precision );
56 stream.flags( old_flags );
68 template<
typename T >
73 bool brackets =
false;
76 std::string input_string;
77 stream >> input_string;
78 if ( input_string ==
"(" ) {
79 stream >> input_string;
81 }
else if ( input_string[ 0 ] ==
'(' ) {
82 input_string.erase( 0, 1 );
84 }
else if ( input_string ==
"[" ) {
85 stream >> input_string;
87 }
else if ( input_string[ 0 ] ==
'[' ) {
88 input_string.erase( 0, 1 );
91 std::string::size_type
const input_size = input_string.size();
92 if ( ( input_size > 0 ) && ( input_string[ input_size - 1 ] ==
',' ) ) {
93 input_string.erase( input_size - 1 );
95 std::istringstream num_stream( input_string );
100 std::string input_string;
101 stream >> input_string;
102 if ( input_string ==
"," ) {
103 stream >> input_string;
104 }
else if ( input_string[ 0 ] ==
',' ) {
105 input_string.erase( 0, 1 );
107 std::string::size_type
const input_size = input_string.size();
108 if ( ( input_size > 0 ) && ( input_string[ input_size - 1 ] ==
',' ) ) {
109 input_string.erase( input_size - 1 );
111 std::istringstream num_stream( input_string );
116 std::string input_string;
117 stream >> input_string;
118 if ( input_string ==
"," ) {
119 stream >> input_string;
120 }
else if ( input_string[ 0 ] ==
',' ) {
121 input_string.erase( 0, 1 );
123 std::string::size_type input_size = input_string.size();
124 if ( parens || brackets ) {
125 if ( input_size > 0 ) {
127 if ( input_string[ input_size - 1 ] ==
')' ) {
128 input_string.erase( input_size - 1 );
131 }
else if ( brackets ) {
132 if ( input_string[ input_size - 1 ] ==
']' ) {
133 input_string.erase( input_size - 1 );
139 if ( ( input_size > 0 ) && ( input_string[ input_size - 1 ] ==
',' ) ) {
140 input_string.erase( input_size - 1 );
142 std::istringstream num_stream( input_string );
147 if ( parens || brackets ) {
148 while ( ( stream.peek() ==
' ' ) || ( stream.peek() ==
'\t' ) ) {
152 if ( stream.peek() ==
')' ) stream.ignore();
153 }
else if ( brackets ) {
154 if ( stream.peek() ==
']' ) stream.ignore();
163 template<
typename T >
176 #endif // INCLUDED_numeric_xyzMatrix_io_HH
Value const & zz() const
Value zz const.
std::istream & operator>>(std::istream &stream, BodyPosition< T > &p)
stream >> BodyPosition input operator
cmplx w(cmplx z, double relerr)
Value const & yx() const
Value yx const.
Value const & xx() const
Value xx const.
Value const & yz() const
Value yz const.
Value const & yy() const
Value yy const.
Numerics input/output type traits.
Numerics input/output type traits.
Value const & zx() const
Value zx const.
std::istream & read_row(std::istream &stream, T &x, T &y, T &z, T &t)
Read an BodyPosition row from a stream.
Value const & zy() const
Value zy const.
NumericTraits< Type > Traits
Value const & xz() const
Value xz const.
Value const & xy() const
Value xy const.
char & uppercase(char &c)
Uppercase a Character.