15 #ifndef RCLCPP__CONTEXT_HPP_    16 #define RCLCPP__CONTEXT_HPP_    23 #include <unordered_map>    44   template<
typename SubContext, 
typename ... Args>
    45   std::shared_ptr<SubContext>
    48     std::lock_guard<std::mutex> lock(mutex_);
    50     std::type_index type_i(
typeid(SubContext));
    51     std::shared_ptr<SubContext> sub_context;
    52     auto it = sub_contexts_.find(type_i);
    53     if (it == sub_contexts_.end()) {
    56       sub_context = std::shared_ptr<SubContext>(
    57         new SubContext(std::forward<Args>(args) ...),
    58         [] (SubContext * sub_context_ptr) {
    59           delete sub_context_ptr;
    62       sub_contexts_[type_i] = sub_context;
    65       sub_context = std::static_pointer_cast<SubContext>(it->second);
    73   std::unordered_map<std::type_index, std::shared_ptr<void>> sub_contexts_;
    80 #endif  // RCLCPP__CONTEXT_HPP_ #define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
 
Definition: allocator_common.hpp:24
 
Definition: context.hpp:36
 
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
 
std::shared_ptr< SubContext > get_sub_context(Args &&... args)
Definition: context.hpp:46
 
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50