ad_rss
Object.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>
32 namespace ad {
36 namespace rss {
40 namespace world {
41 
48 struct Object
49 {
53  typedef std::shared_ptr<Object> Ptr;
54 
58  typedef std::shared_ptr<Object const> ConstPtr;
59 
63  Object() = default;
64 
68  ~Object() = default;
69 
73  Object(const Object &other) = default;
74 
78  Object(Object &&other) = default;
79 
87  Object &operator=(const Object &other) = default;
88 
96  Object &operator=(Object &&other) = default;
97 
105  bool operator==(const Object &other) const
106  {
107  return (object_id == other.object_id) && (object_type == other.object_type)
108  && (occupied_regions == other.occupied_regions) && (velocity == other.velocity) && (state == other.state);
109  }
110 
118  bool operator!=(const Object &other) const
119  {
120  return !operator==(other);
121  }
122 
127 
132 
137 
142 
147 };
148 
149 } // namespace world
150 } // namespace rss
151 } // namespace ad
152 
156 #ifndef GEN_GUARD_AD_RSS_WORLD_OBJECT
157 #define GEN_GUARD_AD_RSS_WORLD_OBJECT
161 namespace ad {
165 namespace rss {
169 namespace world {
170 
180 inline std::ostream &operator<<(std::ostream &os, Object const &_value)
181 {
182  os << "Object(";
183  os << "object_id:";
184  os << _value.object_id;
185  os << ",";
186  os << "object_type:";
187  os << _value.object_type;
188  os << ",";
189  os << "occupied_regions:";
190  os << _value.occupied_regions;
191  os << ",";
192  os << "velocity:";
193  os << _value.velocity;
194  os << ",";
195  os << "state:";
196  os << _value.state;
197  os << ")";
198  return os;
199 }
200 
201 } // namespace world
202 } // namespace rss
203 } // namespace ad
204 
205 namespace std {
209 inline std::string to_string(::ad::rss::world::Object const &value)
210 {
211  stringstream sstream;
212  sstream << value;
213  return sstream.str();
214 }
215 } // namespace std
216 
220 template <> struct fmt::formatter<::ad::rss::world::Object> : formatter<string_view>
221 {
222  template <typename FormatContext> auto format(::ad::rss::world::Object const &value, FormatContext &ctx)
223  {
224  return formatter<string_view>::format(std::to_string(value), ctx);
225  }
226 };
227 
228 #endif // GEN_GUARD_AD_RSS_WORLD_OBJECT
std::string to_string(::ad::rss::core::LateralRelativePosition const &value)
overload of the std::to_string for LateralRelativePosition
Definition: LateralRelativePosition.hpp:162
ObjectType
DataType ObjectType.
Definition: ObjectType.hpp:44
uint64_t ObjectId
DataType ObjectId.
Definition: ObjectId.hpp:39
std::vector<::ad::rss::world::OccupiedRegion > OccupiedRegionVector
DataType OccupiedRegionVector.
Definition: OccupiedRegionVector.hpp:42
std::ostream & operator<<(std::ostream &os, Constellation const &_value)
standard ostream operator
Definition: Constellation.hpp:198
namespace ad
Definition: LateralRelativePosition.hpp:28
DataType ObjectState.
Definition: ObjectState.hpp:52
DataType Object.
Definition: Object.hpp:49
Object()=default
standard constructor
Object(const Object &other)=default
standard copy constructor
::ad::rss::world::ObjectType object_type
Definition: Object.hpp:131
::ad::rss::world::Velocity velocity
Definition: Object.hpp:141
::ad::rss::world::ObjectId object_id
Definition: Object.hpp:126
std::shared_ptr< Object const > ConstPtr
Smart pointer on constant Object.
Definition: Object.hpp:58
Object & operator=(const Object &other)=default
standard assignment operator
bool operator!=(const Object &other) const
standard comparison operator
Definition: Object.hpp:118
Object(Object &&other)=default
standard move constructor
Object & operator=(Object &&other)=default
standard move operator
~Object()=default
standard destructor
bool operator==(const Object &other) const
standard comparison operator
Definition: Object.hpp:105
::ad::rss::world::OccupiedRegionVector occupied_regions
Definition: Object.hpp:136
std::shared_ptr< Object > Ptr
Smart pointer on Object.
Definition: Object.hpp:53
::ad::rss::world::ObjectState state
Definition: Object.hpp:146
DataType Velocity.
Definition: Velocity.hpp:48