|
| 1 | +// Copyright 2017 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__EXECUTORS__EXECUTOR_TYPES_HPP_ |
| 16 | +#define RCLCPP__EXECUTORS__EXECUTOR_TYPES_HPP_ |
| 17 | + |
| 18 | +#include <gtest/gtest.h> |
| 19 | + |
| 20 | +#include <string> |
| 21 | +#include <type_traits> |
| 22 | + |
| 23 | +#include "rclcpp/experimental/executors/events_executor/events_executor.hpp" |
| 24 | +#include "rclcpp/executors/single_threaded_executor.hpp" |
| 25 | +#include "rclcpp/executors/static_single_threaded_executor.hpp" |
| 26 | +#include "rclcpp/executors/multi_threaded_executor.hpp" |
| 27 | + |
| 28 | +using ExecutorTypes = |
| 29 | + ::testing::Types< |
| 30 | + rclcpp::executors::SingleThreadedExecutor, |
| 31 | + rclcpp::executors::MultiThreadedExecutor, |
| 32 | + rclcpp::executors::StaticSingleThreadedExecutor, |
| 33 | + rclcpp::experimental::executors::EventsExecutor>; |
| 34 | + |
| 35 | +class ExecutorTypeNames |
| 36 | +{ |
| 37 | +public: |
| 38 | + template<typename T> |
| 39 | + static std::string GetName(int idx) |
| 40 | + { |
| 41 | + (void)idx; |
| 42 | + if (std::is_same<T, rclcpp::executors::SingleThreadedExecutor>()) { |
| 43 | + return "SingleThreadedExecutor"; |
| 44 | + } |
| 45 | + |
| 46 | + if (std::is_same<T, rclcpp::executors::MultiThreadedExecutor>()) { |
| 47 | + return "MultiThreadedExecutor"; |
| 48 | + } |
| 49 | + |
| 50 | + if (std::is_same<T, rclcpp::executors::StaticSingleThreadedExecutor>()) { |
| 51 | + return "StaticSingleThreadedExecutor"; |
| 52 | + } |
| 53 | + |
| 54 | + if (std::is_same<T, rclcpp::experimental::executors::EventsExecutor>()) { |
| 55 | + return "EventsExecutor"; |
| 56 | + } |
| 57 | + |
| 58 | + return ""; |
| 59 | + } |
| 60 | +}; |
| 61 | + |
| 62 | +// StaticSingleThreadedExecutor is not included in these tests for now, due to: |
| 63 | +// https://github.com/ros2/rclcpp/issues/1219 |
| 64 | +using StandardExecutors = |
| 65 | + ::testing::Types< |
| 66 | + rclcpp::executors::SingleThreadedExecutor, |
| 67 | + rclcpp::executors::MultiThreadedExecutor, |
| 68 | + rclcpp::experimental::executors::EventsExecutor>; |
| 69 | + |
| 70 | +#endif // RCLCPP__EXECUTORS__EXECUTOR_TYPES_HPP_ |
0 commit comments