ad_physics
Distance3D.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/Distance.hpp"
28 namespace ad {
32 namespace physics {
33 
39 struct Distance3D
40 {
44  typedef std::shared_ptr<Distance3D> Ptr;
45 
49  typedef std::shared_ptr<Distance3D const> ConstPtr;
50 
54  Distance3D() = default;
55 
59  ~Distance3D() = default;
60 
64  Distance3D(const Distance3D &other) = default;
65 
69  Distance3D(Distance3D &&other) = default;
70 
78  Distance3D &operator=(const Distance3D &other) = default;
79 
87  Distance3D &operator=(Distance3D &&other) = default;
88 
96  bool operator==(const Distance3D &other) const
97  {
98  return (x == other.x) && (y == other.y) && (z == other.z);
99  }
100 
108  bool operator!=(const Distance3D &other) const
109  {
110  return !operator==(other);
111  }
112 
117 
122 
127 };
128 
129 } // namespace physics
130 } // namespace ad
131 
135 #ifndef GEN_GUARD_AD_PHYSICS_DISTANCE3D
136 #define GEN_GUARD_AD_PHYSICS_DISTANCE3D
137 
140 namespace ad {
144 namespace physics {
145 
155 inline std::ostream &operator<<(std::ostream &os, Distance3D const &_value)
156 {
157  os << "Distance3D(";
158  os << "x:";
159  os << _value.x;
160  os << ",";
161  os << "y:";
162  os << _value.y;
163  os << ",";
164  os << "z:";
165  os << _value.z;
166  os << ")";
167  return os;
168 }
169 
170 } // namespace physics
171 } // namespace ad
172 
173 namespace std {
177 inline std::string to_string(::ad::physics::Distance3D const &value)
178 {
179  stringstream sstream;
180  sstream << value;
181  return sstream.str();
182 }
183 } // namespace std
184 #endif // GEN_GUARD_AD_PHYSICS_DISTANCE3D
ad
namespace ad
Definition: Acceleration.hpp:30
ad::physics::Distance
DataType Distance.
Definition: Distance.hpp:67
ad::physics::Distance3D::Ptr
std::shared_ptr< Distance3D > Ptr
Smart pointer on Distance3D.
Definition: Distance3D.hpp:44
ad::physics::Distance3D::Distance3D
Distance3D()=default
standard constructor
ad::physics::Distance3D::~Distance3D
~Distance3D()=default
standard destructor
ad::physics::Distance3D::y
::ad::physics::Distance y
Definition: Distance3D.hpp:121
ad::physics::Distance3D::operator==
bool operator==(const Distance3D &other) const
standard comparison operator
Definition: Distance3D.hpp:96
ad::physics::Distance3D::x
::ad::physics::Distance x
Definition: Distance3D.hpp:116
Distance.hpp
ad::physics::Distance3D::operator!=
bool operator!=(const Distance3D &other) const
standard comparison operator
Definition: Distance3D.hpp:108
ad::physics::Distance3D::ConstPtr
std::shared_ptr< Distance3D const > ConstPtr
Smart pointer on constant Distance3D.
Definition: Distance3D.hpp:49
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::Distance3D
DataType Distance3D.
Definition: Distance3D.hpp:39
ad::physics::Distance3D::operator=
Distance3D & operator=(const Distance3D &other)=default
standard assignment operator
ad::physics::operator<<
std::ostream & operator<<(std::ostream &os, Acceleration const &_value)
standard ostream operator
Definition: Acceleration.hpp:547
ad::physics::Distance3D::z
::ad::physics::Distance z
Definition: Distance3D.hpp:126