LCOV - code coverage report
Current view: top level - generated/include/ad/physics - SpeedSquared.hpp (source / functions) Hit Total Coverage
Test: ad_physics Lines: 108 108 100.0 %
Date: 2022-10-04 09:47:07 Functions: 29 29 100.0 %
Branches: 48 48 100.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
       3                 :            :  *
       4                 :            :  * Copyright (C) 2018-2020 Intel Corporation
       5                 :            :  *
       6                 :            :  * SPDX-License-Identifier: MIT
       7                 :            :  *
       8                 :            :  * ----------------- END LICENSE BLOCK -----------------------------------
       9                 :            :  */
      10                 :            : 
      11                 :            : /**
      12                 :            :  * Generated file
      13                 :            :  * @file
      14                 :            :  *
      15                 :            :  * Generator Version : 11.0.0-1997
      16                 :            :  */
      17                 :            : 
      18                 :            : #pragma once
      19                 :            : 
      20                 :            : #include <cmath>
      21                 :            : #include <iostream>
      22                 :            : #include <limits>
      23                 :            : #include <sstream>
      24                 :            : #include <stdexcept>
      25                 :            : #include "spdlog/fmt/ostr.h"
      26                 :            : #include "spdlog/spdlog.h"
      27                 :            : /*!
      28                 :            :  * @brief namespace ad
      29                 :            :  */
      30                 :            : namespace ad {
      31                 :            : /*!
      32                 :            :  * @brief namespace physics
      33                 :            :  */
      34                 :            : namespace physics {
      35                 :            : 
      36                 :            : /*!
      37                 :            :  * \brief Define to indicate whether throwing exceptions is enabled
      38                 :            :  */
      39                 :            : #define AD_PHYSICS_SPEEDSQUARED_THROWS_EXCEPTION 1
      40                 :            : 
      41                 :            : #if SAFE_DATATYPES_EXPLICIT_CONVERSION
      42                 :            : /*!
      43                 :            :  * \brief Enable/Disable explicit conversion. Currently set to "only explicit conversion".
      44                 :            :  */
      45                 :            : #define _AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION_ explicit
      46                 :            : #else
      47                 :            : /*!
      48                 :            :  * \brief Enable/Disable explicit conversion. Currently set to "implicit conversion allowed".
      49                 :            :  */
      50                 :            : #define _AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION_
      51                 :            : #endif
      52                 :            : 
      53                 :            : /*!
      54                 :            :  * \brief Forward declaration of Speed
      55                 :            :  *
      56                 :            :  * Since SpeedSquared is defined explicitly as a physical type we have to consider this
      57                 :            :  * within operations. Therefore this square-rooted type is defined.
      58                 :            :  */
      59                 :            : class Speed;
      60                 :            : 
      61                 :            : /*!
      62                 :            :  * \brief DataType SpeedSquared
      63                 :            :  *
      64                 :            :  * SpeedSquared represents a squared Speed.
      65                 :            :  * The unit is: SquareMeterPerSecondSquared
      66                 :            :  */
      67                 :            : class SpeedSquared
      68                 :            : {
      69                 :            : public:
      70                 :            :   /*!
      71                 :            :    * \brief constant defining the minimum valid SpeedSquared value (used in isValid())
      72                 :            :    */
      73                 :            :   static const double cMinValue;
      74                 :            : 
      75                 :            :   /*!
      76                 :            :    * \brief constant defining the maximum valid SpeedSquared value (used in isValid())
      77                 :            :    */
      78                 :            :   static const double cMaxValue;
      79                 :            : 
      80                 :            :   /*!
      81                 :            :    * \brief constant defining the assumed SpeedSquared value accuracy
      82                 :            :    *   (used in comparison operator==(), operator!=())
      83                 :            :    */
      84                 :            :   static const double cPrecisionValue;
      85                 :            : 
      86                 :            :   /*!
      87                 :            :    * \brief default constructor
      88                 :            :    *
      89                 :            :    * The default value of SpeedSquared is:
      90                 :            :    * std::numeric_limits<double>::quiet_NaN()
      91                 :            :    */
      92                 :         14 :   SpeedSquared()
      93                 :         14 :     : mSpeedSquared(std::numeric_limits<double>::quiet_NaN())
      94                 :            :   {
      95                 :         14 :   }
      96                 :            : 
      97                 :            :   /*!
      98                 :            :    * \brief standard constructor
      99                 :            :    *
     100                 :            :    * \note \ref \_AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION\_ defines, if only an explicit conversion is allowed.
     101                 :            :    */
     102                 :        126 :   _AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION_ SpeedSquared(double const iSpeedSquared)
     103                 :        126 :     : mSpeedSquared(iSpeedSquared)
     104                 :            :   {
     105                 :        126 :   }
     106                 :            : 
     107                 :            :   /*!
     108                 :            :    * \brief standard copy constructor
     109                 :            :    */
     110                 :            :   SpeedSquared(const SpeedSquared &other) = default;
     111                 :            : 
     112                 :            :   /*!
     113                 :            :    * \brief standard move constructor
     114                 :            :    */
     115                 :            :   SpeedSquared(SpeedSquared &&other) = default;
     116                 :            : 
     117                 :            :   /**
     118                 :            :    * \brief standard assignment operator
     119                 :            :    *
     120                 :            :    * \param[in] other Other SpeedSquared
     121                 :            :    *
     122                 :            :    * \returns Reference to this SpeedSquared.
     123                 :            :    */
     124                 :            :   SpeedSquared &operator=(const SpeedSquared &other) = default;
     125                 :            : 
     126                 :            :   /**
     127                 :            :    * \brief standard move operator
     128                 :            :    *
     129                 :            :    * \param[in] other Other SpeedSquared
     130                 :            :    *
     131                 :            :    * \returns Reference to this SpeedSquared.
     132                 :            :    */
     133                 :            :   SpeedSquared &operator=(SpeedSquared &&other) = default;
     134                 :            : 
     135                 :            :   /**
     136                 :            :    * \brief standard comparison operator
     137                 :            :    *
     138                 :            :    * \param[in] other Other SpeedSquared
     139                 :            :    *
     140                 :            :    * \returns \c true if both SpeedSquared are valid and can be taken as numerically equal
     141                 :            :    */
     142                 :         40 :   bool operator==(const SpeedSquared &other) const
     143                 :            :   {
     144                 :         40 :     ensureValid();
     145                 :         38 :     other.ensureValid();
     146                 :         36 :     return std::fabs(mSpeedSquared - other.mSpeedSquared) < cPrecisionValue;
     147                 :            :   }
     148                 :            : 
     149                 :            :   /**
     150                 :            :    * \brief standard comparison operator
     151                 :            :    *
     152                 :            :    * \param[in] other Other SpeedSquared.
     153                 :            :    *
     154                 :            :    * \returns \c true if one of the SpeedSquared is not valid or they can be taken as numerically different
     155                 :            :    */
     156                 :         11 :   bool operator!=(const SpeedSquared &other) const
     157                 :            :   {
     158                 :         11 :     return !operator==(other);
     159                 :            :   }
     160                 :            : 
     161                 :            :   /**
     162                 :            :    * \brief standard comparison operator
     163                 :            :    *
     164                 :            :    * \param[in] other Other SpeedSquared.
     165                 :            :    *
     166                 :            :    * \returns \c true if both SpeedSquared are valid and
     167                 :            :    *   this SpeedSquared is strictly numerically greater than other.
     168                 :            :    * \note the precision of SpeedSquared is considered
     169                 :            :    */
     170                 :          5 :   bool operator>(const SpeedSquared &other) const
     171                 :            :   {
     172                 :          5 :     ensureValid();
     173                 :          4 :     other.ensureValid();
     174   [ +  +  +  + ]:          3 :     return (mSpeedSquared > other.mSpeedSquared) && operator!=(other);
     175                 :            :   }
     176                 :            : 
     177                 :            :   /**
     178                 :            :    * \brief standard comparison operator
     179                 :            :    *
     180                 :            :    * \param[in] other Other SpeedSquared.
     181                 :            :    *
     182                 :            :    * \returns \c true if both SpeedSquared are valid and
     183                 :            :    *   this SpeedSquared is strictly numerically smaller than other.
     184                 :            :    * \note the precision of SpeedSquared is considered
     185                 :            :    */
     186                 :          5 :   bool operator<(const SpeedSquared &other) const
     187                 :            :   {
     188                 :          5 :     ensureValid();
     189                 :          4 :     other.ensureValid();
     190   [ +  +  +  + ]:          3 :     return (mSpeedSquared < other.mSpeedSquared) && operator!=(other);
     191                 :            :   }
     192                 :            : 
     193                 :            :   /**
     194                 :            :    * \brief standard comparison operator
     195                 :            :    *
     196                 :            :    * \param[in] other Other SpeedSquared.
     197                 :            :    *
     198                 :            :    * \returns \c true if both SpeedSquared are valid and
     199                 :            :    *   this SpeedSquared is numerically greater than other.
     200                 :            :    * \note the precision of SpeedSquared is considered
     201                 :            :    */
     202                 :          7 :   bool operator>=(const SpeedSquared &other) const
     203                 :            :   {
     204                 :          7 :     ensureValid();
     205                 :          6 :     other.ensureValid();
     206   [ +  +  +  + ]:          5 :     return ((mSpeedSquared > other.mSpeedSquared) || operator==(other));
     207                 :            :   }
     208                 :            : 
     209                 :            :   /**
     210                 :            :    * \brief standard comparison operator
     211                 :            :    *
     212                 :            :    * \param[in] other Other SpeedSquared
     213                 :            :    *
     214                 :            :    * \returns \c true if both SpeedSquared are valid and
     215                 :            :    *   this SpeedSquared is numerically smaller than other.
     216                 :            :    * \note the precision of SpeedSquared is considered
     217                 :            :    */
     218                 :         36 :   bool operator<=(const SpeedSquared &other) const
     219                 :            :   {
     220                 :         36 :     ensureValid();
     221                 :         35 :     other.ensureValid();
     222   [ +  +  +  + ]:         34 :     return ((mSpeedSquared < other.mSpeedSquared) || operator==(other));
     223                 :            :   }
     224                 :            : 
     225                 :            :   /**
     226                 :            :    * \brief standard arithmetic operator
     227                 :            :    *
     228                 :            :    * \param[in] other Other SpeedSquared
     229                 :            :    *
     230                 :            :    * \returns Result of arithmetic operation.
     231                 :            :    *
     232                 :            :    * \note throws a std::out_of_range exception if one of the two operands or the result of
     233                 :            :    *   the operation is not valid
     234                 :            :    */
     235                 :          4 :   SpeedSquared operator+(const SpeedSquared &other) const
     236                 :            :   {
     237         [ +  + ]:          4 :     ensureValid();
     238         [ +  + ]:          3 :     other.ensureValid();
     239                 :          2 :     SpeedSquared const result(mSpeedSquared + other.mSpeedSquared);
     240         [ +  + ]:          2 :     result.ensureValid();
     241                 :          1 :     return result;
     242                 :            :   }
     243                 :            : 
     244                 :            :   /**
     245                 :            :    * \brief standard arithmetic operator
     246                 :            :    *
     247                 :            :    * \param[in] other Other SpeedSquared
     248                 :            :    *
     249                 :            :    * \returns Result of arithmetic operation.
     250                 :            :    *
     251                 :            :    * \note throws a std::out_of_range exception if one of the two operands or the result of
     252                 :            :    *   the operation is not valid
     253                 :            :    */
     254                 :          4 :   SpeedSquared &operator+=(const SpeedSquared &other)
     255                 :            :   {
     256                 :          4 :     ensureValid();
     257                 :          3 :     other.ensureValid();
     258                 :          2 :     mSpeedSquared += other.mSpeedSquared;
     259                 :          2 :     ensureValid();
     260                 :          1 :     return *this;
     261                 :            :   }
     262                 :            : 
     263                 :            :   /**
     264                 :            :    * \brief standard arithmetic operator
     265                 :            :    *
     266                 :            :    * \param[in] other Other SpeedSquared
     267                 :            :    *
     268                 :            :    * \returns Result of arithmetic operation.
     269                 :            :    *
     270                 :            :    * \note throws a std::out_of_range exception if one of the two operands or the result of
     271                 :            :    *   the operation is not valid
     272                 :            :    */
     273                 :          4 :   SpeedSquared operator-(const SpeedSquared &other) const
     274                 :            :   {
     275         [ +  + ]:          4 :     ensureValid();
     276         [ +  + ]:          3 :     other.ensureValid();
     277                 :          2 :     SpeedSquared const result(mSpeedSquared - other.mSpeedSquared);
     278         [ +  + ]:          2 :     result.ensureValid();
     279                 :          1 :     return result;
     280                 :            :   }
     281                 :            : 
     282                 :            :   /**
     283                 :            :    * \brief standard arithmetic operator
     284                 :            :    *
     285                 :            :    * \param[in] other Other SpeedSquared
     286                 :            :    *
     287                 :            :    * \returns Result of arithmetic operation.
     288                 :            :    *
     289                 :            :    * \note throws a std::out_of_range exception if one of the two operands or the result of
     290                 :            :    *   the operation is not valid
     291                 :            :    */
     292                 :          4 :   SpeedSquared operator-=(const SpeedSquared &other)
     293                 :            :   {
     294                 :          4 :     ensureValid();
     295                 :          3 :     other.ensureValid();
     296                 :          2 :     mSpeedSquared -= other.mSpeedSquared;
     297                 :          2 :     ensureValid();
     298                 :          1 :     return *this;
     299                 :            :   }
     300                 :            : 
     301                 :            :   /**
     302                 :            :    * \brief standard arithmetic operator
     303                 :            :    *
     304                 :            :    * \param[in] scalar Scalar double value
     305                 :            :    *
     306                 :            :    * \returns Result of arithmetic operation.
     307                 :            :    *
     308                 :            :    * \note throws a std::out_of_range exception if \c value or the result of
     309                 :            :    *   the operation is not valid
     310                 :            :    */
     311                 :          4 :   SpeedSquared operator*(const double &scalar) const
     312                 :            :   {
     313         [ +  + ]:          4 :     ensureValid();
     314                 :          3 :     SpeedSquared const result(mSpeedSquared * scalar);
     315         [ +  + ]:          3 :     result.ensureValid();
     316                 :          2 :     return result;
     317                 :            :   }
     318                 :            : 
     319                 :            :   /**
     320                 :            :    * \brief standard arithmetic operator
     321                 :            :    *
     322                 :            :    * \param[in] scalar Scalar double value
     323                 :            :    *
     324                 :            :    * \returns Result of arithmetic operation.
     325                 :            :    *
     326                 :            :    * \note throws a std::out_of_range exception if this or the result of
     327                 :            :    *   the operation is not valid or other is zero
     328                 :            :    */
     329                 :          5 :   SpeedSquared operator/(const double &scalar) const
     330                 :            :   {
     331                 :          5 :     SpeedSquared const scalarSpeedSquared(scalar);
     332         [ +  + ]:          5 :     SpeedSquared const result(operator/(scalarSpeedSquared));
     333         [ +  + ]:          2 :     result.ensureValid();
     334                 :          1 :     return result;
     335                 :            :   }
     336                 :            : 
     337                 :            :   /**
     338                 :            :    * \brief standard arithmetic operator
     339                 :            :    *
     340                 :            :    * \param[in] other Other SpeedSquared
     341                 :            :    *
     342                 :            :    * \returns Result of arithmetic operation.
     343                 :            :    *
     344                 :            :    * \note throws a std::out_of_range exception if one of the two operands or the result of
     345                 :            :    *   the operation is not valid or other is zero
     346                 :            :    * \note since SpeedSquared is a type with physical unit, the division results in the dimensionless type.
     347                 :            :    */
     348                 :          9 :   double operator/(const SpeedSquared &other) const
     349                 :            :   {
     350                 :          9 :     ensureValid();
     351                 :          7 :     other.ensureValidNonZero();
     352                 :          3 :     double const result = mSpeedSquared / other.mSpeedSquared;
     353                 :          3 :     return result;
     354                 :            :   }
     355                 :            : 
     356                 :            :   /**
     357                 :            :    * \brief standard arithmetic operator
     358                 :            :    *
     359                 :            :    * \returns Result of arithmetic operation.
     360                 :            :    *
     361                 :            :    * \note throws a std::out_of_range exception if this or the result of
     362                 :            :    *   the operation is not valid
     363                 :            :    */
     364                 :          2 :   SpeedSquared operator-() const
     365                 :            :   {
     366         [ +  + ]:          2 :     ensureValid();
     367                 :          1 :     SpeedSquared const result(-mSpeedSquared);
     368                 :          1 :     result.ensureValid(); // LCOV_EXCL_BR_LINE Some types do not throw an exception
     369                 :          1 :     return result;
     370                 :            :   }
     371                 :            : 
     372                 :            :   /*!
     373                 :            :    * \brief conversion to base type: double
     374                 :            :    *
     375                 :            :    * \note the conversion to the base type removes the physical unit.
     376                 :            :    *       \ref \_AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION\_ defines, if only explicit calls are allowed.
     377                 :            :    */
     378                 :        134 :   _AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION_ operator double() const
     379                 :            :   {
     380                 :        134 :     return mSpeedSquared;
     381                 :            :   }
     382                 :            : 
     383                 :            :   /*!
     384                 :            :    * \returns \c true if the SpeedSquared in a valid range
     385                 :            :    *
     386                 :            :    * An SpeedSquared value is defined to be valid if:
     387                 :            :    * - It is normal or zero (see std::fpclassify())
     388                 :            :    * - \ref cMinValue <= value <= \ref cMaxValue
     389                 :            :    */
     390                 :        276 :   bool isValid() const
     391                 :            :   {
     392                 :        276 :     auto const valueClass = std::fpclassify(mSpeedSquared);
     393   [ +  +  +  + ]:        276 :     return ((valueClass == FP_NORMAL) || (valueClass == FP_ZERO)) && (cMinValue <= mSpeedSquared)
     394   [ +  +  +  + ]:        552 :       && (mSpeedSquared <= cMaxValue);
     395                 :            :   }
     396                 :            : 
     397                 :            :   /*!
     398                 :            :    * \brief ensure that the SpeedSquared is valid
     399                 :            :    *
     400                 :            :    * Throws an std::out_of_range() exception if the SpeedSquared
     401                 :            :    * in not valid (i.e. isValid() returns false)
     402                 :            :    */
     403                 :        248 :   void ensureValid() const
     404                 :            :   {
     405         [ +  + ]:        248 :     if (!isValid())
     406                 :            :     {
     407                 :         34 :       spdlog::info("ensureValid(::ad::physics::SpeedSquared)>> {} value out of range", *this); // LCOV_EXCL_BR_LINE
     408                 :            : #if (AD_PHYSICS_SPEEDSQUARED_THROWS_EXCEPTION == 1)
     409                 :         34 :       throw std::out_of_range("SpeedSquared value out of range"); // LCOV_EXCL_BR_LINE
     410                 :            : #endif
     411                 :            :     }
     412                 :        214 :   }
     413                 :            : 
     414                 :            :   /*!
     415                 :            :    * \brief ensure that the SpeedSquared is valid and non zero
     416                 :            :    *
     417                 :            :    * Throws an std::out_of_range() exception if the SpeedSquared
     418                 :            :    * in not valid or zero (i.e. isValid() returns false)
     419                 :            :    */
     420                 :          9 :   void ensureValidNonZero() const
     421                 :            :   {
     422                 :          9 :     ensureValid();
     423                 :          6 :     if (operator==(SpeedSquared(0.))) // LCOV_EXCL_BR_LINE
     424                 :            :     {
     425                 :          3 :       spdlog::info("ensureValid(::ad::physics::SpeedSquared)>> {} value is zero", *this); // LCOV_EXCL_BR_LINE
     426                 :            : #if (AD_PHYSICS_SPEEDSQUARED_THROWS_EXCEPTION == 1)
     427                 :          3 :       throw std::out_of_range("SpeedSquared value is zero"); // LCOV_EXCL_BR_LINE
     428                 :            : #endif
     429                 :            :     }
     430                 :          3 :   }
     431                 :            : 
     432                 :            :   /*!
     433                 :            :    * \brief get minimum valid SpeedSquared (i.e. \ref cMinValue)
     434                 :            :    */
     435                 :         15 :   static SpeedSquared getMin()
     436                 :            :   {
     437                 :         15 :     return SpeedSquared(cMinValue);
     438                 :            :   }
     439                 :            : 
     440                 :            :   /*!
     441                 :            :    * \brief get maximum valid SpeedSquared (i.e. \ref cMaxValue)
     442                 :            :    */
     443                 :         15 :   static SpeedSquared getMax()
     444                 :            :   {
     445                 :         15 :     return SpeedSquared(cMaxValue);
     446                 :            :   }
     447                 :            : 
     448                 :            :   /*!
     449                 :            :    * \brief get assumed accuracy of SpeedSquared (i.e. \ref cPrecisionValue)
     450                 :            :    */
     451                 :          3 :   static SpeedSquared getPrecision()
     452                 :            :   {
     453                 :          3 :     return SpeedSquared(cPrecisionValue);
     454                 :            :   }
     455                 :            : 
     456                 :            : private:
     457                 :            :   /*!
     458                 :            :    * \brief the actual value of the type
     459                 :            :    */
     460                 :            :   double mSpeedSquared;
     461                 :            : };
     462                 :            : 
     463                 :            : } // namespace physics
     464                 :            : } // namespace ad
     465                 :            : /**
     466                 :            :  * \brief standard arithmetic operator
     467                 :            :  *
     468                 :            :  * \param[in] other Other SpeedSquared as double value
     469                 :            :  * \param[in] value SpeedSquared value
     470                 :            :  *
     471                 :            :  * \returns Result of arithmetic operation.
     472                 :            :  *
     473                 :            :  * \note throws a std::out_of_range exception if \c value or the result of
     474                 :            :  *   the operation is not valid
     475                 :            :  */
     476                 :          1 : inline ::ad::physics::SpeedSquared operator*(const double &other, ::ad::physics::SpeedSquared const &value)
     477                 :            : {
     478                 :          1 :   return value.operator*(other);
     479                 :            : }
     480                 :            : 
     481                 :            : /*!
     482                 :            :  * \brief namespace std
     483                 :            :  */
     484                 :            : namespace std {
     485                 :            : 
     486                 :            : /*!
     487                 :            :  * \brief overload of the std::fabs for SpeedSquared
     488                 :            :  */
     489                 :          7 : inline ::ad::physics::SpeedSquared fabs(const ::ad::physics::SpeedSquared other)
     490                 :            : {
     491                 :          7 :   ::ad::physics::SpeedSquared const result(std::fabs(static_cast<double>(other)));
     492                 :          7 :   return result;
     493                 :            : }
     494                 :            : 
     495                 :            : /*!
     496                 :            :  * \brief specialization of the std::numeric_limits for SpeedSquared
     497                 :            :  *
     498                 :            :  * Derived from std::numeric_limits<double> with overloaded functions:
     499                 :            :  * std::numeric_limits<SpeedSquared>::lowest()  (\see SpeedSquared::getMin())
     500                 :            :  * std::numeric_limits<SpeedSquared>::max()  (\see SpeedSquared::getMax())
     501                 :            :  * std::numeric_limits<SpeedSquared>::epsilon()  (\see SpeedSquared::getPrecision())
     502                 :            :  */
     503                 :            : template <> class numeric_limits<::ad::physics::SpeedSquared> : public numeric_limits<double>
     504                 :            : {
     505                 :            : public:
     506                 :            :   /*!
     507                 :            :    * \see std::numeric_limits::lowest()
     508                 :            :    */
     509                 :         12 :   static inline ::ad::physics::SpeedSquared lowest()
     510                 :            :   {
     511                 :         12 :     return ::ad::physics::SpeedSquared::getMin();
     512                 :            :   }
     513                 :            :   /*!
     514                 :            :    * \see std::numeric_limits::max()
     515                 :            :    */
     516                 :         12 :   static inline ::ad::physics::SpeedSquared max()
     517                 :            :   {
     518                 :         12 :     return ::ad::physics::SpeedSquared::getMax();
     519                 :            :   }
     520                 :            : 
     521                 :            :   /*!
     522                 :            :    * \see std::numeric_limits::epsilon()
     523                 :            :    */
     524                 :          1 :   static inline ::ad::physics::SpeedSquared epsilon()
     525                 :            :   {
     526                 :          1 :     return ::ad::physics::SpeedSquared::getPrecision();
     527                 :            :   }
     528                 :            : };
     529                 :            : 
     530                 :            : /*!
     531                 :            :  * \brief overload of the std::sqrt for SpeedSquared
     532                 :            :  *
     533                 :            :  * The square root of a squared type is basic type: Speed.
     534                 :            :  */
     535                 :            : ::ad::physics::Speed sqrt(::ad::physics::SpeedSquared const other);
     536                 :            : 
     537                 :            : } // namespace std
     538                 :            : 
     539                 :            : /*!
     540                 :            :  * \brief protect the definition of functions from duplicates by typedef usage within other data types
     541                 :            :  */
     542                 :            : #ifndef GEN_GUARD_AD_PHYSICS_SPEEDSQUARED
     543                 :            : #define GEN_GUARD_AD_PHYSICS_SPEEDSQUARED
     544                 :            : /*!
     545                 :            :  * @brief namespace ad
     546                 :            :  */
     547                 :            : namespace ad {
     548                 :            : /*!
     549                 :            :  * @brief namespace physics
     550                 :            :  */
     551                 :            : namespace physics {
     552                 :            : 
     553                 :            : /**
     554                 :            :  * \brief standard ostream operator
     555                 :            :  *
     556                 :            :  * \param[in] os The output stream to write to
     557                 :            :  * \param[in] _value SpeedSquared value
     558                 :            :  *
     559                 :            :  * \returns The stream object.
     560                 :            :  *
     561                 :            :  */
     562                 :         64 : inline std::ostream &operator<<(std::ostream &os, SpeedSquared const &_value)
     563                 :            : {
     564                 :         64 :   return os << double(_value);
     565                 :            : }
     566                 :            : 
     567                 :            : } // namespace physics
     568                 :            : } // namespace ad
     569                 :            : 
     570                 :            : namespace std {
     571                 :            : /*!
     572                 :            :  * \brief overload of the std::to_string for SpeedSquared
     573                 :            :  */
     574                 :            : inline std::string to_string(::ad::physics::SpeedSquared const &value)
     575                 :            : {
     576                 :            :   return to_string(static_cast<double>(value));
     577                 :            : }
     578                 :            : } // namespace std
     579                 :            : #endif // GEN_GUARD_AD_PHYSICS_SPEEDSQUARED

Generated by: LCOV version 1.14