ad_rss
StructuredObjectState.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"
29 namespace ad {
33 namespace rss {
37 namespace core {
38 
49 {
53  typedef std::shared_ptr<StructuredObjectState> Ptr;
54 
58  typedef std::shared_ptr<StructuredObjectState const> ConstPtr;
59 
63  StructuredObjectState() = default;
64 
69 
74 
79 
88 
97 
105  bool operator==(const StructuredObjectState &other) const
106  {
107  return (velocity == other.velocity) && (has_priority == other.has_priority)
111  }
112 
120  bool operator!=(const StructuredObjectState &other) const
121  {
122  return !operator==(other);
123  }
124 
129 
133  bool has_priority{false};
134 
138  bool is_in_correct_lane{false};
139 
143  ::ad::physics::Distance distance_to_enter_intersection{std::numeric_limits<::ad::physics::Distance>::max()};
144 
148  ::ad::physics::Distance distance_to_leave_intersection{std::numeric_limits<::ad::physics::Distance>::max()};
149 };
150 
151 } // namespace core
152 } // namespace rss
153 } // namespace ad
154 
158 #ifndef GEN_GUARD_AD_RSS_CORE_STRUCTUREDOBJECTSTATE
159 #define GEN_GUARD_AD_RSS_CORE_STRUCTUREDOBJECTSTATE
163 namespace ad {
167 namespace rss {
171 namespace core {
172 
182 inline std::ostream &operator<<(std::ostream &os, StructuredObjectState const &_value)
183 {
184  os << "StructuredObjectState(";
185  os << "velocity:";
186  os << _value.velocity;
187  os << ",";
188  os << "has_priority:";
189  os << _value.has_priority;
190  os << ",";
191  os << "is_in_correct_lane:";
192  os << _value.is_in_correct_lane;
193  os << ",";
194  os << "distance_to_enter_intersection:";
195  os << _value.distance_to_enter_intersection;
196  os << ",";
197  os << "distance_to_leave_intersection:";
198  os << _value.distance_to_leave_intersection;
199  os << ")";
200  return os;
201 }
202 
203 } // namespace core
204 } // namespace rss
205 } // namespace ad
206 
207 namespace std {
211 inline std::string to_string(::ad::rss::core::StructuredObjectState const &value)
212 {
213  stringstream sstream;
214  sstream << value;
215  return sstream.str();
216 }
217 } // namespace std
218 
222 template <> struct fmt::formatter<::ad::rss::core::StructuredObjectState> : formatter<string_view>
223 {
224  template <typename FormatContext> auto format(::ad::rss::core::StructuredObjectState const &value, FormatContext &ctx)
225  {
226  return formatter<string_view>::format(std::to_string(value), ctx);
227  }
228 };
229 
230 #endif // GEN_GUARD_AD_RSS_CORE_STRUCTUREDOBJECTSTATE
std::string to_string(::ad::rss::core::LateralRelativePosition const &value)
overload of the std::to_string for LateralRelativePosition
Definition: LateralRelativePosition.hpp:162
std::ostream & operator<<(std::ostream &os, LateralRelativePosition const &value)
standard ostream operator
Definition: LateralRelativePosition.hpp:149
namespace ad
Definition: LateralRelativePosition.hpp:28
DataType StructuredObjectState.
Definition: StructuredObjectState.hpp:49
::ad::physics::Distance distance_to_leave_intersection
Definition: StructuredObjectState.hpp:148
bool operator==(const StructuredObjectState &other) const
standard comparison operator
Definition: StructuredObjectState.hpp:105
std::shared_ptr< StructuredObjectState > Ptr
Smart pointer on StructuredObjectState.
Definition: StructuredObjectState.hpp:53
StructuredObjectState()=default
standard constructor
StructuredObjectState(StructuredObjectState &&other)=default
standard move constructor
bool operator!=(const StructuredObjectState &other) const
standard comparison operator
Definition: StructuredObjectState.hpp:120
std::shared_ptr< StructuredObjectState const > ConstPtr
Smart pointer on constant StructuredObjectState.
Definition: StructuredObjectState.hpp:58
bool is_in_correct_lane
Definition: StructuredObjectState.hpp:138
StructuredObjectState(const StructuredObjectState &other)=default
standard copy constructor
StructuredObjectState & operator=(StructuredObjectState &&other)=default
standard move operator
~StructuredObjectState()=default
standard destructor
bool has_priority
Definition: StructuredObjectState.hpp:133
StructuredObjectState & operator=(const StructuredObjectState &other)=default
standard assignment operator
::ad::rss::world::Velocity velocity
Definition: StructuredObjectState.hpp:128
::ad::physics::Distance distance_to_enter_intersection
Definition: StructuredObjectState.hpp:143
DataType Velocity.
Definition: Velocity.hpp:48