Browse Source

singles: include the time types in MagnumMath.

Because why not, they're not that big and they're very useful, especially
in combination with the std::chrono compatibility.
pull/659/head
Vladimír Vondruš 1 year ago
parent
commit
8471a66a83
  1. 10
      doc/namespaces.dox
  2. 4
      src/Magnum/Math/Time.h
  3. 16
      src/singles/MagnumMath.hpp

10
doc/namespaces.dox

@ -113,10 +113,12 @@ more information.
@endcode
@par
If you need the deinlined symbols to be exported from a shared library,
@cpp #define MAGNUM_EXPORT @ce as appropriate. In addition, contents of the
@ref GlmIntegration and @ref EigenIntegration libraries except for the
@ref Magnum/EigenIntegration/DynamicMatrixIntegration.h header are included
as well --- opt-in by specifying either
@cpp #define MAGNUM_EXPORT @ce as appropriate. The STL compatibility bits
for time types are included as well --- opt-in with
@cpp #define MAGNUM_MATH_STL_COMPATIBILITY @ce before including the file.
Contents of the @ref GlmIntegration and @ref EigenIntegration libraries
except for the @ref Magnum/EigenIntegration/DynamicMatrixIntegration.h
can be opted in by specifying either
@cpp #define MAGNUM_MATH_GLM_INTEGRATION @ce or
@cpp #define MAGNUM_MATH_EIGEN_INTEGRATION @ce before including the file.
Including it multiple times with different macros defined works as well.

4
src/Magnum/Math/Time.h

@ -31,7 +31,9 @@
* @m_since_latest
*/
#ifndef CORRADE_SINGLES_NO_DEBUG
#include <Corrade/Utility/Utility.h>
#endif
#include "Magnum/Magnum.h"
#include "Magnum/visibility.h"
@ -396,6 +398,7 @@ template<class T> template<class U> constexpr Nanoseconds<T>::Nanoseconds(Unit<S
template<class T> template<class U> constexpr Seconds<T>::Seconds(Unit<Nanoseconds, U> value) noexcept: Unit<Math::Seconds, T>{T(static_cast<long double>(U(value))/1000000000.0l)} {}
#ifndef CORRADE_SINGLES_NO_DEBUG
/**
* @debugoperator{Nanoseconds}
* @m_since_latest
@ -407,6 +410,7 @@ MAGNUM_EXPORT Utility::Debug& operator<<(Utility::Debug& debug, const Unit<Nanos
* @m_since_latest
*/
MAGNUM_EXPORT Utility::Debug& operator<<(Utility::Debug& debug, const Unit<Seconds, Float>& value);
#endif
}}

16
src/singles/MagnumMath.hpp

@ -24,9 +24,11 @@
#include <MagnumMath.hpp>
If you need the deinlined symbols to be exported from a shared library,
`#define MAGNUM_EXPORT` as appropriate. In addition, contents of the
GlmIntegration and EigenIntegration libraries are included as well ---
opt-in by specifying either `#define MAGNUM_MATH_GLM_INTEGRATION` or
`#define MAGNUM_EXPORT` as appropriate. The STL compatibility bits for time
types are included as well --- opt-in with
`#define MAGNUM_MATH_STL_COMPATIBILITY` before including the file. Contents
of the GlmIntegration and EigenIntegration libraries can be opted in by
specifying either `#define MAGNUM_MATH_GLM_INTEGRATION` or
`#define MAGNUM_MATH_EIGEN_INTEGRATION` before including the file.
Including it multiple times with different macros defined works as well.
@ -309,6 +311,8 @@ typedef Math::Range1D<Int> Range1Di;
typedef Math::Range2D<Int> Range2Di;
typedef Math::Range3D<Int> Range3Di;
typedef Math::Frustum<Float> Frustum;
typedef Math::Nanoseconds<Long> Nanoseconds;
typedef Math::Seconds<Float> Seconds;
typedef Math::Vector2<Half> Vector2h;
typedef Math::Vector3<Half> Vector3h;
typedef Math::Vector4<Half> Vector4h;
@ -397,6 +401,7 @@ typedef Math::Frustum<Double> Frustumd;
#include "Magnum/Math/RectangularMatrix.h"
#include "Magnum/Math/Swizzle.h"
#include "Magnum/Math/Tags.h"
#include "Magnum/Math/Time.h"
#include "Magnum/Math/TypeTraits.h"
#include "Magnum/Math/Unit.h"
#include "Magnum/Math/Vector.h"
@ -408,6 +413,10 @@ typedef Math::Frustum<Double> Frustumd;
#include "Magnum/Math/Algorithms/KahanSum.h"
#include "Magnum/Math/Algorithms/Qr.h"
//#include "Magnum/Math/Algorithms/Svd.h" // TODO needs Optional and Triple
#ifdef MAGNUM_MATH_STL_COMPATIBILITY
// {{includes}}
#include "Magnum/Math/TimeStl.h"
#endif
#ifdef MAGNUM_MATH_GLM_INTEGRATION
// {{includes}}
#include "Magnum/GlmIntegration/Integration.h"
@ -424,4 +433,5 @@ typedef Math::Frustum<Double> Frustumd;
// {{ includes }}
#include "Magnum/Math/Functions.cpp"
#include "Magnum/Math/Packing.cpp"
/* Time.cpp is just debug output operators, not included */
#endif

Loading…
Cancel
Save