.. _program_listing_file_include_rclcpp_macros.hpp: Program Listing for File macros.hpp =================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/rclcpp/macros.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2014 Open Source Robotics Foundation, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include #include #ifndef RCLCPP__MACROS_HPP_ #define RCLCPP__MACROS_HPP_ #define RCLCPP_DISABLE_COPY(...) \ __VA_ARGS__(const __VA_ARGS__ &) = delete; \ __VA_ARGS__ & operator=(const __VA_ARGS__ &) = delete; #define RCLCPP_SMART_PTR_DEFINITIONS(...) \ RCLCPP_SHARED_PTR_DEFINITIONS(__VA_ARGS__) \ RCLCPP_WEAK_PTR_DEFINITIONS(__VA_ARGS__) \ RCLCPP_UNIQUE_PTR_DEFINITIONS(__VA_ARGS__) #define RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE(...) \ RCLCPP_SHARED_PTR_DEFINITIONS(__VA_ARGS__) \ RCLCPP_WEAK_PTR_DEFINITIONS(__VA_ARGS__) \ __RCLCPP_UNIQUE_PTR_ALIAS(__VA_ARGS__) #define RCLCPP_SMART_PTR_ALIASES_ONLY(...) \ __RCLCPP_SHARED_PTR_ALIAS(__VA_ARGS__) \ __RCLCPP_WEAK_PTR_ALIAS(__VA_ARGS__) \ __RCLCPP_UNIQUE_PTR_ALIAS(__VA_ARGS__) \ __RCLCPP_MAKE_SHARED_DEFINITION(__VA_ARGS__) #define __RCLCPP_SHARED_PTR_ALIAS(...) \ using SharedPtr = std::shared_ptr<__VA_ARGS__>; \ using ConstSharedPtr = std::shared_ptr; #define __RCLCPP_MAKE_SHARED_DEFINITION(...) \ template \ static std::shared_ptr<__VA_ARGS__> \ make_shared(Args && ... args) \ { \ return std::make_shared<__VA_ARGS__>(std::forward(args) ...); \ } #define RCLCPP_SHARED_PTR_DEFINITIONS(...) \ __RCLCPP_SHARED_PTR_ALIAS(__VA_ARGS__) \ __RCLCPP_MAKE_SHARED_DEFINITION(__VA_ARGS__) #define __RCLCPP_WEAK_PTR_ALIAS(...) \ using WeakPtr = std::weak_ptr<__VA_ARGS__>; \ using ConstWeakPtr = std::weak_ptr; #define RCLCPP_WEAK_PTR_DEFINITIONS(...) __RCLCPP_WEAK_PTR_ALIAS(__VA_ARGS__) #define __RCLCPP_UNIQUE_PTR_ALIAS(...) using UniquePtr = std::unique_ptr<__VA_ARGS__>; #define __RCLCPP_MAKE_UNIQUE_DEFINITION(...) \ template \ static std::unique_ptr<__VA_ARGS__> \ make_unique(Args && ... args) \ { \ return std::unique_ptr<__VA_ARGS__>(new __VA_ARGS__(std::forward(args) ...)); \ } #define RCLCPP_UNIQUE_PTR_DEFINITIONS(...) \ __RCLCPP_UNIQUE_PTR_ALIAS(__VA_ARGS__) \ __RCLCPP_MAKE_UNIQUE_DEFINITION(__VA_ARGS__) #define RCLCPP_STRING_JOIN(arg1, arg2) RCLCPP_DO_STRING_JOIN(arg1, arg2) #define RCLCPP_DO_STRING_JOIN(arg1, arg2) arg1 ## arg2 #endif // RCLCPP__MACROS_HPP_