rclcpp  master
C++ ROS Client Library API
Macros
macros.hpp File Reference
#include <memory>
#include <utility>
Include dependency graph for macros.hpp:

Go to the source code of this file.

Macros

#define RCLCPP_DISABLE_COPY(...)
 
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
 
#define RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE(...)
 
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
 
#define __RCLCPP_SHARED_PTR_ALIAS(...)
 
#define __RCLCPP_MAKE_SHARED_DEFINITION(...)
 
#define RCLCPP_SHARED_PTR_DEFINITIONS(...)
 Defines aliases and static functions for using the Class with shared_ptrs. More...
 
#define __RCLCPP_WEAK_PTR_ALIAS(...)
 
#define RCLCPP_WEAK_PTR_DEFINITIONS(...)   __RCLCPP_WEAK_PTR_ALIAS(__VA_ARGS__)
 Defines aliases and static functions for using the Class with weak_ptrs. More...
 
#define __RCLCPP_UNIQUE_PTR_ALIAS(...)   using UniquePtr = std::unique_ptr<__VA_ARGS__>;
 
#define __RCLCPP_MAKE_UNIQUE_DEFINITION(...)
 
#define RCLCPP_UNIQUE_PTR_DEFINITIONS(...)
 Defines aliases and static functions for using the Class with unique_ptrs. More...
 
#define RCLCPP_STRING_JOIN(arg1, arg2)   RCLCPP_DO_STRING_JOIN(arg1, arg2)
 
#define RCLCPP_DO_STRING_JOIN(arg1, arg2)   arg1 ## arg2
 

Macro Definition Documentation

◆ RCLCPP_DISABLE_COPY

#define RCLCPP_DISABLE_COPY (   ...)
Value:
__VA_ARGS__(const __VA_ARGS__ &) = delete; \
__VA_ARGS__ & operator=(const __VA_ARGS__ &) = delete;

Disables the copy constructor and operator= for the given class.

Use in the private section of the class.

◆ RCLCPP_SMART_PTR_DEFINITIONS

#define RCLCPP_SMART_PTR_DEFINITIONS (   ...)
Value:
RCLCPP_WEAK_PTR_DEFINITIONS(__VA_ARGS__) \
RCLCPP_UNIQUE_PTR_DEFINITIONS(__VA_ARGS__)

Defines aliases and static functions for using the Class with smart pointers.

Use in the public section of the class. Make sure to include <memory> in the header when using this.

◆ RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE

#define RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE (   ...)
Value:
RCLCPP_WEAK_PTR_DEFINITIONS(__VA_ARGS__) \
__RCLCPP_UNIQUE_PTR_ALIAS(__VA_ARGS__)

Defines aliases and static functions for using the Class with smart pointers.

Same as RCLCPP_SMART_PTR_DEFINITIONS except it excludes the static Class::make_unique() method definition which does not work on classes which are not CopyConstructable.

Use in the public section of the class. Make sure to include <memory> in the header when using this.

◆ RCLCPP_SMART_PTR_ALIASES_ONLY

#define RCLCPP_SMART_PTR_ALIASES_ONLY (   ...)
Value:
__RCLCPP_WEAK_PTR_ALIAS(__VA_ARGS__) \
__RCLCPP_UNIQUE_PTR_ALIAS(__VA_ARGS__) \
__RCLCPP_MAKE_SHARED_DEFINITION(__VA_ARGS__)

Defines aliases only for using the Class with smart pointers.

Same as RCLCPP_SMART_PTR_DEFINITIONS except it excludes the static method definitions which do not work on pure virtual classes and classes which are not CopyConstructable.

Use in the public section of the class. Make sure to include <memory> in the header when using this.

◆ __RCLCPP_SHARED_PTR_ALIAS

#define __RCLCPP_SHARED_PTR_ALIAS (   ...)

◆ __RCLCPP_MAKE_SHARED_DEFINITION

#define __RCLCPP_MAKE_SHARED_DEFINITION (   ...)
Value:
template<typename ... Args> \
make_shared(Args && ... args) \
{ \
return std::make_shared<__VA_ARGS__>(std::forward<Args>(args) ...); \
}

◆ RCLCPP_SHARED_PTR_DEFINITIONS

#define RCLCPP_SHARED_PTR_DEFINITIONS (   ...)
Value:
__RCLCPP_MAKE_SHARED_DEFINITION(__VA_ARGS__)

Defines aliases and static functions for using the Class with shared_ptrs.

◆ __RCLCPP_WEAK_PTR_ALIAS

#define __RCLCPP_WEAK_PTR_ALIAS (   ...)
Value:
using WeakPtr = std::weak_ptr<__VA_ARGS__>; \
using ConstWeakPtr = std::weak_ptr<const __VA_ARGS__>;

◆ RCLCPP_WEAK_PTR_DEFINITIONS

#define RCLCPP_WEAK_PTR_DEFINITIONS (   ...)    __RCLCPP_WEAK_PTR_ALIAS(__VA_ARGS__)

Defines aliases and static functions for using the Class with weak_ptrs.

◆ __RCLCPP_UNIQUE_PTR_ALIAS

#define __RCLCPP_UNIQUE_PTR_ALIAS (   ...)    using UniquePtr = std::unique_ptr<__VA_ARGS__>;

◆ __RCLCPP_MAKE_UNIQUE_DEFINITION

#define __RCLCPP_MAKE_UNIQUE_DEFINITION (   ...)
Value:
template<typename ... Args> \
make_unique(Args && ... args) \
{ \
return std::unique_ptr<__VA_ARGS__>(new __VA_ARGS__(std::forward<Args>(args) ...)); \
}

◆ RCLCPP_UNIQUE_PTR_DEFINITIONS

#define RCLCPP_UNIQUE_PTR_DEFINITIONS (   ...)
Value:
__RCLCPP_MAKE_UNIQUE_DEFINITION(__VA_ARGS__)

Defines aliases and static functions for using the Class with unique_ptrs.

◆ RCLCPP_STRING_JOIN

#define RCLCPP_STRING_JOIN (   arg1,
  arg2 
)    RCLCPP_DO_STRING_JOIN(arg1, arg2)

◆ RCLCPP_DO_STRING_JOIN

#define RCLCPP_DO_STRING_JOIN (   arg1,
  arg2 
)    arg1 ## arg2
std::shared_ptr
RCLCPP_SHARED_PTR_DEFINITIONS
#define RCLCPP_SHARED_PTR_DEFINITIONS(...)
Defines aliases and static functions for using the Class with shared_ptrs.
Definition: macros.hpp:85
__RCLCPP_UNIQUE_PTR_ALIAS
#define __RCLCPP_UNIQUE_PTR_ALIAS(...)
Definition: macros.hpp:96
rclcpp::IntraProcessBufferType::SharedPtr
@ SharedPtr
Set the data type used in the intra-process buffer as std::shared_ptr<MessageT>
std::weak_ptr
__RCLCPP_SHARED_PTR_ALIAS
#define __RCLCPP_SHARED_PTR_ALIAS(...)
Definition: macros.hpp:72
std::unique_ptr