LCOV - code coverage report
Current view: top level - generated/include/ad/physics - DurationSquared.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_DURATIONSQUARED_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_DURATIONSQUARED_EXPLICIT_CONVERSION_ explicit
      46                 :            : #else
      47                 :            : /*!
      48                 :            :  * \brief Enable/Disable explicit conversion. Currently set to "implicit conversion allowed".
      49                 :            :  */
      50                 :            : #define _AD_PHYSICS_DURATIONSQUARED_EXPLICIT_CONVERSION_
      51                 :            : #endif
      52                 :            : 
      53                 :            : /*!
      54                 :            :  * \brief Forward declaration of Duration
      55                 :            :  *
      56                 :            :  * Since DurationSquared 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 Duration;
      60                 :            : 
      61                 :            : /*!
      62                 :            :  * \brief DataType DurationSquared
      63                 :            :  *
      64                 :            :  * DurationSquared represents a squared Duration
      65                 :            :  * The unit is: SecondSquared
      66                 :            :  */
      67                 :            : class DurationSquared
      68                 :            : {
      69                 :            : public:
      70                 :            :   /*!
      71                 :            :    * \brief constant defining the minimum valid DurationSquared value (used in isValid())
      72                 :            :    */
      73                 :            :   static const double cMinValue;
      74                 :            : 
      75                 :            :   /*!
      76                 :            :    * \brief constant defining the maximum valid DurationSquared value (used in isValid())
      77                 :            :    */
      78                 :            :   static const double cMaxValue;
      79                 :            : 
      80                 :            :   /*!
      81                 :            :    * \brief constant defining the assumed DurationSquared 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 DurationSquared is:
      90                 :            :    * std::numeric_limits<double>::quiet_NaN()
      91                 :            :    */
      92                 :         14 :   DurationSquared()
      93                 :         14 :     : mDurationSquared(std::numeric_limits<double>::quiet_NaN())
      94                 :            :   {
      95                 :         14 :   }
      96                 :            : 
      97                 :            :   /*!
      98                 :            :    * \brief standard constructor
      99                 :            :    *
     100                 :            :    * \note \ref \_AD_PHYSICS_DURATIONSQUARED_EXPLICIT_CONVERSION\_ defines, if only an explicit conversion is allowed.
     101                 :            :    */
     102                 :        126 :   _AD_PHYSICS_DURATIONSQUARED_EXPLICIT_CONVERSION_ DurationSquared(double const iDurationSquared)
     103                 :        126 :     : mDurationSquared(iDurationSquared)
     104                 :            :   {
     105                 :        126 :   }
     106                 :            : 
     107                 :            :   /*!
     108                 :            :    * \brief standard copy constructor
     109                 :            :    */
     110                 :            :   DurationSquared(const DurationSquared &other) = default;
     111                 :            : 
     112                 :            :   /*!
     113                 :            :    * \brief standard move constructor
     114                 :            :    */
     115                 :            :   DurationSquared(DurationSquared &&other) = default;
     116                 :            : 
     117                 :            :   /**
     118                 :            :    * \brief standard assignment operator
     119                 :            :    *
     120                 :            :    * \param[in] other Other DurationSquared
     121                 :            :    *
     122                 :            :    * \returns Reference to this DurationSquared.
     123                 :            :    */
     124                 :            :   DurationSquared &operator=(const DurationSquared &other) = default;
     125                 :            : 
     126                 :            :   /**
     127                 :            :    * \brief standard move operator
     128                 :            :    *
     129                 :            :    * \param[in] other Other DurationSquared
     130                 :            :    *
     131                 :            :    * \returns Reference to this DurationSquared.
     132                 :            :    */
     133                 :            :   DurationSquared &operator=(DurationSquared &&other) = default;
     134                 :            : 
     135                 :            :   /**
     136                 :            :    * \brief standard comparison operator
     137                 :            :    *
     138                 :            :    * \param[in] other Other DurationSquared
     139                 :            :    *
     140                 :            :    * \returns \c true if both DurationSquared are valid and can be taken as numerically equal
     141                 :            :    */
     142                 :         40 :   bool operator==(const DurationSquared &other) const
     143                 :            :   {
     144                 :         40 :     ensureValid();
     145                 :         38 :     other.ensureValid();
     146                 :         36 :     return std::fabs(mDurationSquared - other.mDurationSquared) < cPrecisionValue;
     147                 :            :   }
     148                 :            : 
     149                 :            :   /**
     150                 :            :    * \brief standard comparison operator
     151                 :            :    *
     152                 :            :    * \param[in] other Other DurationSquared.
     153                 :            :    *
     154                 :            :    * \returns \c true if one of the DurationSquared is not valid or they can be taken as numerically different
     155                 :            :    */
     156                 :         11 :   bool operator!=(const DurationSquared &other) const
     157                 :            :   {
     158                 :         11 :     return !operator==(other);
     159                 :            :   }
     160                 :            : 
     161                 :            :   /**
     162                 :            :    * \brief standard comparison operator
     163                 :            :    *
     164                 :            :    * \param[in] other Other DurationSquared.
     165                 :            :    *
     166                 :            :    * \returns \c true if both DurationSquared are valid and
     167                 :            :    *   this DurationSquared is strictly numerically greater than other.
     168                 :            :    * \note the precision of DurationSquared is considered
     169                 :            :    */
     170                 :          5 :   bool operator>(const DurationSquared &other) const
     171                 :            :   {
     172                 :          5 :     ensureValid();
     173                 :          4 :     other.ensureValid();
     174   [ +  +  +  + ]:          3 :     return (mDurationSquared > other.mDurationSquared) && operator!=(other);
     175                 :            :   }
     176                 :            : 
     177                 :            :   /**
     178                 :            :    * \brief standard comparison operator
     179                 :            :    *
     180                 :            :    * \param[in] other Other DurationSquared.
     181                 :            :    *
     182                 :            :    * \returns \c true if both DurationSquared are valid and
     183                 :            :    *   this DurationSquared is strictly numerically smaller than other.
     184                 :            :    * \note the precision of DurationSquared is considered
     185                 :            :    */
     186                 :          5 :   bool operator<(const DurationSquared &other) const
     187                 :            :   {
     188                 :          5 :     ensureValid();
     189                 :          4 :     other.ensureValid();
     190   [ +  +  +  + ]:          3 :     return (mDurationSquared < other.mDurationSquared) && operator!=(other);
     191                 :            :   }
     192                 :            : 
     193                 :            :   /**
     194                 :            :    * \brief standard comparison operator
     195                 :            :    *
     196                 :            :    * \param[in] other Other DurationSquared.
     197                 :            :    *
     198                 :            :    * \returns \c true if both DurationSquared are valid and
     199                 :            :    *   this DurationSquared is numerically greater than other.
     200                 :            :    * \note the precision of DurationSquared is considered
     201                 :            :    */
     202                 :          7 :   bool operator>=(const DurationSquared &other) const
     203                 :            :   {
     204                 :          7 :     ensureValid();
     205                 :          6 :     other.ensureValid();
     206   [ +  +  +  + ]:          5 :     return ((mDurationSquared > other.mDurationSquared) || operator==(other));
     207                 :            :   }
     208                 :            : 
     209                 :            :   /**
     210                 :            :    * \brief standard comparison operator
     211                 :            :    *
     212                 :            :    * \param[in] other Other DurationSquared
     213                 :            :    *
     214                 :            :    * \returns \c true if both DurationSquared are valid and
     215                 :            :    *   this DurationSquared is numerically smaller than other.
     216                 :            :    * \note the precision of DurationSquared is considered
     217                 :            :    */
     218                 :         36 :   bool operator<=(const DurationSquared &other) const
     219                 :            :   {
     220                 :         36 :     ensureValid();
     221                 :         35 :     other.ensureValid();
     222   [ +  +  +  + ]:         34 :     return ((mDurationSquared < other.mDurationSquared) || operator==(other));
     223                 :            :   }
     224                 :            : 
     225                 :            :   /**
     226                 :            :    * \brief standard arithmetic operator
     227                 :            :    *
     228                 :            :    * \param[in] other Other DurationSquared
     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 :   DurationSquared operator+(const DurationSquared &other) const
     236                 :            :   {
     237         [ +  + ]:          4 :     ensureValid();
     238         [ +  + ]:          3 :     other.ensureValid();
     239                 :          2 :     DurationSquared const result(mDurationSquared + other.mDurationSquared);
     240         [ +  + ]:          2 :     result.ensureValid();
     241                 :          1 :     return result;
     242                 :            :   }
     243                 :            : 
     244                 :            :   /**
     245                 :            :    * \brief standard arithmetic operator
     246                 :            :    *
     247                 :            :    * \param[in] other Other DurationSquared
     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 :   DurationSquared &operator+=(const DurationSquared &other)
     255                 :            :   {
     256                 :          4 :     ensureValid();
     257                 :          3 :     other.ensureValid();
     258                 :          2 :     mDurationSquared += other.mDurationSquared;
     259                 :          2 :     ensureValid();
     260                 :          1 :     return *this;
     261                 :            :   }
     262                 :            : 
     263                 :            :   /**
     264                 :            :    * \brief standard arithmetic operator
     265                 :            :    *
     266                 :            :    * \param[in] other Other DurationSquared
     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 :   DurationSquared operator-(const DurationSquared &other) const
     274                 :            :   {
     275         [ +  + ]:          4 :     ensureValid();
     276         [ +  + ]:          3 :     other.ensureValid();
     277                 :          2 :     DurationSquared const result(mDurationSquared - other.mDurationSquared);
     278         [ +  + ]:          2 :     result.ensureValid();
     279                 :          1 :     return result;
     280                 :            :   }
     281                 :            : 
     282                 :            :   /**
     283                 :            :    * \brief standard arithmetic operator
     284                 :            :    *
     285                 :            :    * \param[in] other Other DurationSquared
     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 :   DurationSquared operator-=(const DurationSquared &other)
     293                 :            :   {
     294                 :          4 :     ensureValid();
     295                 :          3 :     other.ensureValid();
     296                 :          2 :     mDurationSquared -= other.mDurationSquared;
     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 :   DurationSquared operator*(const double &scalar) const
     312                 :            :   {
     313         [ +  + ]:          4 :     ensureValid();
     314                 :          3 :     DurationSquared const result(mDurationSquared * 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 :   DurationSquared operator/(const double &scalar) const
     330                 :            :   {
     331                 :          5 :     DurationSquared const scalarDurationSquared(scalar);
     332         [ +  + ]:          5 :     DurationSquared const result(operator/(scalarDurationSquared));
     333         [ +  + ]:          2 :     result.ensureValid();
     334                 :          1 :     return result;
     335                 :            :   }
     336                 :            : 
     337                 :            :   /**
     338                 :            :    * \brief standard arithmetic operator
     339                 :            :    *
     340                 :            :    * \param[in] other Other DurationSquared
     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 DurationSquared is a type with physical unit, the division results in the dimensionless type.
     347                 :            :    */
     348                 :          9 :   double operator/(const DurationSquared &other) const
     349                 :            :   {
     350                 :          9 :     ensureValid();
     351                 :          7 :     other.ensureValidNonZero();
     352                 :          3 :     double const result = mDurationSquared / other.mDurationSquared;
     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 :   DurationSquared operator-() const
     365                 :            :   {
     366         [ +  + ]:          2 :     ensureValid();
     367                 :          1 :     DurationSquared const result(-mDurationSquared);
     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_DURATIONSQUARED_EXPLICIT_CONVERSION\_ defines, if only explicit calls are allowed.
     377                 :            :    */
     378                 :        134 :   _AD_PHYSICS_DURATIONSQUARED_EXPLICIT_CONVERSION_ operator double() const
     379                 :            :   {
     380                 :        134 :     return mDurationSquared;
     381                 :            :   }
     382                 :            : 
     383                 :            :   /*!
     384                 :            :    * \returns \c true if the DurationSquared in a valid range
     385                 :            :    *
     386                 :            :    * An DurationSquared 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(mDurationSquared);
     393   [ +  +  +  + ]:        276 :     return ((valueClass == FP_NORMAL) || (valueClass == FP_ZERO)) && (cMinValue <= mDurationSquared)
     394   [ +  +  +  + ]:        552 :       && (mDurationSquared <= cMaxValue);
     395                 :            :   }
     396                 :            : 
     397                 :            :   /*!
     398                 :            :    * \brief ensure that the DurationSquared is valid
     399                 :            :    *
     400                 :            :    * Throws an std::out_of_range() exception if the DurationSquared
     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::DurationSquared)>> {} value out of range", *this); // LCOV_EXCL_BR_LINE
     408                 :            : #if (AD_PHYSICS_DURATIONSQUARED_THROWS_EXCEPTION == 1)
     409                 :         34 :       throw std::out_of_range("DurationSquared value out of range"); // LCOV_EXCL_BR_LINE
     410                 :            : #endif
     411                 :            :     }
     412                 :        214 :   }
     413                 :            : 
     414                 :            :   /*!
     415                 :            :    * \brief ensure that the DurationSquared is valid and non zero
     416                 :            :    *
     417                 :            :    * Throws an std::out_of_range() exception if the DurationSquared
     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==(DurationSquared(0.))) // LCOV_EXCL_BR_LINE
     424                 :            :     {
     425                 :          3 :       spdlog::info("ensureValid(::ad::physics::DurationSquared)>> {} value is zero", *this); // LCOV_EXCL_BR_LINE
     426                 :            : #if (AD_PHYSICS_DURATIONSQUARED_THROWS_EXCEPTION == 1)
     427                 :          3 :       throw std::out_of_range("DurationSquared value is zero"); // LCOV_EXCL_BR_LINE
     428                 :            : #endif
     429                 :            :     }
     430                 :          3 :   }
     431                 :            : 
     432                 :            :   /*!
     433                 :            :    * \brief get minimum valid DurationSquared (i.e. \ref cMinValue)
     434                 :            :    */
     435                 :         15 :   static DurationSquared getMin()
     436                 :            :   {
     437                 :         15 :     return DurationSquared(cMinValue);
     438                 :            :   }
     439                 :            : 
     440                 :            :   /*!
     441                 :            :    * \brief get maximum valid DurationSquared (i.e. \ref cMaxValue)
     442                 :            :    */
     443                 :         15 :   static DurationSquared getMax()
     444                 :            :   {
     445                 :         15 :     return DurationSquared(cMaxValue);
     446                 :            :   }
     447                 :            : 
     448                 :            :   /*!
     449                 :            :    * \brief get assumed accuracy of DurationSquared (i.e. \ref cPrecisionValue)
     450                 :            :    */
     451                 :          3 :   static DurationSquared getPrecision()
     452                 :            :   {
     453                 :          3 :     return DurationSquared(cPrecisionValue);
     454                 :            :   }
     455                 :            : 
     456                 :            : private:
     457                 :            :   /*!
     458                 :            :    * \brief the actual value of the type
     459                 :            :    */
     460                 :            :   double mDurationSquared;
     461                 :            : };
     462                 :            : 
     463                 :            : } // namespace physics
     464                 :            : } // namespace ad
     465                 :            : /**
     466                 :            :  * \brief standard arithmetic operator
     467                 :            :  *
     468                 :            :  * \param[in] other Other DurationSquared as double value
     469                 :            :  * \param[in] value DurationSquared 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::DurationSquared operator*(const double &other, ::ad::physics::DurationSquared 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 DurationSquared
     488                 :            :  */
     489                 :          7 : inline ::ad::physics::DurationSquared fabs(const ::ad::physics::DurationSquared other)
     490                 :            : {
     491                 :          7 :   ::ad::physics::DurationSquared const result(std::fabs(static_cast<double>(other)));
     492                 :          7 :   return result;
     493                 :            : }
     494                 :            : 
     495                 :            : /*!
     496                 :            :  * \brief specialization of the std::numeric_limits for DurationSquared
     497                 :            :  *
     498                 :            :  * Derived from std::numeric_limits<double> with overloaded functions:
     499                 :            :  * std::numeric_limits<DurationSquared>::lowest()  (\see DurationSquared::getMin())
     500                 :            :  * std::numeric_limits<DurationSquared>::max()  (\see DurationSquared::getMax())
     501                 :            :  * std::numeric_limits<DurationSquared>::epsilon()  (\see DurationSquared::getPrecision())
     502                 :            :  */
     503                 :            : template <> class numeric_limits<::ad::physics::DurationSquared> : public numeric_limits<double>
     504                 :            : {
     505                 :            : public:
     506                 :            :   /*!
     507                 :            :    * \see std::numeric_limits::lowest()
     508                 :            :    */
     509                 :         12 :   static inline ::ad::physics::DurationSquared lowest()
     510                 :            :   {
     511                 :         12 :     return ::ad::physics::DurationSquared::getMin();
     512                 :            :   }
     513                 :            :   /*!
     514                 :            :    * \see std::numeric_limits::max()
     515                 :            :    */
     516                 :         12 :   static inline ::ad::physics::DurationSquared max()
     517                 :            :   {
     518                 :         12 :     return ::ad::physics::DurationSquared::getMax();
     519                 :            :   }
     520                 :            : 
     521                 :            :   /*!
     522                 :            :    * \see std::numeric_limits::epsilon()
     523                 :            :    */
     524                 :          1 :   static inline ::ad::physics::DurationSquared epsilon()
     525                 :            :   {
     526                 :          1 :     return ::ad::physics::DurationSquared::getPrecision();
     527                 :            :   }
     528                 :            : };
     529                 :            : 
     530                 :            : /*!
     531                 :            :  * \brief overload of the std::sqrt for DurationSquared
     532                 :            :  *
     533                 :            :  * The square root of a squared type is basic type: Duration.
     534                 :            :  */
     535                 :            : ::ad::physics::Duration sqrt(::ad::physics::DurationSquared 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_DURATIONSQUARED
     543                 :            : #define GEN_GUARD_AD_PHYSICS_DURATIONSQUARED
     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 DurationSquared value
     558                 :            :  *
     559                 :            :  * \returns The stream object.
     560                 :            :  *
     561                 :            :  */
     562                 :         64 : inline std::ostream &operator<<(std::ostream &os, DurationSquared 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 DurationSquared
     573                 :            :  */
     574                 :            : inline std::string to_string(::ad::physics::DurationSquared const &value)
     575                 :            : {
     576                 :            :   return to_string(static_cast<double>(value));
     577                 :            : }
     578                 :            : } // namespace std
     579                 :            : #endif // GEN_GUARD_AD_PHYSICS_DURATIONSQUARED

Generated by: LCOV version 1.14