From 483684b8b9d5cc66cfc6ba9badb35730cb91d5cd Mon Sep 17 00:00:00 2001 From: Kimmo Hoikka Date: Tue, 21 Apr 2015 11:38:50 +0100 Subject: [PATCH] Remove unnecessary stream operators from radian and degree as well as unnecessary Degree constructor from AngleAxis Change-Id: Ia9fe5699e21b938786508ba63a9082dcbbc99523 --- .../dali-test-suite-utils.cpp | 27 +++++++++++++++++----- .../dali-test-suite-utils/dali-test-suite-utils.h | 11 ++++++--- .../event/events/pan-gesture-detector-impl.cpp | 2 +- dali/public-api/math/angle-axis.h | 14 +---------- dali/public-api/math/degree.h | 15 ------------ dali/public-api/math/quaternion.cpp | 2 +- dali/public-api/math/radian.h | 15 ------------ 7 files changed, 32 insertions(+), 54 deletions(-) diff --git a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp index ee46961..6503314 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,14 @@ * */ +// CLASS HEADER +#include "dali-test-suite-utils.h" + +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include -#include - -#include "dali-test-suite-utils.h" using namespace Dali; @@ -56,9 +59,21 @@ bool operator==(TimePeriod a, TimePeriod b) return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds) ; } -std::ostream& operator<< (std::ostream& o, const TimePeriod value) +std::ostream& operator<<( std::ostream& ostream, TimePeriod value ) +{ + return ostream << "( Duration:" << value.durationSeconds << " Delay:" << value.delaySeconds << ")"; +} + +std::ostream& operator<<( std::ostream& ostream, Radian angle ) +{ + ostream << angle.radian; + return ostream; +} + +std::ostream& operator<<( std::ostream& ostream, Degree angle ) { - return o << "( Duration:" << value.durationSeconds << " Delay:" << value.delaySeconds << ")"; + ostream << angle.degree; + return ostream; } void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location) diff --git a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h index eecabce..ace09d4 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h +++ b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h @@ -2,7 +2,7 @@ #define __DALI_TEST_SUITE_UTILS_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,12 @@ * */ +// EXTERNAL INCLUDES +#include +#include + // INTERNAL INCLUDES #include -#include void tet_infoline(const char*str); void tet_printf(const char *format, ...); @@ -150,7 +153,9 @@ inline bool CompareType(Degree q1, Degree q2, float epsilon) } bool operator==(TimePeriod a, TimePeriod b); -std::ostream& operator<< (std::ostream& o, const TimePeriod value); +std::ostream& operator<<( std::ostream& ostream, TimePeriod value ); +std::ostream& operator<<( std::ostream& ostream, Radian angle ); +std::ostream& operator<<( std::ostream& ostream, Degree angle ); /** * Test whether two values are equal. diff --git a/dali/internal/event/events/pan-gesture-detector-impl.cpp b/dali/internal/event/events/pan-gesture-detector-impl.cpp index 7c114d2..49028e6 100644 --- a/dali/internal/event/events/pan-gesture-detector-impl.cpp +++ b/dali/internal/event/events/pan-gesture-detector-impl.cpp @@ -243,7 +243,7 @@ bool PanGestureDetector::CheckAngleAllowed( Radian angle ) const DALI_LOG_INFO( gLogFilter, Debug::General, "AngleToCheck: %.2f, CompareWith: %.2f, Threshold: %.2f\n", - Degree(angle.radian), Degree(angleAllowed), Degree(threshold) ); + Degree(angle), Degree(angleAllowed), Degree(threshold) ); float relativeAngle( fabsf( WrapInDomain( angle - angleAllowed, -Math::PI, Math::PI ) ) ); if ( relativeAngle <= threshold ) diff --git a/dali/public-api/math/angle-axis.h b/dali/public-api/math/angle-axis.h index c41ad53..0d7464c 100644 --- a/dali/public-api/math/angle-axis.h +++ b/dali/public-api/math/angle-axis.h @@ -19,7 +19,6 @@ */ // INTERNAL INCLUDES -#include #include #include @@ -47,21 +46,10 @@ struct AngleAxis /** * @brief Create an angle-axis pair. * - * @param[in] initialAngle The initial angle in degrees. - * @param[in] initialAxis The initial axis. - */ - AngleAxis( Degree initialAngle, Vector3 initialAxis ) - : angle( initialAngle ), - axis( initialAxis ) - { } - - /** - * @brief Create an angle-axis pair. - * * @param[in] initialAngle The initial angle in radians. * @param[in] initialAxis The initial axis. */ - AngleAxis( Radian initialAngle, Vector3 initialAxis ) + AngleAxis( Radian initialAngle, const Vector3& initialAxis ) : angle( initialAngle ), axis( initialAxis ) { } diff --git a/dali/public-api/math/degree.h b/dali/public-api/math/degree.h index 5cec5f1..292a01c 100644 --- a/dali/public-api/math/degree.h +++ b/dali/public-api/math/degree.h @@ -18,9 +18,6 @@ * */ -// EXTERNAL INCLUDES -#include - // INTERNAL INCLUDES #include #include @@ -106,18 +103,6 @@ inline Degree Clamp( Degree angle, float min, float max ) return Degree( Clamp( angle.degree, min, max ) ); } -/** - * @brief Stream a degree value - * @param [in] ostream The output stream to use. - * @param [in] angle in Degree. - * @return The output stream. - */ -inline std::ostream& operator<<( std::ostream& ostream, Degree angle ) -{ - ostream << angle.degree; - return ostream; -} - } // namespace Dali #endif // __DALI_DEGREE_H__ diff --git a/dali/public-api/math/quaternion.cpp b/dali/public-api/math/quaternion.cpp index daa8960..01afc00 100644 --- a/dali/public-api/math/quaternion.cpp +++ b/dali/public-api/math/quaternion.cpp @@ -543,7 +543,7 @@ std::ostream& operator<<( std::ostream& o, const Quaternion& quaternion ) Radian angleRadians; quaternion.ToAxisAngle( axis, angleRadians ); - Degree degrees = Radian( angleRadians ); + Degree degrees( angleRadians ); return o << "[ Axis: [" << axis.x << ", " << axis.y << ", " << axis.z << "], Angle: " << degrees.degree << " degrees ]"; } diff --git a/dali/public-api/math/radian.h b/dali/public-api/math/radian.h index 586ca2d..6657851 100644 --- a/dali/public-api/math/radian.h +++ b/dali/public-api/math/radian.h @@ -18,9 +18,6 @@ * */ -// EXTERNAL INCLUDES -#include - // INTERNAL INCLUDES #include #include @@ -294,18 +291,6 @@ inline Radian Clamp( Radian angle, float min, float max ) return Radian( Clamp( angle.radian, min, max ) ); } -/** - * @brief Stream a radian value - * @param [in] ostream The output stream to use. - * @param [in] angle in Radian. - * @return The output stream. - */ -inline std::ostream& operator<<( std::ostream& ostream, Radian angle ) -{ - ostream << angle.radian; - return ostream; -} - } // namespace Dali #endif // __DALI_RADIAN_H__ -- 2.7.4