rclcpp_lifecycle
master
C++ ROS Lifecycle Library API
include
rclcpp_lifecycle
type_traits
is_manageable_node.hpp
Go to the documentation of this file.
1
// Copyright 2016 Open Source Robotics Foundation, Inc.
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
#ifndef RCLCPP_LIFECYCLE__TYPE_TRAITS__IS_MANAGEABLE_NODE_HPP_
16
#define RCLCPP_LIFECYCLE__TYPE_TRAITS__IS_MANAGEABLE_NODE_HPP_
17
18
#include <utility>
19
#include <type_traits>
20
21
template
<
class
T,
typename
=
void
>
22
struct
has_on_activate
23
{
24
static
constexpr
bool
value
=
false
;
25
};
26
27
template
<
class
T>
28
struct
has_on_activate
<
29
T,
30
typename
std
::enable_if<
31
std::is_same<void, decltype(std::declval<T>().on_activate())>::value>::type>
32
{
33
static
constexpr
bool
value
=
true
;
34
};
35
36
template
<
class
T,
typename
=
void
>
37
struct
has_on_deactivate
38
{
39
static
constexpr
bool
value
=
false
;
40
};
41
42
template
<
class
T>
43
struct
has_on_deactivate
<
44
T,
45
typename
std
::enable_if<
46
std::is_same<void, decltype(std::declval<T>().on_deactivate())>::value>::type>
47
{
48
static
constexpr
bool
value
=
true
;
49
};
50
51
template
<
class
T,
typename
=
void
>
52
struct
is_manageable_node
:
std::false_type
53
{};
54
55
template
<
class
T>
56
struct
is_manageable_node
<
57
T,
58
typename
std
::enable_if<
59
has_on_activate<T>::value && has_on_deactivate<T>::value>::type>:
std::true_type
60
{};
61
62
#endif // RCLCPP_LIFECYCLE__TYPE_TRAITS__IS_MANAGEABLE_NODE_HPP_
has_on_deactivate::value
static constexpr bool value
Definition:
is_manageable_node.hpp:39
std::false_type
has_on_deactivate
Definition:
is_manageable_node.hpp:37
has_on_activate
Definition:
is_manageable_node.hpp:22
has_on_activate::value
static constexpr bool value
Definition:
is_manageable_node.hpp:24
is_manageable_node
Definition:
is_manageable_node.hpp:52
std
Generated by
1.8.17