-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add friends function Angle definition patch
- Loading branch information
Juan Oxoby
committed
Oct 19, 2020
1 parent
3b11e57
commit 4e68918
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
recipes/ignition-math/all/patches/0001-Define-friend-Angle-functions-in-.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
From 8e3d2298024b74d5e0820190b65587d43a6bef03 Mon Sep 17 00:00:00 2001 | ||
From: Juan Oxoby <juan@vicarious.com> | ||
Date: Mon, 19 Oct 2020 11:10:08 -0700 | ||
Subject: [PATCH] Define friend Angle functions in .cc | ||
|
||
Signed-off-by: Juan Oxoby <juan@vicarious.com> | ||
--- | ||
include/ignition/math/Angle.hh | 14 ++------------ | ||
src/Angle.cc | 16 ++++++++++++++++ | ||
2 files changed, 18 insertions(+), 12 deletions(-) | ||
|
||
diff --git a/include/ignition/math/Angle.hh b/include/ignition/math/Angle.hh | ||
index b3d4345..3fe6920 100644 | ||
--- a/include/ignition/math/Angle.hh | ||
+++ b/include/ignition/math/Angle.hh | ||
@@ -222,24 +222,14 @@ namespace ignition | ||
/// \param[in] _a Angle to output. | ||
/// \return The output stream. | ||
public: friend std::ostream &operator<<(std::ostream &_out, | ||
- const ignition::math::Angle &_a) | ||
- { | ||
- _out << _a.Radian(); | ||
- return _out; | ||
- } | ||
+ const ignition::math::Angle &_a); | ||
|
||
/// \brief Stream extraction operator. Assumes input is in radians. | ||
/// \param[in,out] _in Input stream. | ||
/// \param[out] _a Angle to read value into. | ||
/// \return The input stream. | ||
public: friend std::istream &operator>>(std::istream &_in, | ||
- ignition::math::Angle &_a) | ||
- { | ||
- // Skip white spaces | ||
- _in.setf(std::ios_base::skipws); | ||
- _in >> _a.value; | ||
- return _in; | ||
- } | ||
+ ignition::math::Angle &_a); | ||
|
||
/// The angle in radians | ||
private: double value{0}; | ||
diff --git a/src/Angle.cc b/src/Angle.cc | ||
index c62dda9..03bb8a3 100644 | ||
--- a/src/Angle.cc | ||
+++ b/src/Angle.cc | ||
@@ -188,3 +188,19 @@ double Angle::operator()() const | ||
{ | ||
return this->value; | ||
} | ||
+ | ||
+////////////////////////////////////////////////// | ||
+std::ostream &ignition::math::operator<<(std::ostream &_out, const Angle &_a) | ||
+{ | ||
+ _out << _a.Radian(); | ||
+ return _out; | ||
+} | ||
+ | ||
+////////////////////////////////////////////////// | ||
+std::istream &ignition::math::operator>>(std::istream &_in, Angle &_a) | ||
+{ | ||
+ // Skip white spaces | ||
+ _in.setf(std::ios_base::skipws); | ||
+ _in >> _a.value; | ||
+ return _in; | ||
+} | ||
-- | ||
2.17.1 | ||
|