Autoware.Auto
crtp.hpp
Go to the documentation of this file.
1
// Copyright 2017-2019 the Autoware Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
//
15
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
18
19
#ifndef HELPER_FUNCTIONS__CRTP_HPP_
20
#define HELPER_FUNCTIONS__CRTP_HPP_
21
22
namespace
autoware
23
{
24
namespace
common
25
{
26
namespace
helper_functions
27
{
28
template
<
typename
Derived>
29
class
crtp
30
{
31
protected
:
32
const
Derived &
impl
()
const
33
{
34
// This is the CRTP pattern for static polymorphism: this is related, static_cast is the only
35
// way to do this
36
//lint -e{9005, 9176, 1939} NOLINT
37
return
*
static_cast<
const
Derived *
>
(
this
);
38
}
39
40
Derived &
impl
()
41
{
42
// This is the CRTP pattern for static polymorphism: this is related, static_cast is the only
43
// way to do this
44
//lint -e{9005, 9176, 1939} NOLINT
45
return
*
static_cast<
Derived *
>
(
this
);
46
}
47
};
48
}
// namespace helper_functions
49
}
// namespace common
50
}
// namespace autoware
51
52
#endif // HELPER_FUNCTIONS__CRTP_HPP_
autoware
This file defines the lanelet2_map_provider_node class.
Definition:
quick_sort.hpp:24
autoware::common::helper_functions::crtp::impl
const Derived & impl() const
Definition:
crtp.hpp:32
autoware::common::helper_functions::crtp
Definition:
crtp.hpp:29
autoware::common::helper_functions::crtp::impl
Derived & impl()
Definition:
crtp.hpp:40