From 5ca096512e5ca590485336ea9b2734cc62c848a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 14 Jan 2013 02:18:10 +0100 Subject: [PATCH] Forward declaration header for Math namespace. --- doc/compilation-speedup.dox | 1 + src/AbstractShaderProgram.h | 6 ----- src/DimensionTraits.h | 12 --------- src/Magnum.h | 18 +++---------- src/Math/CMakeLists.txt | 1 + src/Math/Math.h | 50 +++++++++++++++++++++++++++++++++++++ src/TypeTraits.h | 6 ----- 7 files changed, 55 insertions(+), 39 deletions(-) create mode 100644 src/Math/Math.h diff --git a/doc/compilation-speedup.dox b/doc/compilation-speedup.dox index bfd68db8a..23313c4be 100644 --- a/doc/compilation-speedup.dox +++ b/doc/compilation-speedup.dox @@ -19,6 +19,7 @@ some types it can be too cumbersome -- e.g. too many template parameters, typedefs etc. In this case a header with forward declarations is usually available, each namespace has its own: + - Math/Math.h - Magnum.h - DebugTools/DebugTools.h - Physics/Physics.h diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index ed646d079..2c78f8b17 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -31,12 +31,6 @@ namespace Magnum { -namespace Math { - template class RectangularMatrix; - template class Matrix; - template class Vector; -} - #ifndef DOXYGEN_GENERATING_OUTPUT namespace Implementation { template struct Attribute; diff --git a/src/DimensionTraits.h b/src/DimensionTraits.h index ad3975501..e2b49e430 100644 --- a/src/DimensionTraits.h +++ b/src/DimensionTraits.h @@ -23,18 +23,6 @@ namespace Magnum { -namespace Math { - template class Vector; - template class Vector2; - template class Vector3; - - template class Point2D; - template class Point3D; - - template class Matrix3; - template class Matrix4; -} - /** @brief Matrix, point and vector specializations for given dimension count */ template struct DimensionTraits { DimensionTraits() = delete; diff --git a/src/Magnum.h b/src/Magnum.h index 1f8c7d14f..d47f2b15d 100644 --- a/src/Magnum.h +++ b/src/Magnum.h @@ -20,8 +20,10 @@ */ #include +#include + +#include "Math/Math.h" -#include "corradeConfigure.h" #include "magnumConfigure.h" #ifndef MAGNUM_TARGET_GLES @@ -56,23 +58,9 @@ namespace Corrade { namespace Magnum { namespace Math { - template class Vector2; - template class Vector3; - template class Vector4; - template class Point2D; - template class Point3D; - template class Matrix3; - template class Matrix4; - - template class Quaternion; - template constexpr T deg(T value); template constexpr T rad(T value); template class Constants; - - namespace Geometry { - template class Rectangle; - } } /* Bring debugging facility from Corrade::Utility namespace */ diff --git a/src/Math/CMakeLists.txt b/src/Math/CMakeLists.txt index fed15fe6c..1d347f4d0 100644 --- a/src/Math/CMakeLists.txt +++ b/src/Math/CMakeLists.txt @@ -1,6 +1,7 @@ set(MagnumMath_HEADERS Constants.h Functions.h + Math.h MathTypeTraits.h Matrix.h Matrix3.h diff --git a/src/Math/Math.h b/src/Math/Math.h new file mode 100644 index 000000000..df38fef81 --- /dev/null +++ b/src/Math/Math.h @@ -0,0 +1,50 @@ +#ifndef Magnum_Math_Math_h +#define Magnum_Math_Math_h +/* + Copyright © 2010, 2011, 2012 Vladimír Vondruš + + This file is part of Magnum. + + Magnum is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 3 + only, as published by the Free Software Foundation. + + Magnum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License version 3 for more details. +*/ + +/** @file + * @brief Forward declarations for Magnum::Math namespace + */ + +#include + +namespace Magnum { namespace Math { + +/* Class Constants used only statically */ + +template class Matrix; +template class Matrix3; +template class Matrix4; + +template class Point2D; +template class Point3D; + +template class Quaternion; + +template class RectangularMatrix; + +template class Vector; +template class Vector2; +template class Vector3; +template class Vector4; + +namespace Geometry { + template class Rectangle; +} + +}} + +#endif diff --git a/src/TypeTraits.h b/src/TypeTraits.h index 8c096feeb..f92c89577 100644 --- a/src/TypeTraits.h +++ b/src/TypeTraits.h @@ -28,12 +28,6 @@ namespace Magnum { -namespace Math { - template class RectangularMatrix; - template class Matrix; - template class Vector; -} - /** @brief Traits class for plain OpenGL types