Skip to content

Commit 17b8de5

Browse files
committed
overload << operator for print differential representations
1 parent 2a312f2 commit 17b8de5

File tree

1 file changed

+77
-1
lines changed
  • include/boost/astronomy/coordinate

1 file changed

+77
-1
lines changed

include/boost/astronomy/coordinate/io.hpp

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <boost/astronomy/coordinate/cartesian_representation.hpp>
1212
#include <boost/astronomy/coordinate/spherical_representation.hpp>
1313
#include <boost/astronomy/coordinate/spherical_equatorial_representation.hpp>
14+
#include <boost/astronomy/coordinate/differential.hpp>
1415

1516
namespace boost { namespace astronomy { namespace coordinate {
1617

@@ -71,5 +72,80 @@ std::ostream& operator<< (std::ostream &out, spherical_representation
7172
return out;
7273
}
7374

75+
//!"<<" operator overload to print details of a Cartesian differential point
76+
template
77+
<
78+
typename CoordinateType,
79+
class XQuantity,
80+
class YQuantity,
81+
class ZQuantity
82+
>
83+
std::ostream& operator<< (std::ostream &out, cartesian_differential
84+
<CoordinateType, XQuantity, YQuantity, ZQuantity> const& point)
85+
{
86+
out << "Cartesian differential ( "
87+
<< point.get_dx() << " , "
88+
<< point.get_dy() << " , "
89+
<< point.get_dz() << " )";
90+
91+
return out;
92+
}
93+
94+
//!"<<" operator overload to print details of a Spherical Equatorial differential Point
95+
template
96+
<
97+
typename CoordinateType,
98+
class LatQuantity,
99+
class LonQuantity,
100+
class DistQuantity
101+
>
102+
std::ostream& operator<< (std::ostream &out, spherical_equatorial_differential
103+
<CoordinateType, LatQuantity, LonQuantity, DistQuantity> const& point)
104+
{
105+
out << "Spherical Equatorial differential ( "
106+
<< point.get_dlat() << " , "
107+
<< point.get_dlon() << " , "
108+
<< point.get_ddist() << " )";
109+
110+
return out;
111+
}
112+
113+
//!"<<" operator overload to print details of a Spherical differential point
114+
template
115+
<
116+
typename CoordinateType,
117+
class LatQuantity,
118+
class LonQuantity,
119+
class DistQuantity
120+
>
121+
std::ostream& operator<< (std::ostream &out, spherical_differential
122+
<CoordinateType, LatQuantity, LonQuantity, DistQuantity> const& point)
123+
{
124+
out << "Spherical differential ( "
125+
<< point.get_dlat() << " , "
126+
<< point.get_dlon() << " , "
127+
<< point.get_ddist() << " )";
128+
129+
return out;
130+
}
131+
132+
//!"<<" operator overload to print details of a spherical_coslat_differential point
133+
template
134+
<
135+
typename CoordinateType,
136+
class LatQuantity,
137+
class LonQuantity,
138+
class DistQuantity
139+
>
140+
std::ostream& operator<< (std::ostream &out, spherical_coslat_differential
141+
<CoordinateType, LatQuantity, LonQuantity, DistQuantity> const& point)
142+
{
143+
out << "Spherical Coslat Differential ( "
144+
<< point.get_dlat() << " , "
145+
<< point.get_dlon_coslat() << " , "
146+
<< point.get_ddist() << " )";
147+
148+
return out;
149+
}
74150
}}} //namespace boost::astronomy::coordinate
75-
#endif // !BOOST_ASTRONOMY_COORDINATE_IO_HPP
151+
#endif // !BOOST_ASTRONOMY_COORDINATE_IO_HPP

0 commit comments

Comments
 (0)