Skip to content

Commit a0977d2

Browse files
pre-commit-ci[bot]kenji-miyake
authored andcommitted
ci(pre-commit): autofix
1 parent 927ac25 commit a0977d2

File tree

224 files changed

+3672
-4520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+3672
-4520
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
autoware_auto_cmake {#autoware-auto-cmake-design}
2-
===========
1+
# autoware_auto_cmake {#autoware-auto-cmake-design}
32

43
This is the design document for the `autoware_auto_cmake` package.
54

6-
75
# Purpose
86

97
Provide common CMake variables and functions to Autoware packages.
@@ -13,8 +11,8 @@ Those include:
1311
- Setting the language standard
1412
- Getting user-provided variables
1513
- Providing functions to:
16-
+ set compiler flags
17-
+ turn off optimizations
14+
- set compiler flags
15+
- turn off optimizations
1816

1917
# Design
2018

@@ -24,6 +22,6 @@ Add `autoware_auto_cmake` as a "build_depend" in the dependent packages.
2422

2523
### CMake variables {#cmake-config-variables}
2624

27-
|Name|Type|Descritpion|Default|
28-
|----|----|-----------|-------|
29-
|`DOWNLOAD_ARTIFACTS`|*BOOL*|Allow downloading artifacts at build time.|`OFF`|
25+
| Name | Type | Descritpion | Default |
26+
| -------------------- | ------ | ------------------------------------------ | ------- |
27+
| `DOWNLOAD_ARTIFACTS` | _BOOL_ | Allow downloading artifacts at build time. | `OFF` |

common/autoware_auto_cmake/package.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
<build_depend>ros_environment</build_depend>
1414

15-
<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>
16-
<buildtool_export_depend>ament_cmake_lint_cmake</buildtool_export_depend>
1715
<buildtool_export_depend>ament_cmake_copyright</buildtool_export_depend>
16+
<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>
1817
<buildtool_export_depend>ament_cmake_cppcheck</buildtool_export_depend>
1918
<buildtool_export_depend>ament_cmake_cpplint</buildtool_export_depend>
19+
<buildtool_export_depend>ament_cmake_lint_cmake</buildtool_export_depend>
2020
<buildtool_export_depend>ament_cmake_uncrustify</buildtool_export_depend>
2121

2222
<test_depend>ament_cmake_lint_cmake</test_depend>

common/autoware_auto_common/design/comparisons.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Comparisons {#helper-comparisons}
2-
===========
1+
# Comparisons {#helper-comparisons}
32

43
The `float_comparisons.hpp` library is a simple set of functions for performing approximate numerical comparisons.
54
There are separate functions for performing comparisons using absolute bounds and relative bounds. Absolute comparison checks are prefixed with `abs_` and relative checks are prefixed with `rel_`.
@@ -15,10 +14,10 @@ The `exclusive_or` function will test whether two values cast to different boole
1514

1615
# Assumptions
1716

18-
* The approximate comparisons all take an `epsilon` parameter.
19-
The value of this parameter must be >= 0.
20-
* The library is only intended to be used with floating point types.
21-
A static assertion will be thrown if the library is used with a non-floating point type.
17+
- The approximate comparisons all take an `epsilon` parameter.
18+
The value of this parameter must be >= 0.
19+
- The library is only intended to be used with floating point types.
20+
A static assertion will be thrown if the library is used with a non-floating point type.
2221

2322
# Example Usage
2423

common/autoware_auto_common/include/common/type_traits.hpp

+57-41
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,32 @@ namespace type_traits
4141
///
4242
/// @return A boolean that should be false for any type passed into this function.
4343
///
44-
template<typename T>
44+
template <typename T>
4545
constexpr inline autoware::common::types::bool8_t COMMON_PUBLIC impossible_branch() noexcept
4646
{
4747
return sizeof(T) == 0;
4848
}
4949

5050
/// Find an index of a type in a tuple
51-
template<class QueryT, class TupleT>
51+
template <class QueryT, class TupleT>
5252
struct COMMON_PUBLIC index
5353
{
5454
static_assert(!std::is_same<TupleT, std::tuple<>>::value, "Could not find QueryT in given tuple");
5555
};
5656

5757
/// Specialization for a tuple that starts with the HeadT type. End of recursion.
58-
template<class HeadT, class ... Tail>
58+
template <class HeadT, class... Tail>
5959
struct COMMON_PUBLIC index<HeadT, std::tuple<HeadT, Tail...>>
60-
: std::integral_constant<std::int32_t, 0> {};
60+
: std::integral_constant<std::int32_t, 0>
61+
{
62+
};
6163

6264
/// Specialization for a tuple with a type different to QueryT that calls the recursive step.
63-
template<class QueryT, class HeadT, class ... Tail>
65+
template <class QueryT, class HeadT, class... Tail>
6466
struct COMMON_PUBLIC index<QueryT, std::tuple<HeadT, Tail...>>
65-
: std::integral_constant<std::int32_t, 1 + index<QueryT, std::tuple<Tail...>>::value> {};
67+
: std::integral_constant<std::int32_t, 1 + index<QueryT, std::tuple<Tail...>>::value>
68+
{
69+
};
6670

6771
///
6872
/// @brief Visit every element in a tuple.
@@ -75,13 +79,17 @@ struct COMMON_PUBLIC index<QueryT, std::tuple<HeadT, Tail...>>
7579
///
7680
/// @return Does not return anything. Capture variables in a lambda to return any values.
7781
///
78-
template<std::size_t I = 0UL, typename Callable, typename ... TypesT>
79-
COMMON_PUBLIC inline constexpr typename std::enable_if_t<I == sizeof...(TypesT)>
80-
visit(std::tuple<TypesT...> &, Callable) noexcept {}
82+
template <std::size_t I = 0UL, typename Callable, typename... TypesT>
83+
COMMON_PUBLIC inline constexpr typename std::enable_if_t<I == sizeof...(TypesT)> visit(
84+
std::tuple<TypesT...> &, Callable) noexcept
85+
{
86+
}
8187
/// @brief Same as the previous specialization but for const tuple.
82-
template<std::size_t I = 0UL, typename Callable, typename ... TypesT>
83-
COMMON_PUBLIC inline constexpr typename std::enable_if_t<I == sizeof...(TypesT)>
84-
visit(const std::tuple<TypesT...> &, Callable) noexcept {}
88+
template <std::size_t I = 0UL, typename Callable, typename... TypesT>
89+
COMMON_PUBLIC inline constexpr typename std::enable_if_t<I == sizeof...(TypesT)> visit(
90+
const std::tuple<TypesT...> &, Callable) noexcept
91+
{
92+
}
8593

8694
///
8795
/// @brief Visit every element in a tuple.
@@ -98,32 +106,37 @@ visit(const std::tuple<TypesT...> &, Callable) noexcept {}
98106
///
99107
/// @return Does not return anything. Capture variables in a lambda to return any values.
100108
///
101-
template<std::size_t I = 0UL, typename Callable, typename ... TypesT>
102-
COMMON_PUBLIC inline constexpr typename std::enable_if_t<I != sizeof...(TypesT)>
103-
visit(std::tuple<TypesT...> & tuple, Callable callable) noexcept
109+
template <std::size_t I = 0UL, typename Callable, typename... TypesT>
110+
COMMON_PUBLIC inline constexpr typename std::enable_if_t<I != sizeof...(TypesT)> visit(
111+
std::tuple<TypesT...> & tuple, Callable callable) noexcept
104112
{
105113
callable(std::get<I>(tuple));
106114
visit<I + 1UL, Callable, TypesT...>(tuple, callable);
107115
}
108116
/// @brief Same as the previous specialization but for const tuple.
109-
template<std::size_t I = 0UL, typename Callable, typename ... TypesT>
110-
COMMON_PUBLIC inline constexpr typename std::enable_if_t<I != sizeof...(TypesT)>
111-
visit(const std::tuple<TypesT...> & tuple, Callable callable) noexcept
117+
template <std::size_t I = 0UL, typename Callable, typename... TypesT>
118+
COMMON_PUBLIC inline constexpr typename std::enable_if_t<I != sizeof...(TypesT)> visit(
119+
const std::tuple<TypesT...> & tuple, Callable callable) noexcept
112120
{
113121
callable(std::get<I>(tuple));
114122
visit<I + 1UL, Callable, TypesT...>(tuple, callable);
115123
}
116124

117125
/// @brief A class to compute a conjunction over given traits.
118-
template<class ...>
119-
struct COMMON_PUBLIC conjunction : std::true_type {};
126+
template <class...>
127+
struct COMMON_PUBLIC conjunction : std::true_type
128+
{
129+
};
120130
/// @brief A conjunction of another type shall derive from that type.
121-
template<class TraitT>
122-
struct COMMON_PUBLIC conjunction<TraitT>: TraitT {};
123-
template<class TraitT, class ... TraitsTs>
131+
template <class TraitT>
132+
struct COMMON_PUBLIC conjunction<TraitT> : TraitT
133+
{
134+
};
135+
template <class TraitT, class... TraitsTs>
124136
struct COMMON_PUBLIC conjunction<TraitT, TraitsTs...>
125-
: std::conditional_t<static_cast<bool>(TraitT::value), conjunction<TraitsTs...>, TraitT> {};
126-
137+
: std::conditional_t<static_cast<bool>(TraitT::value), conjunction<TraitsTs...>, TraitT>
138+
{
139+
};
127140

128141
///
129142
/// @brief A trait to check if a tuple has a type.
@@ -133,7 +146,7 @@ struct COMMON_PUBLIC conjunction<TraitT, TraitsTs...>
133146
/// @tparam QueryT A query type.
134147
/// @tparam TupleT A tuple to search the type in.
135148
///
136-
template<typename QueryT, typename TupleT>
149+
template <typename QueryT, typename TupleT>
137150
struct has_type;
138151

139152
///
@@ -142,8 +155,10 @@ struct has_type;
142155
///
143156
/// @tparam QueryT Any type.
144157
///
145-
template<typename QueryT>
146-
struct has_type<QueryT, std::tuple<>>: std::false_type {};
158+
template <typename QueryT>
159+
struct has_type<QueryT, std::tuple<>> : std::false_type
160+
{
161+
};
147162

148163
///
149164
/// @brief Recursive override of the main trait.
@@ -152,8 +167,10 @@ struct has_type<QueryT, std::tuple<>>: std::false_type {};
152167
/// @tparam HeadT Head type in the tuple.
153168
/// @tparam TailTs Rest of the tuple types.
154169
///
155-
template<typename QueryT, typename HeadT, typename ... TailTs>
156-
struct has_type<QueryT, std::tuple<HeadT, TailTs...>>: has_type<QueryT, std::tuple<TailTs...>> {};
170+
template <typename QueryT, typename HeadT, typename... TailTs>
171+
struct has_type<QueryT, std::tuple<HeadT, TailTs...>> : has_type<QueryT, std::tuple<TailTs...>>
172+
{
173+
};
157174

158175
///
159176
/// @brief End of recursion for the main `has_type` trait. Becomes a `true_type` when the first
@@ -162,9 +179,10 @@ struct has_type<QueryT, std::tuple<HeadT, TailTs...>>: has_type<QueryT, std::tup
162179
/// @tparam QueryT Query type.
163180
/// @tparam TailTs Other types in the tuple.
164181
///
165-
template<typename QueryT, typename ... TailTs>
166-
struct has_type<QueryT, std::tuple<QueryT, TailTs...>>: std::true_type {};
167-
182+
template <typename QueryT, typename... TailTs>
183+
struct has_type<QueryT, std::tuple<QueryT, TailTs...>> : std::true_type
184+
{
185+
};
168186

169187
///
170188
/// @brief A trait used to intersect types stored in tuples at compile time. The resulting
@@ -176,7 +194,7 @@ struct has_type<QueryT, std::tuple<QueryT, TailTs...>>: std::true_type {};
176194
/// @tparam TupleT1 Tuple 1
177195
/// @tparam TupleT2 Tuple 2
178196
///
179-
template<typename TupleT1, typename TupleT2>
197+
template <typename TupleT1, typename TupleT2>
180198
struct intersect
181199
{
182200
///
@@ -185,18 +203,16 @@ struct intersect
185203
/// @details This function "iterates" over the types in TupleT1 and checks if those are in
186204
/// TupleT2. If this is true, these types are concatenated into a new tuple.
187205
///
188-
template<std::size_t... Indices>
206+
template <std::size_t... Indices>
189207
static constexpr auto make_intersection(std::index_sequence<Indices...>)
190208
{
191-
return std::tuple_cat(
192-
std::conditional_t<
193-
has_type<std::tuple_element_t<Indices, TupleT1>, TupleT2>::value,
194-
std::tuple<std::tuple_element_t<Indices, TupleT1>>,
195-
std::tuple<>>{} ...);
209+
return std::tuple_cat(std::conditional_t<
210+
has_type<std::tuple_element_t<Indices, TupleT1>, TupleT2>::value,
211+
std::tuple<std::tuple_element_t<Indices, TupleT1>>, std::tuple<>>{}...);
196212
}
197213
/// The resulting tuple type.
198214
using type =
199-
decltype(make_intersection(std::make_index_sequence<std::tuple_size<TupleT1>::value> {}));
215+
decltype(make_intersection(std::make_index_sequence<std::tuple_size<TupleT1>::value>{}));
200216
};
201217

202218
} // namespace type_traits

common/autoware_auto_common/include/common/types.hpp

+20-31
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
#ifndef COMMON__TYPES_HPP_
2020
#define COMMON__TYPES_HPP_
2121

22+
#include "common/visibility_control.hpp"
23+
#include "helper_functions/float_comparisons.hpp"
24+
2225
#include <cstdint>
23-
#include <vector>
2426
#include <limits>
25-
26-
#include "helper_functions/float_comparisons.hpp"
27-
#include "common/visibility_control.hpp"
27+
#include <vector>
2828

2929
namespace autoware
3030
{
@@ -61,16 +61,12 @@ struct COMMON_PUBLIC PointXYZIF
6161
float32_t intensity{0};
6262
uint16_t id{0};
6363
static constexpr uint16_t END_OF_SCAN_ID = 65535u;
64-
friend bool operator==(
65-
const PointXYZIF & p1,
66-
const PointXYZIF & p2) noexcept
64+
friend bool operator==(const PointXYZIF & p1, const PointXYZIF & p2) noexcept
6765
{
6866
using autoware::common::helper_functions::comparisons::rel_eq;
6967
const auto epsilon = std::numeric_limits<float32_t>::epsilon();
70-
return rel_eq(p1.x, p2.x, epsilon) &&
71-
rel_eq(p1.y, p2.y, epsilon) &&
72-
rel_eq(p1.z, p2.z, epsilon) &&
73-
rel_eq(p1.intensity, p2.intensity, epsilon) &&
68+
return rel_eq(p1.x, p2.x, epsilon) && rel_eq(p1.y, p2.y, epsilon) &&
69+
rel_eq(p1.z, p2.z, epsilon) && rel_eq(p1.intensity, p2.intensity, epsilon) &&
7470
(p1.id == p2.id);
7571
}
7672
};
@@ -82,16 +78,12 @@ struct COMMON_PUBLIC PointXYZF
8278
float32_t z{0};
8379
uint16_t id{0};
8480
static constexpr uint16_t END_OF_SCAN_ID = 65535u;
85-
friend bool operator==(
86-
const PointXYZF & p1,
87-
const PointXYZF & p2) noexcept
81+
friend bool operator==(const PointXYZF & p1, const PointXYZF & p2) noexcept
8882
{
8983
using autoware::common::helper_functions::comparisons::rel_eq;
9084
const auto epsilon = std::numeric_limits<float32_t>::epsilon();
91-
return rel_eq(p1.x, p2.x, epsilon) &&
92-
rel_eq(p1.y, p2.y, epsilon) &&
93-
rel_eq(p1.z, p2.z, epsilon) &&
94-
(p1.id == p2.id);
85+
return rel_eq(p1.x, p2.x, epsilon) && rel_eq(p1.y, p2.y, epsilon) &&
86+
rel_eq(p1.z, p2.z, epsilon) && (p1.id == p2.id);
9587
}
9688
};
9789

@@ -101,22 +93,19 @@ struct COMMON_PUBLIC PointXYZI
10193
float32_t y{0.0F};
10294
float32_t z{0.0F};
10395
float32_t intensity{0.0F};
104-
friend bool operator==(
105-
const PointXYZI & p1,
106-
const PointXYZI & p2) noexcept
96+
friend bool operator==(const PointXYZI & p1, const PointXYZI & p2) noexcept
10797
{
108-
return
109-
helper_functions::comparisons::rel_eq(
110-
p1.x, p2.x, std::numeric_limits<float32_t>::epsilon()) &&
98+
return helper_functions::comparisons::rel_eq(
99+
p1.x, p2.x, std::numeric_limits<float32_t>::epsilon()) &&
111100

112-
helper_functions::comparisons::rel_eq(
113-
p1.y, p2.y, std::numeric_limits<float32_t>::epsilon()) &&
101+
helper_functions::comparisons::rel_eq(
102+
p1.y, p2.y, std::numeric_limits<float32_t>::epsilon()) &&
114103

115-
helper_functions::comparisons::rel_eq(
116-
p1.z, p2.z, std::numeric_limits<float32_t>::epsilon()) &&
104+
helper_functions::comparisons::rel_eq(
105+
p1.z, p2.z, std::numeric_limits<float32_t>::epsilon()) &&
117106

118-
helper_functions::comparisons::rel_eq(
119-
p1.intensity, p2.intensity, std::numeric_limits<float32_t>::epsilon());
107+
helper_functions::comparisons::rel_eq(
108+
p1.intensity, p2.intensity, std::numeric_limits<float32_t>::epsilon());
120109
}
121110
};
122111

@@ -127,7 +116,7 @@ static constexpr uint16_t POINT_BLOCK_CAPACITY = 512U;
127116

128117
// TODO(yunus.caliskan): switch to std::void_t when C++17 is available
129118
/// \brief `std::void_t<> implementation
130-
template<typename ... Ts>
119+
template <typename... Ts>
131120
using void_t = void;
132121
} // namespace types
133122
} // namespace common

common/autoware_auto_common/include/common/visibility_control.hpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@
1818
#define COMMON__VISIBILITY_CONTROL_HPP_
1919

2020
#if defined(_MSC_VER) && defined(_WIN64)
21-
#if defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
22-
#define COMMON_PUBLIC __declspec(dllexport)
23-
#define COMMON_LOCAL
24-
#else // defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
25-
#define COMMON_PUBLIC __declspec(dllimport)
26-
#define COMMON_LOCAL
27-
#endif // defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
21+
#if defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
22+
#define COMMON_PUBLIC __declspec(dllexport)
23+
#define COMMON_LOCAL
24+
#else // defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
25+
#define COMMON_PUBLIC __declspec(dllimport)
26+
#define COMMON_LOCAL
27+
#endif // defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
2828
#elif defined(__GNUC__) && defined(__linux__)
29-
#define COMMON_PUBLIC __attribute__((visibility("default")))
30-
#define COMMON_LOCAL __attribute__((visibility("hidden")))
29+
#define COMMON_PUBLIC __attribute__((visibility("default")))
30+
#define COMMON_LOCAL __attribute__((visibility("hidden")))
3131
#elif defined(__GNUC__) && defined(__APPLE__)
32-
#define COMMON_PUBLIC __attribute__((visibility("default")))
33-
#define COMMON_LOCAL __attribute__((visibility("hidden")))
32+
#define COMMON_PUBLIC __attribute__((visibility("default")))
33+
#define COMMON_LOCAL __attribute__((visibility("hidden")))
3434
#else // !(defined(__GNUC__) && defined(__APPLE__))
35-
#error "Unsupported Build Configuration"
35+
#error "Unsupported Build Configuration"
3636
#endif // _MSC_VER
3737

3838
#endif // COMMON__VISIBILITY_CONTROL_HPP_

0 commit comments

Comments
 (0)