ad_rss
RoadSegment.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/Distance.hpp"
30 namespace ad {
34 namespace rss {
38 namespace world {
39 
49 {
53  typedef std::shared_ptr<RoadSegment> Ptr;
54 
58  typedef std::shared_ptr<RoadSegment const> ConstPtr;
59 
63  RoadSegment() = default;
64 
68  ~RoadSegment() = default;
69 
73  RoadSegment(const RoadSegment &other) = default;
74 
78  RoadSegment(RoadSegment &&other) = default;
79 
87  RoadSegment &operator=(const RoadSegment &other) = default;
88 
96  RoadSegment &operator=(RoadSegment &&other) = default;
97 
105  bool operator==(const RoadSegment &other) const
106  {
107  return (type == other.type) && (lane_segments == other.lane_segments)
110  }
111 
119  bool operator!=(const RoadSegment &other) const
120  {
121  return !operator==(other);
122  }
123 
127  ::ad::rss::world::RoadSegmentType type{::ad::rss::world::RoadSegmentType::Normal};
129 
136  ::ad::physics::Distance minimum_length_after_intersecting_area{0.0};
137 
144  ::ad::physics::Distance minimum_length_before_intersecting_area{0.0};
145 };
146 
147 } // namespace world
148 } // namespace rss
149 } // namespace ad
150 
154 #ifndef GEN_GUARD_AD_RSS_WORLD_ROADSEGMENT
155 #define GEN_GUARD_AD_RSS_WORLD_ROADSEGMENT
159 namespace ad {
163 namespace rss {
167 namespace world {
168 
178 inline std::ostream &operator<<(std::ostream &os, RoadSegment const &_value)
179 {
180  os << "RoadSegment(";
181  os << "type:";
182  os << _value.type;
183  os << ",";
184  os << "lane_segments:";
185  os << _value.lane_segments;
186  os << ",";
187  os << "minimum_length_after_intersecting_area:";
189  os << ",";
190  os << "minimum_length_before_intersecting_area:";
192  os << ")";
193  return os;
194 }
195 
196 } // namespace world
197 } // namespace rss
198 } // namespace ad
199 
200 namespace std {
204 inline std::string to_string(::ad::rss::world::RoadSegment const &value)
205 {
206  stringstream sstream;
207  sstream << value;
208  return sstream.str();
209 }
210 } // namespace std
211 
215 template <> struct fmt::formatter<::ad::rss::world::RoadSegment> : formatter<string_view>
216 {
217  template <typename FormatContext> auto format(::ad::rss::world::RoadSegment const &value, FormatContext &ctx)
218  {
219  return formatter<string_view>::format(std::to_string(value), ctx);
220  }
221 };
222 
223 #endif // GEN_GUARD_AD_RSS_WORLD_ROADSEGMENT
std::string to_string(::ad::rss::core::LateralRelativePosition const &value)
overload of the std::to_string for LateralRelativePosition
Definition: LateralRelativePosition.hpp:162
std::vector<::ad::rss::world::LaneSegment > LaneSegmentVector
DataType LaneSegmentVector.
Definition: LaneSegmentVector.hpp:43
std::ostream & operator<<(std::ostream &os, Constellation const &_value)
standard ostream operator
Definition: Constellation.hpp:198
RoadSegmentType
DataType RoadSegmentType.
Definition: RoadSegmentType.hpp:42
namespace ad
Definition: LateralRelativePosition.hpp:28
DataType RoadSegment.
Definition: RoadSegment.hpp:49
std::shared_ptr< RoadSegment const > ConstPtr
Smart pointer on constant RoadSegment.
Definition: RoadSegment.hpp:58
bool operator==(const RoadSegment &other) const
standard comparison operator
Definition: RoadSegment.hpp:105
bool operator!=(const RoadSegment &other) const
standard comparison operator
Definition: RoadSegment.hpp:119
RoadSegment & operator=(const RoadSegment &other)=default
standard assignment operator
RoadSegment(const RoadSegment &other)=default
standard copy constructor
RoadSegment & operator=(RoadSegment &&other)=default
standard move operator
RoadSegment()=default
standard constructor
~RoadSegment()=default
standard destructor
::ad::rss::world::RoadSegmentType type
Definition: RoadSegment.hpp:127
::ad::physics::Distance minimum_length_before_intersecting_area
Definition: RoadSegment.hpp:144
::ad::physics::Distance minimum_length_after_intersecting_area
Definition: RoadSegment.hpp:136
std::shared_ptr< RoadSegment > Ptr
Smart pointer on RoadSegment.
Definition: RoadSegment.hpp:53
RoadSegment(RoadSegment &&other)=default
standard move constructor