Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overload << operator to print differential representations #129

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 77 additions & 1 deletion include/boost/astronomy/coordinate/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <boost/astronomy/coordinate/cartesian_representation.hpp>
#include <boost/astronomy/coordinate/spherical_representation.hpp>
#include <boost/astronomy/coordinate/spherical_equatorial_representation.hpp>
#include <boost/astronomy/coordinate/differential.hpp>

namespace boost { namespace astronomy { namespace coordinate {

Expand Down Expand Up @@ -71,5 +72,80 @@ std::ostream& operator<< (std::ostream &out, spherical_representation
return out;
}

//!"<<" operator overload to print details of a Cartesian differential point
template
<
typename CoordinateType,
class XQuantity,
class YQuantity,
class ZQuantity
>
std::ostream& operator<< (std::ostream &out, cartesian_differential
<CoordinateType, XQuantity, YQuantity, ZQuantity> const& point)
{
out << "Cartesian differential ( "
<< point.get_dx() << " , "
<< point.get_dy() << " , "
<< point.get_dz() << " )";

return out;
}

//!"<<" operator overload to print details of a Spherical Equatorial differential Point
template
<
typename CoordinateType,
class LatQuantity,
class LonQuantity,
class DistQuantity
>
std::ostream& operator<< (std::ostream &out, spherical_equatorial_differential
<CoordinateType, LatQuantity, LonQuantity, DistQuantity> const& point)
{
out << "Spherical Equatorial differential ( "
<< point.get_dlat() << " , "
<< point.get_dlon() << " , "
<< point.get_ddist() << " )";

return out;
}

//!"<<" operator overload to print details of a Spherical differential point
template
<
typename CoordinateType,
class LatQuantity,
class LonQuantity,
class DistQuantity
>
std::ostream& operator<< (std::ostream &out, spherical_differential
<CoordinateType, LatQuantity, LonQuantity, DistQuantity> const& point)
{
out << "Spherical differential ( "
<< point.get_dlat() << " , "
<< point.get_dlon() << " , "
<< point.get_ddist() << " )";

return out;
}

//!"<<" operator overload to print details of a spherical_coslat_differential point
template
<
typename CoordinateType,
class LatQuantity,
class LonQuantity,
class DistQuantity
>
std::ostream& operator<< (std::ostream &out, spherical_coslat_differential
<CoordinateType, LatQuantity, LonQuantity, DistQuantity> const& point)
{
out << "Spherical Coslat Differential ( "
<< point.get_dlat() << " , "
<< point.get_dlon_coslat() << " , "
<< point.get_ddist() << " )";

return out;
}
}}} //namespace boost::astronomy::coordinate
#endif // !BOOST_ASTRONOMY_COORDINATE_IO_HPP
#endif // !BOOST_ASTRONOMY_COORDINATE_IO_HPP