ad_physics
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: 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 
41 struct Velocity
42 {
46  typedef std::shared_ptr<Velocity> Ptr;
47 
51  typedef std::shared_ptr<Velocity const> ConstPtr;
52 
56  Velocity() = default;
57 
61  ~Velocity() = default;
62 
66  Velocity(const Velocity &other) = default;
67 
71  Velocity(Velocity &&other) = default;
72 
80  Velocity &operator=(const Velocity &other) = default;
81 
89  Velocity &operator=(Velocity &&other) = default;
90 
98  bool operator==(const Velocity &other) const
99  {
100  return (x == other.x) && (y == other.y) && (z == other.z);
101  }
102 
110  bool operator!=(const Velocity &other) const
111  {
112  return !operator==(other);
113  }
114 
119 
124 
129 };
130 
131 } // namespace physics
132 } // namespace ad
133 
137 #ifndef GEN_GUARD_AD_PHYSICS_VELOCITY
138 #define GEN_GUARD_AD_PHYSICS_VELOCITY
139 
142 namespace ad {
146 namespace physics {
147 
157 inline std::ostream &operator<<(std::ostream &os, Velocity const &_value)
158 {
159  os << "Velocity(";
160  os << "x:";
161  os << _value.x;
162  os << ",";
163  os << "y:";
164  os << _value.y;
165  os << ",";
166  os << "z:";
167  os << _value.z;
168  os << ")";
169  return os;
170 }
171 
172 } // namespace physics
173 } // namespace ad
174 
175 namespace std {
179 inline std::string to_string(::ad::physics::Velocity const &value)
180 {
181  stringstream sstream;
182  sstream << value;
183  return sstream.str();
184 }
185 } // namespace std
186 #endif // GEN_GUARD_AD_PHYSICS_VELOCITY
ad
namespace ad
Definition: Acceleration.hpp:30
ad::physics::Velocity::operator==
bool operator==(const Velocity &other) const
standard comparison operator
Definition: Velocity.hpp:98
Speed.hpp
ad::physics::Velocity::Velocity
Velocity()=default
standard constructor
ad::physics::Speed
DataType Speed.
Definition: Speed.hpp:68
ad::physics::Velocity::ConstPtr
std::shared_ptr< Velocity const > ConstPtr
Smart pointer on constant Velocity.
Definition: Velocity.hpp:51
ad::physics::Velocity::~Velocity
~Velocity()=default
standard destructor
ad::physics::Velocity::Ptr
std::shared_ptr< Velocity > Ptr
Smart pointer on Velocity.
Definition: Velocity.hpp:46
ad::physics::Velocity::operator=
Velocity & operator=(const Velocity &other)=default
standard assignment operator
ad::physics::Velocity::x
::ad::physics::Speed x
Definition: Velocity.hpp:118
ad::physics::Velocity::operator!=
bool operator!=(const Velocity &other) const
standard comparison operator
Definition: Velocity.hpp:110
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::Velocity::z
::ad::physics::Speed z
Definition: Velocity.hpp:128
ad::physics::Velocity::y
::ad::physics::Speed y
Definition: Velocity.hpp:123
ad::physics::operator<<
std::ostream & operator<<(std::ostream &os, Acceleration const &_value)
standard ostream operator
Definition: Acceleration.hpp:547
ad::physics::Velocity
DataType Velocity.
Definition: Velocity.hpp:41