ad_rss
LaneSegment.hpp
Go to the documentation of this file.
1 /*
2  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
3  *
4  * Copyright (C) 2018-2022 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/MetricRange.hpp"
30 namespace ad {
34 namespace rss {
38 namespace world {
39 
46 {
50  typedef std::shared_ptr<LaneSegment> Ptr;
51 
55  typedef std::shared_ptr<LaneSegment const> ConstPtr;
56 
60  LaneSegment() = default;
61 
65  ~LaneSegment() = default;
66 
70  LaneSegment(const LaneSegment &other) = default;
71 
75  LaneSegment(LaneSegment &&other) = default;
76 
84  LaneSegment &operator=(const LaneSegment &other) = default;
85 
93  LaneSegment &operator=(LaneSegment &&other) = default;
94 
102  bool operator==(const LaneSegment &other) const
103  {
104  return (id == other.id) && (driving_direction == other.driving_direction) && (length == other.length)
105  && (width == other.width);
106  }
107 
115  bool operator!=(const LaneSegment &other) const
116  {
117  return !operator==(other);
118  }
119 
124 
128  ::ad::rss::world::LaneDrivingDirection driving_direction{::ad::rss::world::LaneDrivingDirection::Bidirectional};
129 
133  ::ad::physics::MetricRange length;
134 
138  ::ad::physics::MetricRange width;
139 };
140 
141 } // namespace world
142 } // namespace rss
143 } // namespace ad
144 
148 #ifndef GEN_GUARD_AD_RSS_WORLD_LANESEGMENT
149 #define GEN_GUARD_AD_RSS_WORLD_LANESEGMENT
153 namespace ad {
157 namespace rss {
161 namespace world {
162 
172 inline std::ostream &operator<<(std::ostream &os, LaneSegment const &_value)
173 {
174  os << "LaneSegment(";
175  os << "id:";
176  os << _value.id;
177  os << ",";
178  os << "driving_direction:";
179  os << _value.driving_direction;
180  os << ",";
181  os << "length:";
182  os << _value.length;
183  os << ",";
184  os << "width:";
185  os << _value.width;
186  os << ")";
187  return os;
188 }
189 
190 } // namespace world
191 } // namespace rss
192 } // namespace ad
193 
194 namespace std {
198 inline std::string to_string(::ad::rss::world::LaneSegment const &value)
199 {
200  stringstream sstream;
201  sstream << value;
202  return sstream.str();
203 }
204 } // namespace std
205 
209 template <> struct fmt::formatter<::ad::rss::world::LaneSegment> : formatter<string_view>
210 {
211  template <typename FormatContext> auto format(::ad::rss::world::LaneSegment const &value, FormatContext &ctx)
212  {
213  return formatter<string_view>::format(std::to_string(value), ctx);
214  }
215 };
216 
217 #endif // GEN_GUARD_AD_RSS_WORLD_LANESEGMENT
std::string to_string(::ad::rss::core::LateralRelativePosition const &value)
overload of the std::to_string for LateralRelativePosition
Definition: LateralRelativePosition.hpp:162
LaneDrivingDirection
DataType LaneDrivingDirection.
Definition: LaneDrivingDirection.hpp:42
uint64_t LaneSegmentId
DataType LaneSegmentId.
Definition: LaneSegmentId.hpp:39
std::ostream & operator<<(std::ostream &os, Constellation const &_value)
standard ostream operator
Definition: Constellation.hpp:198
namespace ad
Definition: LateralRelativePosition.hpp:28
DataType LaneSegment.
Definition: LaneSegment.hpp:46
LaneSegment(const LaneSegment &other)=default
standard copy constructor
bool operator==(const LaneSegment &other) const
standard comparison operator
Definition: LaneSegment.hpp:102
std::shared_ptr< LaneSegment const > ConstPtr
Smart pointer on constant LaneSegment.
Definition: LaneSegment.hpp:55
::ad::rss::world::LaneSegmentId id
Definition: LaneSegment.hpp:123
LaneSegment(LaneSegment &&other)=default
standard move constructor
LaneSegment & operator=(LaneSegment &&other)=default
standard move operator
LaneSegment & operator=(const LaneSegment &other)=default
standard assignment operator
~LaneSegment()=default
standard destructor
std::shared_ptr< LaneSegment > Ptr
Smart pointer on LaneSegment.
Definition: LaneSegment.hpp:50
bool operator!=(const LaneSegment &other) const
standard comparison operator
Definition: LaneSegment.hpp:115
::ad::rss::world::LaneDrivingDirection driving_direction
Definition: LaneSegment.hpp:128
::ad::physics::MetricRange length
Definition: LaneSegment.hpp:133
::ad::physics::MetricRange width
Definition: LaneSegment.hpp:138
LaneSegment()=default
standard constructor