ad_physics
SpeedRange.hpp
Go to the documentation of this file.
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 
18 #pragma once
19 
20 #include <iostream>
21 #include <limits>
22 #include <memory>
23 #include <sstream>
24 #include "ad/physics/Speed.hpp"
28 namespace ad {
32 namespace physics {
33 
39 struct SpeedRange
40 {
44  typedef std::shared_ptr<SpeedRange> Ptr;
45 
49  typedef std::shared_ptr<SpeedRange const> ConstPtr;
50 
54  SpeedRange() = default;
55 
59  ~SpeedRange() = default;
60 
64  SpeedRange(const SpeedRange &other) = default;
65 
69  SpeedRange(SpeedRange &&other) = default;
70 
78  SpeedRange &operator=(const SpeedRange &other) = default;
79 
87  SpeedRange &operator=(SpeedRange &&other) = default;
88 
96  bool operator==(const SpeedRange &other) const
97  {
98  return (minimum == other.minimum) && (maximum == other.maximum);
99  }
100 
108  bool operator!=(const SpeedRange &other) const
109  {
110  return !operator==(other);
111  }
112 
116  ::ad::physics::Speed minimum{std::numeric_limits<Speed>::lowest()};
117 
121  ::ad::physics::Speed maximum{std::numeric_limits<Speed>::max()};
122 };
123 
124 } // namespace physics
125 } // namespace ad
126 
130 #ifndef GEN_GUARD_AD_PHYSICS_SPEEDRANGE
131 #define GEN_GUARD_AD_PHYSICS_SPEEDRANGE
132 
135 namespace ad {
139 namespace physics {
140 
150 inline std::ostream &operator<<(std::ostream &os, SpeedRange const &_value)
151 {
152  os << "SpeedRange(";
153  os << "minimum:";
154  os << _value.minimum;
155  os << ",";
156  os << "maximum:";
157  os << _value.maximum;
158  os << ")";
159  return os;
160 }
161 
162 } // namespace physics
163 } // namespace ad
164 
165 namespace std {
169 inline std::string to_string(::ad::physics::SpeedRange const &value)
170 {
171  stringstream sstream;
172  sstream << value;
173  return sstream.str();
174 }
175 } // namespace std
176 #endif // GEN_GUARD_AD_PHYSICS_SPEEDRANGE
ad
namespace ad
Definition: Acceleration.hpp:30
ad::physics::SpeedRange::maximum
::ad::physics::Speed maximum
Definition: SpeedRange.hpp:121
Speed.hpp
ad::physics::Speed
DataType Speed.
Definition: Speed.hpp:68
ad::physics::SpeedRange::SpeedRange
SpeedRange()=default
standard constructor
ad::physics::SpeedRange::minimum
::ad::physics::Speed minimum
Definition: SpeedRange.hpp:116
ad::physics::SpeedRange::operator=
SpeedRange & operator=(const SpeedRange &other)=default
standard assignment operator
ad::physics::SpeedRange::Ptr
std::shared_ptr< SpeedRange > Ptr
Smart pointer on SpeedRange.
Definition: SpeedRange.hpp:44
ad::physics::SpeedRange::operator==
bool operator==(const SpeedRange &other) const
standard comparison operator
Definition: SpeedRange.hpp:96
ad::physics::SpeedRange
DataType SpeedRange.
Definition: SpeedRange.hpp:39
ad::physics::SpeedRange::operator!=
bool operator!=(const SpeedRange &other) const
standard comparison operator
Definition: SpeedRange.hpp:108
std::to_string
std::string to_string(::ad::physics::Acceleration const &value)
overload of the std::to_string for Acceleration
Definition: Acceleration.hpp:559
ad::physics::SpeedRange::~SpeedRange
~SpeedRange()=default
standard destructor
ad::physics::operator<<
std::ostream & operator<<(std::ostream &os, Acceleration const &_value)
standard ostream operator
Definition: Acceleration.hpp:547
ad::physics::SpeedRange::ConstPtr
std::shared_ptr< SpeedRange const > ConstPtr
Smart pointer on constant SpeedRange.
Definition: SpeedRange.hpp:49