15 #ifndef RCLCPP__CONTEXT_HPP_ 16 #define RCLCPP__CONTEXT_HPP_ 18 #include <condition_variable> 25 #include <unordered_map> 109 char const *
const argv[],
129 get_init_options()
const;
202 get_on_shutdown_callbacks()
const;
211 get_on_shutdown_callbacks();
238 interrupt_all_sleep_for();
296 interrupt_all_wait_sets();
299 template<
typename SubContext,
typename ... Args>
307 auto it = sub_contexts_.find(type_i);
308 if (it == sub_contexts_.end()) {
311 new SubContext(std::forward<Args>(args) ...),
312 [](SubContext * sub_context_ptr) {
313 delete sub_context_ptr;
315 sub_contexts_[type_i] = sub_context;
355 std::mutex interrupt_guard_cond_handles_mutex_;
370 #endif // RCLCPP__CONTEXT_HPP_
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
Context which encapsulates shared state between nodes and other similar entities. ...
Definition: context.hpp:53
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
bool shutdown(rclcpp::Context::SharedPtr context=nullptr, const std::string &reason="user called rclcpp::shutdown()")
Shutdown rclcpp context, invalidating it for derived entities.
void init(int argc, char const *const argv[], const InitOptions &init_options=InitOptions())
Initialize communications via the rmw implementation and set up a global signal handler.
bool sleep_for(const std::chrono::nanoseconds &nanoseconds, rclcpp::Context::SharedPtr context=nullptr)
Use the global condition variable to block for the specified amount of time.
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
std::shared_ptr< SubContext > get_sub_context(Args &&... args)
Return a singleton instance for the SubContext type, constructing one if necessary.
Definition: context.hpp:301
void on_shutdown(std::function< void()> callback, rclcpp::Context::SharedPtr context=nullptr)
Register a function to be called when shutdown is called on the context.
T static_pointer_cast(T... args)
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
Thrown when init is called on an already initialized context.
Definition: context.hpp:40
ContextAlreadyInitialized()
Definition: context.hpp:43
Encapsulation of options for initializing rclcpp.
Definition: init_options.hpp:27
std::vector< Context::SharedPtr > get_contexts()
Return a copy of the list of context shared pointers.