Aikido
pointers.hpp
Go to the documentation of this file.
1 #ifndef AIKIDO_COMMON_POINTERS_HPP_
2 #define AIKIDO_COMMON_POINTERS_HPP_
3 
4 #include <memory>
5 
6 // clang-format off
7 
8 // This macro must be used in the class' namespace. For example,
9 //
10 // namespace aikido {
11 // namespace constraint {
12 //
13 // AIKIDO_DECLARE_POINTERS(Testable)
14 //
15 // class Testable
16 // { ... };
17 //
18 // } // namespace constraint
19 // } // namespace aikido
20 //
21 #define AIKIDO_DECLARE_POINTERS(X) \
22  class X ; \
23  using X ## Ptr = std::shared_ptr< X >; \
24  using Const ## X ## Ptr = std::shared_ptr< const X >; \
25  using Weak ## X ## Ptr = std::weak_ptr< X >; \
26  using WeakConst ## X ## Ptr = std::weak_ptr< const X >; \
27  using Unique ## X ## Ptr = std::unique_ptr< X >; \
28  using UniqueConst ## X ## Ptr = std::unique_ptr< const X >;
29 
30 // clang-format on
31 
32 #endif // AIKIDO_COMMON_POINTERS_HPP_