ad_rss
Velocity.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: LGPL-2.1-only
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 rss {
36 namespace world {
37 
47 struct Velocity
48 {
52  typedef std::shared_ptr<Velocity> Ptr;
53 
57  typedef std::shared_ptr<Velocity const> ConstPtr;
58 
62  Velocity() = default;
63 
67  ~Velocity() = default;
68 
72  Velocity(const Velocity &other) = default;
73 
77  Velocity(Velocity &&other) = default;
78 
86  Velocity &operator=(const Velocity &other) = default;
87 
95  Velocity &operator=(Velocity &&other) = default;
96 
104  bool operator==(const Velocity &other) const
105  {
106  return (speedLonMin == other.speedLonMin) && (speedLonMax == other.speedLonMax)
107  && (speedLatMin == other.speedLatMin) && (speedLatMax == other.speedLatMax);
108  }
109 
117  bool operator!=(const Velocity &other) const
118  {
119  return !operator==(other);
120  }
121 
127  ::ad::physics::Speed speedLonMin{0.};
128 
134  ::ad::physics::Speed speedLonMax{100.};
135 
141  ::ad::physics::Speed speedLatMin{-100.};
142 
148  ::ad::physics::Speed speedLatMax{100.};
149 };
150 
151 } // namespace world
152 } // namespace rss
153 } // namespace ad
154 
158 #ifndef GEN_GUARD_AD_RSS_WORLD_VELOCITY
159 #define GEN_GUARD_AD_RSS_WORLD_VELOCITY
160 
163 namespace ad {
167 namespace rss {
171 namespace world {
172 
182 inline std::ostream &operator<<(std::ostream &os, Velocity const &_value)
183 {
184  os << "Velocity(";
185  os << "speedLonMin:";
186  os << _value.speedLonMin;
187  os << ",";
188  os << "speedLonMax:";
189  os << _value.speedLonMax;
190  os << ",";
191  os << "speedLatMin:";
192  os << _value.speedLatMin;
193  os << ",";
194  os << "speedLatMax:";
195  os << _value.speedLatMax;
196  os << ")";
197  return os;
198 }
199 
200 } // namespace world
201 } // namespace rss
202 } // namespace ad
203 
204 namespace std {
208 inline std::string to_string(::ad::rss::world::Velocity const &value)
209 {
210  stringstream sstream;
211  sstream << value;
212  return sstream.str();
213 }
214 } // namespace std
215 #endif // GEN_GUARD_AD_RSS_WORLD_VELOCITY
ad
namespace ad
Definition: LateralRelativePosition.hpp:26
ad::rss::world::Velocity::speedLatMax
::ad::physics::Speed speedLatMax
Definition: Velocity.hpp:148
ad::rss::world::Velocity::speedLatMin
::ad::physics::Speed speedLatMin
Definition: Velocity.hpp:141
std::to_string
std::string to_string(::ad::rss::situation::LateralRelativePosition const &value)
overload of the std::to_string for LateralRelativePosition
Definition: LateralRelativePosition.hpp:160
ad::rss::world::Velocity::speedLonMax
::ad::physics::Speed speedLonMax
Definition: Velocity.hpp:134
ad::rss::world::operator<<
std::ostream & operator<<(std::ostream &os, LaneDrivingDirection const &value)
standard ostream operator
Definition: LaneDrivingDirection.hpp:132
ad::rss::world::Velocity::operator!=
bool operator!=(const Velocity &other) const
standard comparison operator
Definition: Velocity.hpp:117
ad::rss::world::Velocity::Velocity
Velocity()=default
standard constructor
ad::rss::world::Velocity::operator=
Velocity & operator=(const Velocity &other)=default
standard assignment operator
ad::rss::world::Velocity::speedLonMin
::ad::physics::Speed speedLonMin
Definition: Velocity.hpp:127
ad::rss::world::Velocity
DataType Velocity.
Definition: Velocity.hpp:47
ad::rss::world::Velocity::ConstPtr
std::shared_ptr< Velocity const > ConstPtr
Smart pointer on constant Velocity.
Definition: Velocity.hpp:57
ad::rss::world::Velocity::Ptr
std::shared_ptr< Velocity > Ptr
Smart pointer on Velocity.
Definition: Velocity.hpp:52
ad::rss::world::Velocity::~Velocity
~Velocity()=default
standard destructor
ad::rss::world::Velocity::operator==
bool operator==(const Velocity &other) const
standard comparison operator
Definition: Velocity.hpp:104